Compare commits
307 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a73335839 | ||
|
|
124badb961 | ||
|
|
8725b4fcf4 | ||
|
|
d12dce1c03 | ||
|
|
afb8efc0e9 | ||
|
|
bef31dc386 | ||
|
|
e8cd5e322f | ||
|
|
b4c4a81afb | ||
|
|
7478e82b9a | ||
|
|
4b586df2b5 | ||
|
|
ed62203527 | ||
|
|
73d4c3565c | ||
|
|
cc30f5f3da | ||
|
|
4e11a86b4e | ||
|
|
9f21f1dac4 | ||
|
|
d0f71bf64f | ||
|
|
950bb1810c | ||
|
|
81d0e9ea63 | ||
|
|
4b55175b7e | ||
|
|
cdf9eda132 | ||
|
|
7a953a166e | ||
|
|
f2d5d572ab | ||
|
|
02904cda8e | ||
|
|
24b7b27836 | ||
|
|
9da8cd890e | ||
|
|
eaab8e47ce | ||
|
|
b440872e60 | ||
|
|
247eb62e3b | ||
|
|
960c51f95d | ||
|
|
8e489304c1 | ||
|
|
2df40f4b88 | ||
|
|
c2d4bf113d | ||
|
|
806588edc6 | ||
|
|
ad6c731823 | ||
|
|
17749dbf96 | ||
|
|
a8c6baa188 | ||
|
|
ef63908539 | ||
|
|
d642fe6783 | ||
|
|
268d6eda8f | ||
|
|
84288cd8bb | ||
|
|
996e119b25 | ||
|
|
f54a8ea432 | ||
|
|
5b21d61688 | ||
|
|
1f04495dc3 | ||
|
|
8373814243 | ||
|
|
d7c0aa4887 | ||
|
|
e6c2fa52f5 | ||
|
|
17b667d6e0 | ||
|
|
81750ea6b1 | ||
|
|
12b8624cdb | ||
|
|
a546e09b96 | ||
|
|
1e8bbb0ae4 | ||
|
|
6c7d6817bd | ||
|
|
8e72eb8652 | ||
|
|
308e37a48e | ||
|
|
82f6fb9e6d | ||
|
|
1d21f76ad3 | ||
|
|
59574da74c | ||
|
|
ccf47de448 | ||
|
|
84b418b5c6 | ||
|
|
7b8feaa48f | ||
|
|
612280c676 | ||
|
|
35579ab714 | ||
|
|
83e251621a | ||
|
|
6e7b130a45 | ||
|
|
69aa277848 | ||
|
|
a9675576d3 | ||
|
|
38e43e018c | ||
|
|
7cc43d36ef | ||
|
|
9cb86df61c | ||
|
|
00fbb77c19 | ||
|
|
2d2ebe0e12 | ||
|
|
92da3629d7 | ||
|
|
7822f5ce5d | ||
|
|
f77480ec28 | ||
|
|
2d6ce527e2 | ||
|
|
9baa296a49 | ||
|
|
f36c02b0b8 | ||
|
|
5bc00d8535 | ||
|
|
9f0fefd42d | ||
|
|
068960e4b2 | ||
|
|
6276bbce38 | ||
|
|
5e4e9100e4 | ||
|
|
c836f97ec3 | ||
|
|
e8ed9c7e49 | ||
|
|
bcf379cc8e | ||
|
|
7e6115a763 | ||
|
|
a5e463464a | ||
|
|
126e065d77 | ||
|
|
1902d597ef | ||
|
|
03761642ed | ||
|
|
44c6972f31 | ||
|
|
55d56d65bc | ||
|
|
7f02b63ccc | ||
|
|
25f5776d8e | ||
|
|
952b99742e | ||
|
|
a109062b1f | ||
|
|
aa508acde4 | ||
|
|
296ec9799f | ||
|
|
34392b464c | ||
|
|
7431990f70 | ||
|
|
e7c57ada95 | ||
|
|
7003920163 | ||
|
|
332d6e9d5c | ||
|
|
95fd0e177f | ||
|
|
cf083e4f42 | ||
|
|
2f3c25cb95 | ||
|
|
df977d50b6 | ||
|
|
ff07f3a385 | ||
|
|
0303604c37 | ||
|
|
27f1fb6fc6 | ||
|
|
cd2dfc7f10 | ||
|
|
09517659b1 | ||
|
|
c27b1e4e3b | ||
|
|
58416b9883 | ||
|
|
0432c863c7 | ||
|
|
2336bbf5ef | ||
|
|
160294e05d | ||
|
|
a11ab03b99 | ||
|
|
9dbf9541e9 | ||
|
|
27908edea1 | ||
|
|
d15992bfc2 | ||
|
|
f1fdfb7971 | ||
|
|
726e5613b3 | ||
|
|
48ff0b90d3 | ||
|
|
98b823c5fc | ||
|
|
557372203f | ||
|
|
6fbe160159 | ||
|
|
d7e275a309 | ||
|
|
0704453aff | ||
|
|
3e9683d88d | ||
|
|
4722d341af | ||
|
|
b53d74285b | ||
|
|
6c1d0f1bbe | ||
|
|
cf5006617c | ||
|
|
adb5b78cb6 | ||
|
|
6779ab5e29 | ||
|
|
a513754d25 | ||
|
|
9703be932d | ||
|
|
0493f3f5f8 | ||
|
|
a664dbb507 | ||
|
|
f3a3d34f71 | ||
|
|
b584a9aeb5 | ||
|
|
c621f8606b | ||
|
|
f7e20377ec | ||
|
|
a924908f12 | ||
|
|
2035bec7ad | ||
|
|
42100e0ab1 | ||
|
|
00583e9b39 | ||
|
|
efa82dccf9 | ||
|
|
057633c2c4 | ||
|
|
d0eb6322c3 | ||
|
|
3f36e0967f | ||
|
|
a44e71aad1 | ||
|
|
57c5632de2 | ||
|
|
8c6883db34 | ||
|
|
ca5eaddfa0 | ||
|
|
0c23d9a7ff | ||
|
|
72ea0ecfd8 | ||
|
|
d67f33bcd6 | ||
|
|
e2fe897811 | ||
|
|
417dbf36c8 | ||
|
|
fd394151fd | ||
|
|
f38d8bf824 | ||
|
|
8b9c393820 | ||
|
|
8aecb3270c | ||
|
|
0dce343d4f | ||
|
|
1a9367228d | ||
|
|
554887ae14 | ||
|
|
3c0ef430db | ||
|
|
a74af66d5f | ||
|
|
619e070d80 | ||
|
|
3a4b504a5d | ||
|
|
17a2466894 | ||
|
|
a2171124e1 | ||
|
|
49b210973e | ||
|
|
aedbf45c8c | ||
|
|
c43de104ce | ||
|
|
ff1f44773a | ||
|
|
8444d066f5 | ||
|
|
46fc1c2a1b | ||
|
|
289e571fb0 | ||
|
|
473cbba26e | ||
|
|
a29e7027ca | ||
|
|
00116b7c74 | ||
|
|
a848321842 | ||
|
|
42df157a04 | ||
|
|
af1f2bdda8 | ||
|
|
7a8d15fe47 | ||
|
|
f3b97d6bef | ||
|
|
f10c90bdba | ||
|
|
78f44dcc8a | ||
|
|
e48ab95735 | ||
|
|
c62e76ab67 | ||
|
|
80df1f5ae8 | ||
|
|
dc0393acff | ||
|
|
73f5e11039 | ||
|
|
ac1d7572e4 | ||
|
|
ec6f2e575b | ||
|
|
8b171d3ca6 | ||
|
|
136c8af878 | ||
|
|
8d0ef13505 | ||
|
|
cf4556f115 | ||
|
|
5ba8b13ccf | ||
|
|
c51d717657 | ||
|
|
d7497f9686 | ||
|
|
f35d0106b8 | ||
|
|
2b451e7893 | ||
|
|
7e27ba1d42 | ||
|
|
6ac3f30c8f | ||
|
|
1a6daa297e | ||
|
|
0f216659f9 | ||
|
|
3f2d79b7fe | ||
|
|
d87482e415 | ||
|
|
9f2e2cd1e8 | ||
|
|
cf7d30d41c | ||
|
|
e5428a0738 | ||
|
|
ebc98ec1bb | ||
|
|
1771df0109 | ||
|
|
6586c7f007 | ||
|
|
665fdbdc2b | ||
|
|
57f4d8cefb | ||
|
|
31e1fbaf40 | ||
|
|
434349cb55 | ||
|
|
4b17721a33 | ||
|
|
2fb33ba940 | ||
|
|
d81af7594c | ||
|
|
e08a88b76c | ||
|
|
ef0e95847f | ||
|
|
9bcf624382 | ||
|
|
5bd3fb494c | ||
|
|
ab793a58b6 | ||
|
|
9b492f49c7 | ||
|
|
d820b54443 | ||
|
|
640c59d9af | ||
|
|
d743ada8fd | ||
|
|
d1b6a17773 | ||
|
|
1089934486 | ||
|
|
0d5168ca0b | ||
|
|
39ead1bb49 | ||
|
|
29a644d48c | ||
|
|
3264d9a6ea | ||
|
|
21b740ccf9 | ||
|
|
6c2302f6d3 | ||
|
|
a1fbe2428f | ||
|
|
7b202c4112 | ||
|
|
44e17c440d | ||
|
|
d8330d56a0 | ||
|
|
c989de3175 | ||
|
|
39b9ba87fc | ||
|
|
b6fa480c97 | ||
|
|
ecb2a42900 | ||
|
|
dad92e723c | ||
|
|
ae74ff1db7 | ||
|
|
0a51e4ac32 | ||
|
|
80f6fb5802 | ||
|
|
9cda669b3b | ||
|
|
8b64e9b3ea | ||
|
|
950ce4c88e | ||
|
|
f67a52d9ef | ||
|
|
6f525bfd2e | ||
|
|
552d77f041 | ||
|
|
474fd8d47e | ||
|
|
5e6b4e55c5 | ||
|
|
10c6d86d13 | ||
|
|
49a5c832ea | ||
|
|
415ac07a60 | ||
|
|
aff41cfcc0 | ||
|
|
aca849ffb1 | ||
|
|
a9cbea1563 | ||
|
|
2b523fff7c | ||
|
|
e53d8226db | ||
|
|
9562756eeb | ||
|
|
a05c932973 | ||
|
|
398a292053 | ||
|
|
551a2edf4b | ||
|
|
9bf2242626 | ||
|
|
be3e985344 | ||
|
|
58abb9b165 | ||
|
|
98da9f1800 | ||
|
|
44764ec1d1 | ||
|
|
f4582d2f46 | ||
|
|
e674255ebe | ||
|
|
7b78c215ae | ||
|
|
52c6739b95 | ||
|
|
6290fb3227 | ||
|
|
ebcccd2cf7 | ||
|
|
73b6adba49 | ||
|
|
d8631c35eb | ||
|
|
4c2b17a42e | ||
|
|
483376deb2 | ||
|
|
d091f3f835 | ||
|
|
299a62804c | ||
|
|
98338565d0 | ||
|
|
682e65fead | ||
|
|
b7cbd20b6f | ||
|
|
0b70124cdd | ||
|
|
906a132e89 | ||
|
|
b9c3981261 | ||
|
|
9132d91f66 | ||
|
|
f2c1fd207e | ||
|
|
d32d6e6851 | ||
|
|
f0e396678c | ||
|
|
7787bc2c07 | ||
|
|
aec4e468e3 | ||
|
|
7d168cb6e2 | ||
|
|
d2cc04d770 |
@@ -17,6 +17,7 @@ before_install:
|
||||
before_script:
|
||||
- "rm src/ol/renderer/webgl/*shader.js"
|
||||
- "sh -e /etc/init.d/xvfb start"
|
||||
- "npm ls"
|
||||
|
||||
script: "make ci"
|
||||
|
||||
|
||||
@@ -101,20 +101,6 @@ style of the existing OpenLayers 3 code, which includes:
|
||||
|
||||
* Do not use assignments inside expressions.
|
||||
|
||||
* Avoid the use of `goog.array.clone` with arrays (use slice instead).
|
||||
|
||||
* Use `array.length = 0` instead of `goog.array.clear`.
|
||||
|
||||
* Use `v !== undefined` instead of `goog.isDef(v)` and `v === null` instead of
|
||||
`goog.isNull(v)`.
|
||||
|
||||
* Use ECMAScript 5.1 functions instead of the `goog` equivalents. For example,
|
||||
use `Object.keys(obj)` instead of `goog.object.getKeys(obj)`, `arr.forEach(f)`
|
||||
instead of `goog.array.forEach(arr, f)`, etc ...
|
||||
|
||||
* Use bracket notation instead of `goog.object.set` and `goog.object.get` (with
|
||||
two arguments).
|
||||
|
||||
* Use uppercase for `@const` variables.
|
||||
|
||||
### Configure your editor
|
||||
|
||||
2
Makefile
2
Makefile
@@ -181,7 +181,7 @@ build/timestamps/check-%-timestamp: $(BUILD_HOSTED)/examples/%.html \
|
||||
$(BUILD_HOSTED)/build/ol.js \
|
||||
$(BUILD_HOSTED)/css/ol.css
|
||||
@mkdir -p $(@D)
|
||||
./node_modules/.bin/phantomjs --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $(addsuffix ?mode=advanced, $<)
|
||||
./node_modules/.bin/phantomjs --local-to-remote-url-access=true --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $<
|
||||
@touch $@
|
||||
|
||||
build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[](http://travis-ci.org/#!/openlayers/ol3)
|
||||
[](https://coveralls.io/r/openlayers/ol3?branch=master)
|
||||
[](http://osgeo.org/)
|
||||
|
||||
[OpenLayers 3](http://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web.
|
||||
|
||||
|
||||
@@ -2,6 +2,48 @@
|
||||
|
||||
### v3.14.0
|
||||
|
||||
#### Internet Explorer 9 support
|
||||
|
||||
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
|
||||
|
||||
#### Layer pre-/postcompose event changes
|
||||
|
||||
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
|
||||
|
||||
Old code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// rely on canvas dimensions to move coordinate origin to center
|
||||
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// rely on the canvas having a null transform
|
||||
e.context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
});
|
||||
```
|
||||
New code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// use map size and pixel ratio to move coordinate origin to center
|
||||
var size = map.getSize();
|
||||
var pixelRatio = e.frameState.pixelRatio;
|
||||
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// undo all transforms
|
||||
e.context.scale(1 / 3, 1 / 3);
|
||||
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
||||
});
|
||||
```
|
||||
|
||||
### v3.13.0
|
||||
|
||||
#### `proj4js` integration
|
||||
|
||||
154
changelog/v3.14.0.md
Normal file
154
changelog/v3.14.0.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# v3.14.0
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.14.0 release includes features and fixes from 93 pull requests since the v3.13.1 release. New features and improvements include:
|
||||
|
||||
* New `source` option for the `ol.control.FullScreen`, to allow including other elements besides the map in a full screen view (#4679).
|
||||
* New `target` property for the Drag&Drop interaction allows using a different drop target than the map viewport (#4876).
|
||||
* `ol.style.RegularShape` has a new `rotateWithView` option, for controlling how regular shape symbols are rendered on rotated views (#4698).
|
||||
* New `layers` option for `ol.format.WMSGetFeatureInfo` format, to selectively only read features from specific layers (#4700).
|
||||
* New `precision` parameter for formatting coordinates with `ol.coordinate.toStringHDMS` (#4787).
|
||||
* Smarter tile queue for improved tile loading user experience when more than one tile layer is used (#4794).
|
||||
* Improved rendering performance for tile layers by rendering tiles directly to the map canvas (#4597).
|
||||
* The `goog.events` event system was replaced with our own lightweight event system. This significally reduces the build size (#4711). Replacement of other `goog.*` components with ES5 features or custom code marks a huge step towards the complete removal of the Closure Library dependency.
|
||||
|
||||
## Upgrade notes
|
||||
|
||||
#### Internet Explorer 9 support
|
||||
|
||||
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
|
||||
|
||||
#### Layer pre-/postcompose event changes
|
||||
|
||||
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
|
||||
|
||||
Old code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// rely on canvas dimensions to move coordinate origin to center
|
||||
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// rely on the canvas having a null transform
|
||||
e.context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
});
|
||||
```
|
||||
New code:
|
||||
```js
|
||||
layer.on('precompose', function(e) {
|
||||
// use map size and pixel ratio to move coordinate origin to center
|
||||
var size = map.getSize();
|
||||
var pixelRatio = e.frameState.pixelRatio;
|
||||
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
||||
e.context.scale(3, 3);
|
||||
// draw an x in the center of the viewport
|
||||
e.context.moveTo(-20, -20);
|
||||
e.context.lineTo(20, 20);
|
||||
e.context.moveTo(-20, 20);
|
||||
e.context.lineTo(20, -20);
|
||||
// undo all transforms
|
||||
e.context.scale(1 / 3, 1 / 3);
|
||||
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
||||
});
|
||||
```
|
||||
|
||||
## Full list of changes
|
||||
|
||||
* [#4896](https://github.com/openlayers/ol3/pull/4896) - Ignore XML sequence when comparing GML ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4890](https://github.com/openlayers/ol3/pull/4890) - ol.format.KML cleanup ([@fredj](https://github.com/fredj))
|
||||
* [#4894](https://github.com/openlayers/ol3/pull/4894) - Only run raster operations after image sources have loaded. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4892](https://github.com/openlayers/ol3/pull/4892) - Stricter check for ImageData constructor ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4891](https://github.com/openlayers/ol3/pull/4891) - Fix tests so they all pass in IE9 ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4889](https://github.com/openlayers/ol3/pull/4889) - Use requestAnimation polyfill for examples and update release notes ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4887](https://github.com/openlayers/ol3/pull/4887) - Use less aggressive DOM function overrides ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4885](https://github.com/openlayers/ol3/pull/4885) - Mark overlayContainer and overlayContainerStopEvent as non-nullable ([@fredj](https://github.com/fredj))
|
||||
* [#4884](https://github.com/openlayers/ol3/pull/4884) - Remove use of goog.math.isFiniteNumber() ([@fredj](https://github.com/fredj))
|
||||
* [#4881](https://github.com/openlayers/ol3/pull/4881) - Update jquery to version 2.2.1 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4780](https://github.com/openlayers/ol3/pull/4780) - Adapt the code for the new closure-compiler version ([@fredj](https://github.com/fredj))
|
||||
* [#3453](https://github.com/openlayers/ol3/pull/3453) - Consider multi in add/remove/toggle select logic ([@bjornharrtell](https://github.com/bjornharrtell))
|
||||
* [#4876](https://github.com/openlayers/ol3/pull/4876) - Add `target` property to Drag&Drop interaction ([@tsauerwein](https://github.com/tsauerwein))
|
||||
* [#4854](https://github.com/openlayers/ol3/pull/4854) - Always report skipped feature hits for the original layer ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4877](https://github.com/openlayers/ol3/pull/4877) - Update eslint to version 2.2.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4870](https://github.com/openlayers/ol3/pull/4870) - Reuse dragListenerKeys_ local variable ([@fredj](https://github.com/fredj))
|
||||
* [#4721](https://github.com/openlayers/ol3/pull/4721) - Fix reprojection of raster sources with gutter ([@klokantech](https://github.com/klokantech))
|
||||
* [#4874](https://github.com/openlayers/ol3/pull/4874) - Assert we have a feature id ([@bartvde](https://github.com/bartvde))
|
||||
* [#4869](https://github.com/openlayers/ol3/pull/4869) - Improve precision of ol.reproj.render ([@klokantech](https://github.com/klokantech))
|
||||
* [#4866](https://github.com/openlayers/ol3/pull/4866) - Use requestAnimationFrame polyfill (for IE9) ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4863](https://github.com/openlayers/ol3/pull/4863) - Remove use of goog.dom.createElement ([@fredj](https://github.com/fredj))
|
||||
* [#4864](https://github.com/openlayers/ol3/pull/4864) - Use querySelectorAll instead of goog.dom.getElementsByClass ([@fredj](https://github.com/fredj))
|
||||
* [#4597](https://github.com/openlayers/ol3/pull/4597) - Render tiles directly to the map canvas ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4862](https://github.com/openlayers/ol3/pull/4862) - Add OSGeo badge ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4845](https://github.com/openlayers/ol3/pull/4845) - Fix geolocation error cast ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4851](https://github.com/openlayers/ol3/pull/4851) - Don't use goog.isBoolean() ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4852](https://github.com/openlayers/ol3/pull/4852) - Don't use goog.isString() ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4849](https://github.com/openlayers/ol3/pull/4849) - Fix docs of LogoOptions.prototype.src ([@openlayers](https://github.com/openlayers))
|
||||
* [#4794](https://github.com/openlayers/ol3/pull/4794) - Make tile loading count no longer depend on source count ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4843](https://github.com/openlayers/ol3/pull/4843) - Remove use of goog.dom.getParentElement ([@fredj](https://github.com/fredj))
|
||||
* [#4839](https://github.com/openlayers/ol3/pull/4839) - Add template type to ol.Collection ([@fredj](https://github.com/fredj))
|
||||
* [#4847](https://github.com/openlayers/ol3/pull/4847) - Update eslint to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4632](https://github.com/openlayers/ol3/pull/4632) - Overloading fill color (polygon or text) with CanvasPattern and CanvasGradient ([@bjnsn](https://github.com/bjnsn))
|
||||
* [#4842](https://github.com/openlayers/ol3/pull/4842) - Remove use of goog.dom.createDom ([@fredj](https://github.com/fredj))
|
||||
* [#4808](https://github.com/openlayers/ol3/pull/4808) - Type cleanup ([@fredj](https://github.com/fredj))
|
||||
* [#4737](https://github.com/openlayers/ol3/pull/4737) - Use olx.format.ReadOptions in ol.interaction.DragAndDrop ([@fredj](https://github.com/fredj))
|
||||
* [#4830](https://github.com/openlayers/ol3/pull/4830) - Make sure window.proj4 is always restored in tests ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4838](https://github.com/openlayers/ol3/pull/4838) - Use regular expression instead of String#endsWith() check ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4837](https://github.com/openlayers/ol3/pull/4837) - Update metalsmith-layouts to version 1.5.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4836](https://github.com/openlayers/ol3/pull/4836) - Use lowercase for all user agent checks ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4833](https://github.com/openlayers/ol3/pull/4833) - Upgrade linter and config. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4831](https://github.com/openlayers/ol3/pull/4831) - Add navigation header to examples page ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4824](https://github.com/openlayers/ol3/pull/4824) - Don't use goog.string.newlines.* ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4825](https://github.com/openlayers/ol3/pull/4825) - Don't use goog.string.isEmpty ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4823](https://github.com/openlayers/ol3/pull/4823) - Fix type for layers option on ol.interaction.Select ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4815](https://github.com/openlayers/ol3/pull/4815) - wrapX false in synthetic examples ([@fredj](https://github.com/fredj))
|
||||
* [#4810](https://github.com/openlayers/ol3/pull/4810) - Add checks for undefined in controls ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4787](https://github.com/openlayers/ol3/pull/4787) - Add precision parameter for HDMS coordinate ([@pfanguin](https://github.com/pfanguin))
|
||||
* [#4811](https://github.com/openlayers/ol3/pull/4811) - Make ol.style.Style a @struct ([@fredj](https://github.com/fredj))
|
||||
* [#4800](https://github.com/openlayers/ol3/pull/4800) - Update phantomjs-prebuilt to version 2.1.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4792](https://github.com/openlayers/ol3/pull/4792) - Use ol.events.listen instead of ol.Observable#on ([@fredj](https://github.com/fredj))
|
||||
* [#4796](https://github.com/openlayers/ol3/pull/4796) - Remove use of goog.isString() ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4795](https://github.com/openlayers/ol3/pull/4795) - Cleanup after goog.array, goog.object and goog.isDef removal ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4791](https://github.com/openlayers/ol3/pull/4791) - Remove unnecessary cast ([@fredj](https://github.com/fredj))
|
||||
* [#4778](https://github.com/openlayers/ol3/pull/4778) - Remove use of goog.object. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4789](https://github.com/openlayers/ol3/pull/4789) - Use ol.array instead of goog.array ([@fredj](https://github.com/fredj))
|
||||
* [#4788](https://github.com/openlayers/ol3/pull/4788) - Remove unnecessary newlines ([@fredj](https://github.com/fredj))
|
||||
* [#4731](https://github.com/openlayers/ol3/pull/4731) - Remove all remaining unnecessary casts ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4776](https://github.com/openlayers/ol3/pull/4776) - Correct assertion message in ol.array.binarySearch-test ([@marcjansen](https://github.com/marcjansen))
|
||||
* [#4711](https://github.com/openlayers/ol3/pull/4711) - Removal of goog.events.* ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4777](https://github.com/openlayers/ol3/pull/4777) - Fix source.UrlTile URL expansion ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4730](https://github.com/openlayers/ol3/pull/4730) - Document ol.Geolocation error event ([@fredj](https://github.com/fredj))
|
||||
* [#4772](https://github.com/openlayers/ol3/pull/4772) - Use node.setAttribute to set namespaceURI of a node ([@adube](https://github.com/adube))
|
||||
* [#4774](https://github.com/openlayers/ol3/pull/4774) - Update graceful-fs to version 4.1.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4680](https://github.com/openlayers/ol3/pull/4680) - Remove goog array. ([@nicholas-l](https://github.com/nicholas-l))
|
||||
* [#4771](https://github.com/openlayers/ol3/pull/4771) - Use innerHTML instead of innerText to populate the status element ([@fredj](https://github.com/fredj))
|
||||
* [#4769](https://github.com/openlayers/ol3/pull/4769) - Add opaque option to olx.source.OSMOptions ([@fredj](https://github.com/fredj))
|
||||
* [#4736](https://github.com/openlayers/ol3/pull/4736) - Properly detect feature on unmanaged layer for toggle selection ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4756](https://github.com/openlayers/ol3/pull/4756) - Remove VectorTile getSource re-definition of return value ([@adube](https://github.com/adube))
|
||||
* [#4733](https://github.com/openlayers/ol3/pull/4733) - Avoid rendering too big and too small images for vector tiles ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4754](https://github.com/openlayers/ol3/pull/4754) - Upgrade to mocha@2.4.5. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4750](https://github.com/openlayers/ol3/pull/4750) - Update metalsmith-layouts to version 1.4.4 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4751](https://github.com/openlayers/ol3/pull/4751) - Update phantomjs to version 2.1.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4741](https://github.com/openlayers/ol3/pull/4741) - Report on installed versions in Travis. ([@openlayers](https://github.com/openlayers))
|
||||
* [#4742](https://github.com/openlayers/ol3/pull/4742) - Upgrade to eslint@2.0.0-beta.2. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4746](https://github.com/openlayers/ol3/pull/4746) - Downgrade to mocha@2.3.4. ([@tschaub](https://github.com/tschaub))
|
||||
* [#4740](https://github.com/openlayers/ol3/pull/4740) - Update fs-extra to version 0.26.5 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4738](https://github.com/openlayers/ol3/pull/4738) - Add unit tests for ol.control.Rotate and ol.control.Zoom ([@fredj](https://github.com/fredj))
|
||||
* [#4718](https://github.com/openlayers/ol3/pull/4718) - Improve raster reprojection behavior when tiles fail to load ([@klokantech](https://github.com/klokantech))
|
||||
* [#4734](https://github.com/openlayers/ol3/pull/4734) - Update sinon to version 1.17.3 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4726](https://github.com/openlayers/ol3/pull/4726) - Update mocha to version 2.4.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4725](https://github.com/openlayers/ol3/pull/4725) - Untangle vector tile feature reprojection ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4735](https://github.com/openlayers/ol3/pull/4735) - Add default value for defaultDataProjection ([@fredj](https://github.com/fredj))
|
||||
* [#4732](https://github.com/openlayers/ol3/pull/4732) - Fix '@see' link in src/ol/deviceorientation.js ([@fredj](https://github.com/fredj))
|
||||
* [#4720](https://github.com/openlayers/ol3/pull/4720) - Improve tileLoadFunction docs ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4717](https://github.com/openlayers/ol3/pull/4717) - Update phantomjs to version 2.1.2 🚀 ([@openlayers](https://github.com/openlayers))
|
||||
* [#4679](https://github.com/openlayers/ol3/pull/4679) - Add a source option for the full screen control ([@gaf-ag](https://github.com/gaf-ag))
|
||||
* [#4712](https://github.com/openlayers/ol3/pull/4712) - Add missing JSDoc tags ([@fredj](https://github.com/fredj))
|
||||
* [#4700](https://github.com/openlayers/ol3/pull/4700) - Add 'layers' option for WMSGetFeatureInfo format ([@adube](https://github.com/adube))
|
||||
* [#4705](https://github.com/openlayers/ol3/pull/4705) - Remove remaining unnecessary ol.source.State casts ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4703](https://github.com/openlayers/ol3/pull/4703) - Source options fixes. ([@gberaudo](https://github.com/gberaudo))
|
||||
* [#4698](https://github.com/openlayers/ol3/pull/4698) - Add rotateWithView option to ol.style.RegularShape ([@fredj](https://github.com/fredj))
|
||||
* [#4697](https://github.com/openlayers/ol3/pull/4697) - Bind tileUrlFunction to the source ([@gberaudo](https://github.com/gberaudo))
|
||||
10
changelog/v3.14.1.md
Normal file
10
changelog/v3.14.1.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# v3.14.1
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.14.1 release is a patch release that addresses a few regressions in the v3.14.0 release. See the [v3.14.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.14.0) for details on upgrading from v3.13.x.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4939](https://github.com/openlayers/ol3/pull/4939) - Fix rendering of opaque layers with opacity != 1 ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4921](https://github.com/openlayers/ol3/pull/4921) - Unlisten before calling listener and bind to target by default ([@ahocevar](https://github.com/ahocevar))
|
||||
13
changelog/v3.14.2.md
Normal file
13
changelog/v3.14.2.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# v3.14.2
|
||||
|
||||
## Summary
|
||||
|
||||
The v3.14.2 release is a patch release that addresses a few regressions in the v3.14.1 release. See the [v3.14.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.14.0) for details on upgrading from v3.13.x.
|
||||
|
||||
## Fixes
|
||||
|
||||
* [#4963](https://github.com/openlayers/ol3/pull/4963) - Handle more XHR errors in the TileJSON source ([@tschaub](https://github.com/tschaub))
|
||||
* [#4960](https://github.com/openlayers/ol3/pull/4960) - Simplify clipping of lower resolution regions ([@ahocevar](https://github.com/ahocevar))
|
||||
* [#4958](https://github.com/openlayers/ol3/pull/4958) - Stop wheel events instead of DOMMouseScroll events ([@fredj](https://github.com/fredj))
|
||||
* [#4956](https://github.com/openlayers/ol3/pull/4956) - Fix Examples layout page ([@jonataswalker](https://github.com/jonataswalker))
|
||||
* [#4809](https://github.com/openlayers/ol3/pull/4809) - Fix multipolygon clone. ([@fperucic](https://github.com/fperucic))
|
||||
@@ -24,7 +24,6 @@
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
|
||||
@@ -11,15 +11,23 @@
|
||||
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
|
||||
{{{ extraHead.local }}}
|
||||
{{{ css.tag }}}
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,Function.prototype.bind|gated"></script>
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame"></script>
|
||||
<script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="navbar" role="navigation">
|
||||
<div class="container" id="navbar-inner-container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<div class="container">
|
||||
<div class="display-table pull-left" id="navbar-logo-container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
</div>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="../doc">Docs</a></li>
|
||||
<li><a class="active" href="index.html">Examples</a></li>
|
||||
<li><a href="../apidoc">API</a></li>
|
||||
<li><a href="https://github.com/openlayers/ol3">Code</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
@@ -24,9 +23,14 @@
|
||||
],
|
||||
"jscomp_off": [
|
||||
"useOfGoogBase",
|
||||
"unnecessaryCasts",
|
||||
"lintChecks"
|
||||
],
|
||||
"hide_warnings_for": [
|
||||
"node_modules/closure-util"
|
||||
],
|
||||
"jscomp_warning": [
|
||||
"unnecessaryCasts"
|
||||
],
|
||||
"extra_annotation_name": [
|
||||
"api", "observable"
|
||||
],
|
||||
|
||||
@@ -167,7 +167,6 @@ The minimum config file looks like this:
|
||||
"node_modules/openlayers/externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false",
|
||||
@@ -223,7 +222,6 @@ Here is a version of `config.json` with more compilation checks enabled:
|
||||
"node_modules/openlayers/externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false",
|
||||
|
||||
@@ -60,7 +60,6 @@ Creating a custom build requires writing a build configuration file. The format
|
||||
"externs/topojson.js"
|
||||
],
|
||||
"define": [
|
||||
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
|
||||
"goog.dom.ASSUME_STANDARDS_MODE=true",
|
||||
"goog.json.USE_NATIVE_JSON=true",
|
||||
"goog.DEBUG=false"
|
||||
|
||||
283
examples/data/wmsgetfeatureinfo/osm-restaurant-hotel.xml
Normal file
283
examples/data/wmsgetfeatureinfo/osm-restaurant-hotel.xml
Normal file
@@ -0,0 +1,283 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<msGMLOutput
|
||||
xmlns:gml="http://www.opengis.net/gml"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<restaurant_layer>
|
||||
<gml:name>Restaurants</gml:name>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537750.006175,150923.784252 537750.006175,150923.784252</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537750.006175,150923.784252</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Château d'Ouchy</display_name>
|
||||
<name>Château d'Ouchy</name>
|
||||
<osm_id>1230808910</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537770.247124,150975.613968 537770.247124,150975.613968</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537770.247124,150975.613968</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Cafe du Vieil Ouchy</display_name>
|
||||
<name>Cafe du Vieil Ouchy</name>
|
||||
<osm_id>1433812389</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator>Carine Duca</operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537789.197617,150976.218227 537789.197617,150976.218227</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537789.197617,150976.218227</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Creperie</display_name>
|
||||
<name>Creperie</name>
|
||||
<osm_id>1433812391</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
<restaurant_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537810.679909,150983.377694 537810.679909,150983.377694</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537810.679909,150983.377694</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>1433812390</display_name>
|
||||
<name></name>
|
||||
<osm_id>1433812390</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity>restaurant</amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism></tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</restaurant_feature>
|
||||
</restaurant_layer>
|
||||
<hotel_layer>
|
||||
<gml:name>Hôtels</gml:name>
|
||||
<hotel_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537762.425297,150971.904013 537762.425297,150971.904013</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537762.425297,150971.904013</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Hotel du port</display_name>
|
||||
<name>Hotel du port</name>
|
||||
<osm_id>2886793101</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity></amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism>hotel</tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</hotel_feature>
|
||||
<hotel_feature>
|
||||
<gml:boundedBy>
|
||||
<gml:Box srsName="EPSG:21781">
|
||||
<gml:coordinates>537798.352160,150985.584164 537798.352160,150985.584164</gml:coordinates>
|
||||
</gml:Box>
|
||||
</gml:boundedBy>
|
||||
<THE_GEOM>
|
||||
<gml:Point srsName="EPSG:21781">
|
||||
<gml:coordinates>537798.352160,150985.584164</gml:coordinates>
|
||||
</gml:Point>
|
||||
</THE_GEOM>
|
||||
<display_name>Angleterre</display_name>
|
||||
<name>Angleterre</name>
|
||||
<osm_id>1433812387</osm_id>
|
||||
<access></access>
|
||||
<aerialway></aerialway>
|
||||
<amenity></amenity>
|
||||
<barrier></barrier>
|
||||
<bicycle></bicycle>
|
||||
<brand></brand>
|
||||
<building></building>
|
||||
<covered></covered>
|
||||
<denomination></denomination>
|
||||
<ele></ele>
|
||||
<foot></foot>
|
||||
<highway></highway>
|
||||
<layer></layer>
|
||||
<leisure></leisure>
|
||||
<man_made></man_made>
|
||||
<motorcar></motorcar>
|
||||
<natural></natural>
|
||||
<operator></operator>
|
||||
<population></population>
|
||||
<power></power>
|
||||
<place></place>
|
||||
<railway></railway>
|
||||
<ref></ref>
|
||||
<religion></religion>
|
||||
<shop></shop>
|
||||
<sport></sport>
|
||||
<surface></surface>
|
||||
<tourism>hotel</tourism>
|
||||
<waterway></waterway>
|
||||
<wood></wood>
|
||||
</hotel_feature>
|
||||
</hotel_layer>
|
||||
</msGMLOutput>
|
||||
44
examples/full-screen-source.css
Normal file
44
examples/full-screen-source.css
Normal file
@@ -0,0 +1,44 @@
|
||||
.fullscreen:-moz-full-screen {
|
||||
height: 100%;
|
||||
}
|
||||
.fullscreen:-webkit-full-screen {
|
||||
height: 100%;
|
||||
}
|
||||
.fullscreen:-ms-fullscreen {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fullscreen:fullscreen {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fullscreen {
|
||||
margin-bottom: 10px;
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.ol-rotate {
|
||||
top: 3em;
|
||||
}
|
||||
|
||||
.map {
|
||||
width: 80%;
|
||||
height: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.sidepanel {
|
||||
background: #1F6B75;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.sidepanel-title {
|
||||
width: 100%;
|
||||
font-size: 3em;
|
||||
color: #ffffff;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
16
examples/full-screen-source.html
Normal file
16
examples/full-screen-source.html
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: Full Screen Control with extended source element
|
||||
shortdesc: Example of a full screen control with a source option definition.
|
||||
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>
|
||||
tags: "full-screen, source, fullScreenSource, osm, osm-maps"
|
||||
---
|
||||
<div id="fullscreen" class="fullscreen">
|
||||
<div id="map" class="map"></div>
|
||||
<div class="sidepanel">
|
||||
<span class="sidepanel-title">Side Panel</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
28
examples/full-screen-source.js
Normal file
28
examples/full-screen-source.js
Normal file
@@ -0,0 +1,28 @@
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.control');
|
||||
goog.require('ol.control.FullScreen');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.source.OSM');
|
||||
|
||||
|
||||
var view = new ol.View({
|
||||
center: [-9101767, 2822912],
|
||||
zoom: 14
|
||||
});
|
||||
|
||||
var map = new ol.Map({
|
||||
controls: ol.control.defaults().extend([
|
||||
new ol.control.FullScreen({
|
||||
source: 'fullscreen'
|
||||
})
|
||||
]),
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
renderer: common.getRendererFromQueryString(),
|
||||
target: 'map',
|
||||
view: view
|
||||
});
|
||||
@@ -13,7 +13,6 @@ tags: "fullscreen, geolocation, orientation, mobile"
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
||||
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Function.prototype.bind|gated"></script>
|
||||
<title>Mobile Geolocation Tracking with Orientation</title>
|
||||
<style type="text/css">
|
||||
html, body, .map {
|
||||
|
||||
28
examples/getfeatureinfo-layers.html
Normal file
28
examples/getfeatureinfo-layers.html
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
layout: example.html
|
||||
title: WMS GetFeatureInfo (Layers)
|
||||
shortdesc: >
|
||||
Shows how to fetch features per layer name in a single WMS GetFeatureInfo
|
||||
request
|
||||
docs: >
|
||||
Demonstrates the use of the `layers` option in the
|
||||
`ol.format.WMSGetFeatureInfo` format object, which allows features returned
|
||||
by a single WMS GetFeatureInfo request that asks for more than one layer
|
||||
to be read by layer name.
|
||||
resources:
|
||||
- https://code.jquery.com/jquery-1.11.2.min.js
|
||||
---
|
||||
<table id="info">
|
||||
<tr>
|
||||
<td>All features:</td>
|
||||
<td id="all"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hotel features:</td>
|
||||
<td id="hotel"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Restaurant features:</td>
|
||||
<td id="restaurant"></td>
|
||||
</tr>
|
||||
</table>
|
||||
24
examples/getfeatureinfo-layers.js
Normal file
24
examples/getfeatureinfo-layers.js
Normal file
@@ -0,0 +1,24 @@
|
||||
goog.require('ol.format.WMSGetFeatureInfo');
|
||||
|
||||
$.ajax({
|
||||
url: './data/wmsgetfeatureinfo/osm-restaurant-hotel.xml',
|
||||
success: function(response) {
|
||||
|
||||
// this is the standard way to read the features
|
||||
var allFeatures = new ol.format.WMSGetFeatureInfo().readFeatures(response);
|
||||
$('#all').html(allFeatures.length.toString());
|
||||
|
||||
// when specifying the 'layers' options, only the features of those
|
||||
// layers are returned by the format
|
||||
var hotelFeatures = new ol.format.WMSGetFeatureInfo({
|
||||
layers: ['hotel']
|
||||
}).readFeatures(response);
|
||||
$('#hotel').html(hotelFeatures.length.toString());
|
||||
|
||||
var restaurantFeatures = new ol.format.WMSGetFeatureInfo({
|
||||
layers: ['restaurant']
|
||||
}).readFeatures(response);
|
||||
$('#restaurant').html(restaurantFeatures.length.toString());
|
||||
|
||||
}
|
||||
});
|
||||
@@ -11,9 +11,6 @@
|
||||
body {
|
||||
padding-top: 70px;
|
||||
}
|
||||
.navbar-form {
|
||||
margin-top: 12px;
|
||||
}
|
||||
input.search-query {
|
||||
color: #333;
|
||||
}
|
||||
@@ -186,11 +183,19 @@
|
||||
|
||||
<header class="navbar navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<form class="navbar-form navbar-left" role="search">
|
||||
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
||||
<span id="count"></span>
|
||||
</form>
|
||||
<div class="display-table pull-left">
|
||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
|
||||
<form class="navbar-form" role="search">
|
||||
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
||||
<span id="count"></span>
|
||||
</form>
|
||||
</div>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li><a href="../doc">Docs</a></li>
|
||||
<li><a class="active" href="index.html">Examples</a></li>
|
||||
<li><a href="../apidoc">API</a></li>
|
||||
<li><a href="https://github.com/openlayers/ol3">Code</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -25,8 +25,10 @@ var map = new ol.Map({
|
||||
osm.on('precompose', function(event) {
|
||||
var ctx = event.context;
|
||||
ctx.save();
|
||||
ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2);
|
||||
ctx.scale(3, 3);
|
||||
var pixelRatio = event.frameState.pixelRatio;
|
||||
var size = map.getSize();
|
||||
ctx.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
|
||||
ctx.scale(3 * pixelRatio, 3 * pixelRatio);
|
||||
ctx.translate(-75, -80);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(75, 40);
|
||||
@@ -37,7 +39,9 @@ osm.on('precompose', function(event) {
|
||||
ctx.bezierCurveTo(130, 62.5, 130, 25, 100, 25);
|
||||
ctx.bezierCurveTo(85, 25, 75, 37, 75, 40);
|
||||
ctx.clip();
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
ctx.translate(75, 80);
|
||||
ctx.scale(1 / 3 / pixelRatio, 1 / 3 / pixelRatio);
|
||||
ctx.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
|
||||
});
|
||||
|
||||
osm.on('postcompose', function(event) {
|
||||
|
||||
@@ -3,8 +3,7 @@ layout: example.html
|
||||
title: Localized OpenStreetMap
|
||||
shortdesc: Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.
|
||||
docs: >
|
||||
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>. The OpenSeaMap tile server
|
||||
does not support <a href="http://enable-cors.org/">CORS</a> headers.</p>
|
||||
tags: "cors, localized-openstreetmap, openseamap, openstreetmap"
|
||||
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>.
|
||||
tags: "localized-openstreetmap, openseamap, openstreetmap"
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
|
||||
@@ -28,7 +28,7 @@ var openSeaMapLayer = new ol.layer.Tile({
|
||||
}),
|
||||
ol.source.OSM.ATTRIBUTION
|
||||
],
|
||||
crossOrigin: null,
|
||||
opaque: false,
|
||||
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
|
||||
})
|
||||
});
|
||||
|
||||
@@ -13,7 +13,6 @@ cloak:
|
||||
<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>
|
||||
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Function.prototype.bind|gated"></script>
|
||||
<style type="text/css">
|
||||
html, body, .map {
|
||||
margin: 0;
|
||||
|
||||
@@ -53,7 +53,7 @@ var proj54009 = ol.proj.get('ESRI:54009');
|
||||
proj54009.setExtent([-18e6, -9e6, 18e6, 9e6]);
|
||||
|
||||
|
||||
var layers = [];
|
||||
var layers = {};
|
||||
|
||||
layers['bng'] = new ol.layer.Tile({
|
||||
source: new ol.source.XYZ({
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var container = document.getElementById('navbar-inner-container');
|
||||
var container = document.getElementById('navbar-logo-container');
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
select.className = 'input-medium';
|
||||
|
||||
form.className = 'navbar-form pull-right';
|
||||
form.className = 'navbar-form version-form';
|
||||
form.appendChild(select);
|
||||
|
||||
container.appendChild(form);
|
||||
|
||||
@@ -26,6 +26,22 @@ body {
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
.nav>li>a:hover, .nav>li>a:focus, .nav>li>a.active {
|
||||
background-color: #268591;
|
||||
}
|
||||
.navbar-nav>li>a {
|
||||
color: white;
|
||||
}
|
||||
.display-table {
|
||||
display: table;
|
||||
}
|
||||
.version-form, .navbar-form {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.version-form {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#title {
|
||||
margin-top: 0;
|
||||
|
||||
@@ -71,7 +71,7 @@ var changeInteraction = function() {
|
||||
if (select !== null) {
|
||||
map.addInteraction(select);
|
||||
select.on('select', function(e) {
|
||||
document.getElementById('status').innerText = ' ' +
|
||||
document.getElementById('status').innerHTML = ' ' +
|
||||
e.target.getFeatures().getLength() +
|
||||
' selected features (last operation selected ' + e.selected.length +
|
||||
' and deselected ' + e.deselected.length + ' features)';
|
||||
|
||||
@@ -7,60 +7,3 @@ docs: >
|
||||
tags: "vector"
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<p>Performance results:</p>
|
||||
<table border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device/Browser</th>
|
||||
<th>200 lines</th>
|
||||
<th>500 lines</th>
|
||||
<th>1000 lines</th>
|
||||
<th>2000 lines</th>
|
||||
<th>5000 lines</th>
|
||||
<th>10000 lines</th>
|
||||
<th>20000 lines</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Mac Book Air / Chrome 33 canary</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mac Book Air / FireFox 25</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>22 fps</td>
|
||||
<td>6 fps</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mac Book Air / Safari 7</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>60 fps</td>
|
||||
<td>40 fps</td>
|
||||
<td>10 fps</td>
|
||||
<td>N/A</td>
|
||||
<td>N/A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>iPhone 4S / iOS 7 / Safari</td>
|
||||
<td>60 fps</td>
|
||||
<td>33 fps</td>
|
||||
<td>15 fps</td>
|
||||
<td>5 fps</td>
|
||||
<td>N/A</td>
|
||||
<td>N/A</td>
|
||||
<td>N/A</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -38,7 +38,8 @@ for (i = 0; i < count; ++i) {
|
||||
|
||||
var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
features: features
|
||||
features: features,
|
||||
wrapX: false
|
||||
}),
|
||||
style: new ol.style.Style({
|
||||
stroke: new ol.style.Stroke({
|
||||
|
||||
@@ -41,7 +41,8 @@ var styles = {
|
||||
};
|
||||
|
||||
var vectorSource = new ol.source.Vector({
|
||||
features: features
|
||||
features: features,
|
||||
wrapX: false
|
||||
});
|
||||
var vector = new ol.layer.Vector({
|
||||
source: vectorSource,
|
||||
|
||||
@@ -15,3 +15,13 @@
|
||||
* @see http://www.w3.org/TR/pointerevents/#the-touch-action-css-property
|
||||
*/
|
||||
CSSProperties.prototype.touchAction;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
WheelEvent.DOM_DELTA_LINE;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
WheelEvent.DOM_DELTA_PIXEL;
|
||||
|
||||
199
externs/olx.js
199
externs/olx.js
@@ -90,7 +90,7 @@ olx.LogoOptions.prototype.href;
|
||||
|
||||
|
||||
/**
|
||||
* Image src for the logo
|
||||
* Image src for the logo.
|
||||
* @type {string}
|
||||
* @api
|
||||
*/
|
||||
@@ -1054,7 +1054,8 @@ olx.control.DefaultsOptions.prototype.zoomOptions;
|
||||
* labelActive: (string|Node|undefined),
|
||||
* tipLabel: (string|undefined),
|
||||
* keys: (boolean|undefined),
|
||||
* target: (Element|undefined)}}
|
||||
* target: (Element|undefined),
|
||||
* source: (Element|string|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
olx.control.FullScreenOptions;
|
||||
@@ -1110,6 +1111,12 @@ olx.control.FullScreenOptions.prototype.keys;
|
||||
*/
|
||||
olx.control.FullScreenOptions.prototype.target;
|
||||
|
||||
/**
|
||||
* The element to be displayed fullscreen. When not provided, the element containing the map viewport will be displayed fullscreen.
|
||||
* @type {Element|string|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.control.FullScreenOptions.prototype.source;
|
||||
|
||||
/**
|
||||
* @typedef {{className: (string|undefined),
|
||||
@@ -1177,7 +1184,7 @@ olx.control.MousePositionOptions.prototype.undefinedHTML;
|
||||
* collapseLabel: (string|Node|undefined),
|
||||
* collapsible: (boolean|undefined),
|
||||
* label: (string|Node|undefined),
|
||||
* layers: (Array.<ol.layer.Layer>|ol.Collection|undefined),
|
||||
* layers: (Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined),
|
||||
* render: (function(ol.MapEvent)|undefined),
|
||||
* target: (Element|undefined),
|
||||
* tipLabel: (string|undefined),
|
||||
@@ -1225,7 +1232,7 @@ olx.control.OverviewMapOptions.prototype.label;
|
||||
/**
|
||||
* Layers for the overview map. If not set, then all main map layers are used
|
||||
* instead.
|
||||
* @type {!Array.<ol.layer.Layer>|!ol.Collection|undefined}
|
||||
* @type {Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.control.OverviewMapOptions.prototype.layers;
|
||||
@@ -1343,7 +1350,7 @@ olx.control.RotateOptions.prototype.className;
|
||||
/**
|
||||
* Text label to use for the rotate button. Default is `⇧`.
|
||||
* Instead of text, also a Node (e.g. a `span` element) can be used.
|
||||
* @type {string|Node|undefined}
|
||||
* @type {string|Element|undefined}
|
||||
* @api stable
|
||||
*/
|
||||
olx.control.RotateOptions.prototype.label;
|
||||
@@ -1675,7 +1682,7 @@ olx.format.GeoJSONOptions;
|
||||
|
||||
|
||||
/**
|
||||
* Default data projection.
|
||||
* Default data projection. Default is `EPSG:4326`.
|
||||
* @type {ol.proj.ProjectionLike}
|
||||
* @api stable
|
||||
*/
|
||||
@@ -1790,7 +1797,7 @@ olx.format.TopoJSONOptions;
|
||||
|
||||
|
||||
/**
|
||||
* Default data projection.
|
||||
* Default data projection. Default is `EPSG:4326`.
|
||||
* @type {ol.proj.ProjectionLike}
|
||||
* @api stable
|
||||
*/
|
||||
@@ -2217,6 +2224,24 @@ olx.format.WKTOptions;
|
||||
olx.format.WKTOptions.prototype.splitCollection;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* layers: (Array.<string>|undefined)
|
||||
* }}
|
||||
* @api
|
||||
*/
|
||||
olx.format.WMSGetFeatureInfoOptions;
|
||||
|
||||
|
||||
/**
|
||||
* If set, only features of the given layers will be returned by the format
|
||||
* when read.
|
||||
* @type {Array.<string>|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.format.WMSGetFeatureInfoOptions.prototype.layers;
|
||||
|
||||
|
||||
/**
|
||||
* Namespace.
|
||||
* @type {Object}
|
||||
@@ -2347,7 +2372,8 @@ olx.interaction.DoubleClickZoomOptions.prototype.delta;
|
||||
|
||||
/**
|
||||
* @typedef {{formatConstructors: (Array.<function(new: ol.format.Feature)>|undefined),
|
||||
* projection: ol.proj.ProjectionLike}}
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* target: (Element|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
olx.interaction.DragAndDropOptions;
|
||||
@@ -2369,6 +2395,14 @@ olx.interaction.DragAndDropOptions.prototype.formatConstructors;
|
||||
olx.interaction.DragAndDropOptions.prototype.projection;
|
||||
|
||||
|
||||
/**
|
||||
* The element that is used as the drop target, default is the viewport element.
|
||||
* @type {Element|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.interaction.DragAndDropOptions.prototype.target;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{className: (string|undefined),
|
||||
* condition: (ol.events.ConditionType|undefined),
|
||||
@@ -2885,7 +2919,7 @@ olx.interaction.PointerOptions.prototype.handleDownEvent;
|
||||
/**
|
||||
* Function handling "drag" events. This function is called on "move" events
|
||||
* during a drag sequence.
|
||||
* @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)}
|
||||
* @type {(function(ol.MapBrowserPointerEvent)|undefined)}
|
||||
* @api
|
||||
*/
|
||||
olx.interaction.PointerOptions.prototype.handleDragEvent;
|
||||
@@ -2906,7 +2940,7 @@ olx.interaction.PointerOptions.prototype.handleEvent;
|
||||
* Function handling "move" events. This function is called on "move" events,
|
||||
* also during a drag sequence (so during a drag sequence both the
|
||||
* `handleDragEvent` function and this function are called).
|
||||
* @type {(function(ol.MapBrowserPointerEvent):boolean|undefined)}
|
||||
* @type {(function(ol.MapBrowserPointerEvent)|undefined)}
|
||||
* @api
|
||||
*/
|
||||
olx.interaction.PointerOptions.prototype.handleMoveEvent;
|
||||
@@ -2924,7 +2958,7 @@ olx.interaction.PointerOptions.prototype.handleUpEvent;
|
||||
/**
|
||||
* @typedef {{addCondition: (ol.events.ConditionType|undefined),
|
||||
* condition: (ol.events.ConditionType|undefined),
|
||||
* layers: (Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean|undefined),
|
||||
* layers: (undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean),
|
||||
* style: (ol.style.Style|Array.<ol.style.Style>|ol.style.StyleFunction|undefined),
|
||||
* removeCondition: (ol.events.ConditionType|undefined),
|
||||
* toggleCondition: (ol.events.ConditionType|undefined),
|
||||
@@ -2969,7 +3003,7 @@ olx.interaction.SelectOptions.prototype.condition;
|
||||
* function will be called for each layer in the map and should return
|
||||
* `true` for layers that you want to be selectable. If the option is
|
||||
* absent, all visible layers will be considered selectable.
|
||||
* @type {Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean|undefined}
|
||||
* @type {undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean}
|
||||
* @api
|
||||
*/
|
||||
olx.interaction.SelectOptions.prototype.layers;
|
||||
@@ -3856,7 +3890,7 @@ olx.render.ToContextOptions.prototype.size;
|
||||
/**
|
||||
* Pixel ratio (canvas pixel to css pixel ratio) for the canvas. Default
|
||||
* is the detected device pixel ratio.
|
||||
* @type {ol.Size|undefined}
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.render.ToContextOptions.prototype.pixelRatio;
|
||||
@@ -3925,7 +3959,12 @@ olx.source.BingMapsOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -4053,7 +4092,7 @@ olx.source.TileUTFGridOptions.prototype.url;
|
||||
* opaque: (boolean|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* reprojectionErrorThreshold: (number|undefined),
|
||||
* state: (ol.source.State|string|undefined),
|
||||
* state: (ol.source.State|undefined),
|
||||
* tileClass: (function(new: ol.ImageTile, ol.TileCoord,
|
||||
* ol.TileState, string, ?string,
|
||||
* ol.TileLoadFunctionType)|undefined),
|
||||
@@ -4124,7 +4163,7 @@ olx.source.TileImageOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
/**
|
||||
* Source state.
|
||||
* @type {ol.source.State|string|undefined}
|
||||
* @type {ol.source.State|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.TileImageOptions.prototype.state;
|
||||
@@ -4149,7 +4188,12 @@ olx.source.TileImageOptions.prototype.tileGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -4210,7 +4254,7 @@ olx.source.TileImageOptions.prototype.wrapX;
|
||||
* logo: (string|olx.LogoOptions|undefined),
|
||||
* opaque: (boolean|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* state: (ol.source.State|string|undefined),
|
||||
* state: (ol.source.State|undefined),
|
||||
* tileClass: (function(new: ol.VectorTile, ol.TileCoord,
|
||||
* ol.TileState, string, ol.format.Feature,
|
||||
* ol.TileLoadFunctionType)|undefined),
|
||||
@@ -4226,7 +4270,6 @@ olx.source.TileImageOptions.prototype.wrapX;
|
||||
olx.source.VectorTileOptions;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Attributions.
|
||||
* @type {Array.<ol.Attribution>|undefined}
|
||||
@@ -4270,7 +4313,7 @@ olx.source.VectorTileOptions.prototype.projection;
|
||||
|
||||
/**
|
||||
* Source state.
|
||||
* @type {ol.source.State|string|undefined}
|
||||
* @type {ol.source.State|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.VectorTileOptions.prototype.state;
|
||||
@@ -4295,7 +4338,13 @@ olx.source.VectorTileOptions.prototype.tileGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(tile, url) {
|
||||
* tile.setLoader(
|
||||
* ol.featureloader.tile(url, tile.getFormat()));
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -4476,7 +4525,12 @@ olx.source.MapQuestOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -4528,6 +4582,7 @@ olx.source.TileDebugOptions.prototype.wrapX;
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* crossOrigin: (null|string|undefined),
|
||||
* maxZoom: (number|undefined),
|
||||
* opaque: (boolean|undefined),
|
||||
* reprojectionErrorThreshold: (number|undefined),
|
||||
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
||||
* url: (string|undefined),
|
||||
@@ -4567,6 +4622,14 @@ olx.source.OSMOptions.prototype.crossOrigin;
|
||||
olx.source.OSMOptions.prototype.maxZoom;
|
||||
|
||||
|
||||
/**
|
||||
* Whether the layer is opaque. Default is `true`.
|
||||
* @type {boolean|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.OSMOptions.prototype.opaque;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum allowed reprojection error (in pixels). Default is `0.5`.
|
||||
* Higher values can increase reprojection performance, but decrease precision.
|
||||
@@ -4577,7 +4640,12 @@ olx.source.OSMOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -4608,7 +4676,7 @@ olx.source.OSMOptions.prototype.wrapX;
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* ratio: (number|undefined),
|
||||
* resolutions: (Array.<number>|undefined),
|
||||
* state: (ol.source.State|string|undefined)}}
|
||||
* state: (ol.source.State|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
olx.source.ImageCanvasOptions;
|
||||
@@ -4674,7 +4742,7 @@ olx.source.ImageCanvasOptions.prototype.resolutions;
|
||||
|
||||
/**
|
||||
* Source state.
|
||||
* @type {ol.source.State|string|undefined}
|
||||
* @type {ol.source.State|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.ImageCanvasOptions.prototype.state;
|
||||
@@ -4982,7 +5050,12 @@ olx.source.StamenOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -5170,7 +5243,12 @@ olx.source.TileArcGISRestOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -5257,7 +5335,12 @@ olx.source.TileJSONOptions.prototype.reprojectionErrorThreshold;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -5410,7 +5493,12 @@ olx.source.TileWMSOptions.prototype.serverType;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -5744,7 +5832,12 @@ olx.source.WMTSOptions.prototype.maxZoom;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -5771,6 +5864,7 @@ olx.source.WMTSOptions.prototype.wrapX;
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* crossOrigin: (null|string|undefined),
|
||||
* logo: (string|olx.LogoOptions|undefined),
|
||||
* opaque: (boolean|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* reprojectionErrorThreshold: (number|undefined),
|
||||
* maxZoom: (number|undefined),
|
||||
@@ -5816,6 +5910,14 @@ olx.source.XYZOptions.prototype.crossOrigin;
|
||||
olx.source.XYZOptions.prototype.logo;
|
||||
|
||||
|
||||
/**
|
||||
* Whether the layer is opaque.
|
||||
* @type {boolean|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.XYZOptions.prototype.opaque;
|
||||
|
||||
|
||||
/**
|
||||
* Projection. Default is `EPSG:3857`.
|
||||
* @type {ol.proj.ProjectionLike}
|
||||
@@ -5851,14 +5953,19 @@ olx.source.XYZOptions.prototype.minZoom;
|
||||
|
||||
/**
|
||||
* Tile grid.
|
||||
* @type {ol.tilegrid.TileGrid}
|
||||
* @type {ol.tilegrid.TileGrid|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.XYZOptions.prototype.tileGrid;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to load a tile given a URL.
|
||||
* Optional function to load a tile given a URL. The default is
|
||||
* ```js
|
||||
* function(imageTile, src) {
|
||||
* imageTile.getImage().src = src;
|
||||
* };
|
||||
* ```
|
||||
* @type {ol.TileLoadFunctionType|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -6060,16 +6167,17 @@ olx.style.CircleOptions.prototype.atlasManager;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{color: (ol.Color|string|undefined)}}
|
||||
* @typedef {{color: (ol.Color|ol.ColorLike|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
olx.style.FillOptions;
|
||||
|
||||
|
||||
/**
|
||||
* Color. See {@link ol.color} for possible formats. Default null; if null,
|
||||
* the Canvas/renderer default black will be used.
|
||||
* @type {ol.Color|string|undefined}
|
||||
* A color, gradient or pattern. See {@link ol.color}
|
||||
* and {@link ol.colorlike} for possible formats. Default null;
|
||||
* if null, the Canvas/renderer default black will be used.
|
||||
* @type {ol.Color|ol.ColorLike|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.style.FillOptions.prototype.color;
|
||||
@@ -6266,6 +6374,7 @@ olx.style.IconOptions.prototype.src;
|
||||
* snapToPixel: (boolean|undefined),
|
||||
* stroke: (ol.style.Stroke|undefined),
|
||||
* rotation: (number|undefined),
|
||||
* rotateWithView: (boolean|undefined),
|
||||
* atlasManager: (ol.style.AtlasManager|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
@@ -6298,10 +6407,10 @@ olx.style.RegularShapeOptions.prototype.radius;
|
||||
|
||||
|
||||
/**
|
||||
* Inner radius of a star.
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
* Inner radius of a star.
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.style.RegularShapeOptions.prototype.radius1;
|
||||
|
||||
|
||||
@@ -6353,6 +6462,14 @@ olx.style.RegularShapeOptions.prototype.stroke;
|
||||
olx.style.RegularShapeOptions.prototype.rotation;
|
||||
|
||||
|
||||
/**
|
||||
* Whether to rotate the shape with the view. Default is `false`.
|
||||
* @type {boolean|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.style.RegularShapeOptions.prototype.rotateWithView;
|
||||
|
||||
|
||||
/**
|
||||
* The atlas manager to use for this symbol. When using WebGL it is
|
||||
* recommended to use an atlas manager to avoid texture switching.
|
||||
@@ -6914,7 +7031,7 @@ olx.view.FitOptions.prototype.maxZoom;
|
||||
* usedTiles: Object.<string, Object.<string, ol.TileRange>>,
|
||||
* viewState: olx.ViewState,
|
||||
* viewHints: Array.<number>,
|
||||
* wantedTiles: Object.<string, Object.<string, boolean>>}}
|
||||
* wantedTiles: !Object.<string, Object.<string, boolean>>}}
|
||||
* @api
|
||||
*/
|
||||
olx.FrameState;
|
||||
|
||||
@@ -28,7 +28,7 @@ In the source file (`src/ol/MapBrowserEvent.js`), the class needs to implement t
|
||||
* @constructor
|
||||
* @implements {oli.MapBrowserEvent}
|
||||
*/
|
||||
ol.MapBrowserEvent = function(type, map, browserEvent, opt_frameState) {
|
||||
ol.MapBrowserEvent = function(type, map, originalEvent, opt_frameState) {
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
20
package.json
20
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "openlayers",
|
||||
"version": "3.13.1",
|
||||
"version": "3.14.2",
|
||||
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
||||
"keywords": [
|
||||
"map",
|
||||
@@ -34,14 +34,14 @@
|
||||
"browserify": "13.0.0",
|
||||
"closure-util": "1.10.0",
|
||||
"derequire": "2.0.3",
|
||||
"fs-extra": "0.26.4",
|
||||
"fs-extra": "0.26.5",
|
||||
"glob": "6.0.4",
|
||||
"graceful-fs": "4.1.2",
|
||||
"graceful-fs": "4.1.3",
|
||||
"handlebars": "4.0.5",
|
||||
"jsdoc": "3.4.0",
|
||||
"marked": "0.3.5",
|
||||
"metalsmith": "2.1.0",
|
||||
"metalsmith-layouts": "1.4.2",
|
||||
"metalsmith-layouts": "1.5.4",
|
||||
"nomnom": "1.8.1",
|
||||
"pbf": "1.3.5",
|
||||
"pixelworks": "1.0.0",
|
||||
@@ -54,19 +54,19 @@
|
||||
"clean-css": "3.4.9",
|
||||
"coveralls": "2.11.6",
|
||||
"debounce": "^1.0.0",
|
||||
"eslint": "v2.0.0-beta.1",
|
||||
"eslint-config-openlayers": "^3.0.0",
|
||||
"eslint": "2.2.0",
|
||||
"eslint-config-openlayers": "4.0.0",
|
||||
"expect.js": "0.3.1",
|
||||
"gaze": "^0.5.1",
|
||||
"istanbul": "0.4.2",
|
||||
"jquery": "2.2.0",
|
||||
"mocha": "2.3.4",
|
||||
"jquery": "2.2.1",
|
||||
"mocha": "2.4.5",
|
||||
"mocha-phantomjs-core": "^1.3.0",
|
||||
"mustache": "2.2.1",
|
||||
"phantomjs": "1.9.19",
|
||||
"phantomjs-prebuilt": "2.1.4",
|
||||
"proj4": "2.3.12",
|
||||
"resemblejs": "2.1.0",
|
||||
"sinon": "1.17.2",
|
||||
"sinon": "1.17.3",
|
||||
"slimerjs-edge": "0.10.0-pre-3",
|
||||
"wrench": "1.5.8"
|
||||
},
|
||||
|
||||
178
src/ol/array.js
178
src/ol/array.js
@@ -1,16 +1,50 @@
|
||||
goog.provide('ol.array');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
|
||||
|
||||
/**
|
||||
* Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.
|
||||
* https://github.com/darkskyapp/binary-search
|
||||
*
|
||||
* @param {Array.<*>} haystack Items to search through.
|
||||
* @param {*} needle The item to look for.
|
||||
* @param {Function=} opt_comparator Comparator function.
|
||||
* @return {number} The index of the item if found, -1 if not.
|
||||
*/
|
||||
ol.array.binarySearch = function(haystack, needle, opt_comparator) {
|
||||
var mid, cmp;
|
||||
var comparator = opt_comparator || ol.array.numberSafeCompareFunction;
|
||||
var low = 0;
|
||||
var high = haystack.length;
|
||||
var found = false;
|
||||
|
||||
while (low < high) {
|
||||
/* Note that "(low + high) >>> 1" may overflow, and results in a typecast
|
||||
* to double (which gives the wrong results). */
|
||||
mid = low + (high - low >> 1);
|
||||
cmp = +comparator(haystack[mid], needle);
|
||||
|
||||
if (cmp < 0.0) { /* Too low. */
|
||||
low = mid + 1;
|
||||
|
||||
} else { /* Key found or too high */
|
||||
high = mid;
|
||||
found = !cmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Key not found. */
|
||||
return found ? low : ~low;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} arr Array.
|
||||
* @param {number} target Target.
|
||||
* @return {number} Index.
|
||||
*/
|
||||
ol.array.binaryFindNearest = function(arr, target) {
|
||||
var index = goog.array.binarySearch(arr, target,
|
||||
var index = ol.array.binarySearch(arr, target,
|
||||
/**
|
||||
* @param {number} a A.
|
||||
* @param {number} b B.
|
||||
@@ -127,3 +161,143 @@ ol.array.reverseSubArray = function(arr, begin, end) {
|
||||
--end;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<*>} arr Array.
|
||||
* @return {!Array.<?>} Flattened Array.
|
||||
*/
|
||||
ol.array.flatten = function(arr) {
|
||||
var data = arr.reduce(function(flattened, value) {
|
||||
if (goog.isArray(value)) {
|
||||
return flattened.concat(ol.array.flatten(value));
|
||||
} else {
|
||||
return flattened.concat(value);
|
||||
}
|
||||
}, []);
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<VALUE>} arr The array to modify.
|
||||
* @param {Array.<VALUE>|VALUE} data The elements or arrays of elements
|
||||
* to add to arr.
|
||||
* @template VALUE
|
||||
*/
|
||||
ol.array.extend = function(arr, data) {
|
||||
var i;
|
||||
var extension = goog.isArrayLike(data) ? data : [data];
|
||||
var length = extension.length
|
||||
for (i = 0; i < length; i++) {
|
||||
arr[arr.length] = extension[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<VALUE>} arr The array to modify.
|
||||
* @param {VALUE} obj The element to remove.
|
||||
* @template VALUE
|
||||
* @return {boolean} If the element was removed.
|
||||
*/
|
||||
ol.array.remove = function(arr, obj) {
|
||||
var i = arr.indexOf(obj);
|
||||
var found = i > -1;
|
||||
if (found) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<VALUE>} arr The array to search in.
|
||||
* @param {function(VALUE, number, ?) : boolean} func The function to compare.
|
||||
* @template VALUE
|
||||
* @return {VALUE} The element found.
|
||||
*/
|
||||
ol.array.find = function(arr, func) {
|
||||
var length = arr.length >>> 0;
|
||||
var value;
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
value = arr[i];
|
||||
if (func(value, i, arr)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array|Uint8ClampedArray} arr1 The first array to compare.
|
||||
* @param {Array|Uint8ClampedArray} arr2 The second array to compare.
|
||||
* @return {boolean} Whether the two arrays are equal.
|
||||
*/
|
||||
ol.array.equals = function(arr1, arr2) {
|
||||
var len1 = arr1.length;
|
||||
if (len1 !== arr2.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < len1; i++) {
|
||||
if (arr1[i] !== arr2[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<*>} arr The array to sort (modifies original).
|
||||
* @param {Function} compareFnc Comparison function.
|
||||
*/
|
||||
ol.array.stableSort = function(arr, compareFnc) {
|
||||
var length = arr.length;
|
||||
var tmp = Array(arr.length);
|
||||
var i;
|
||||
for (i = 0; i < length; i++) {
|
||||
tmp[i] = {index: i, value: arr[i]};
|
||||
}
|
||||
tmp.sort(function(a, b) {
|
||||
return compareFnc(a.value, b.value) || a.index - b.index;
|
||||
});
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
arr[i] = tmp[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<*>} arr The array to search in.
|
||||
* @param {Function} func Comparison function.
|
||||
* @return {number} Return index.
|
||||
*/
|
||||
ol.array.findIndex = function(arr, func) {
|
||||
var index;
|
||||
var found = !arr.every(function(el, idx) {
|
||||
index = idx;
|
||||
return !func(el, idx, arr);
|
||||
});
|
||||
return found ? index : -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<*>} arr The array to test.
|
||||
* @param {Function=} opt_func Comparison function.
|
||||
* @param {boolean=} opt_strict Strictly sorted (default false).
|
||||
* @return {boolean} Return index.
|
||||
*/
|
||||
ol.array.isSorted = function(arr, opt_func, opt_strict) {
|
||||
var compare = opt_func || ol.array.numberSafeCompareFunction;
|
||||
return arr.every(function(currentVal, index) {
|
||||
if (index === 0) {
|
||||
return true;
|
||||
}
|
||||
var res = compare(arr[index - 1], currentVal);
|
||||
return !(res > 0 || opt_strict && res === 0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ goog.provide('ol.Collection');
|
||||
goog.provide('ol.CollectionEvent');
|
||||
goog.provide('ol.CollectionEventType');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.Object');
|
||||
|
||||
|
||||
@@ -37,7 +36,7 @@ ol.CollectionEventType = {
|
||||
* type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {goog.events.Event}
|
||||
* @extends {ol.events.Event}
|
||||
* @implements {oli.CollectionEvent}
|
||||
* @param {ol.CollectionEventType} type Type.
|
||||
* @param {*=} opt_element Element.
|
||||
@@ -55,7 +54,7 @@ ol.CollectionEvent = function(type, opt_element, opt_target) {
|
||||
this.element = opt_element;
|
||||
|
||||
};
|
||||
goog.inherits(ol.CollectionEvent, goog.events.Event);
|
||||
goog.inherits(ol.CollectionEvent, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
@@ -180,7 +179,7 @@ ol.Collection.prototype.getLength = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.Collection.prototype.insertAt = function(index, elem) {
|
||||
goog.array.insertAt(this.array_, elem, index);
|
||||
this.array_.splice(index, 0, elem);
|
||||
this.updateLength_();
|
||||
this.dispatchEvent(
|
||||
new ol.CollectionEvent(ol.CollectionEventType.ADD, elem, this));
|
||||
@@ -238,7 +237,7 @@ ol.Collection.prototype.remove = function(elem) {
|
||||
*/
|
||||
ol.Collection.prototype.removeAt = function(index) {
|
||||
var prev = this.array_[index];
|
||||
goog.array.removeAt(this.array_, index);
|
||||
this.array_.splice(index, 1);
|
||||
this.updateLength_();
|
||||
this.dispatchEvent(
|
||||
new ol.CollectionEvent(ol.CollectionEventType.REMOVE, prev, this));
|
||||
|
||||
@@ -106,7 +106,7 @@ ol.color.asArray = function(color) {
|
||||
if (goog.isArray(color)) {
|
||||
return color;
|
||||
} else {
|
||||
goog.asserts.assert(goog.isString(color), 'Color should be a string');
|
||||
goog.asserts.assert(typeof color === 'string', 'Color should be a string');
|
||||
return ol.color.fromString(color);
|
||||
}
|
||||
};
|
||||
@@ -119,7 +119,7 @@ ol.color.asArray = function(color) {
|
||||
* @api
|
||||
*/
|
||||
ol.color.asString = function(color) {
|
||||
if (goog.isString(color)) {
|
||||
if (typeof color === 'string') {
|
||||
return color;
|
||||
} else {
|
||||
goog.asserts.assert(goog.isArray(color), 'Color should be an array');
|
||||
@@ -322,10 +322,10 @@ ol.color.stringOrColorEquals = function(color1, color2) {
|
||||
if (color1 === color2 || color1 == color2) {
|
||||
return true;
|
||||
}
|
||||
if (goog.isString(color1)) {
|
||||
if (typeof color1 === 'string') {
|
||||
color1 = ol.color.fromString(color1);
|
||||
}
|
||||
if (goog.isString(color2)) {
|
||||
if (typeof color2 === 'string') {
|
||||
color2 = ol.color.fromString(color2);
|
||||
}
|
||||
return ol.color.equals(color1, color2);
|
||||
|
||||
41
src/ol/colorlike.js
Normal file
41
src/ol/colorlike.js
Normal file
@@ -0,0 +1,41 @@
|
||||
goog.provide('ol.ColorLike');
|
||||
goog.provide('ol.colorlike');
|
||||
|
||||
goog.require('ol.color');
|
||||
|
||||
|
||||
/**
|
||||
* A type accepted by CanvasRenderingContext2D.fillStyle.
|
||||
* Represents a color, pattern, or gradient.
|
||||
*
|
||||
* @typedef {string|CanvasPattern|CanvasGradient}
|
||||
* @api
|
||||
*/
|
||||
ol.ColorLike;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Color|ol.ColorLike} color Color.
|
||||
* @return {ol.ColorLike} The color as an ol.ColorLike
|
||||
* @api
|
||||
*/
|
||||
ol.colorlike.asColorLike = function(color) {
|
||||
if (ol.colorlike.isColorLike(color)) {
|
||||
return /** @type {string|CanvasPattern|CanvasGradient} */ (color);
|
||||
} else {
|
||||
return ol.color.asString(/** @type {ol.Color} */ (color));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {?} color The value that is potentially an ol.ColorLike
|
||||
* @return {boolean} Whether the color is an ol.ColorLike
|
||||
*/
|
||||
ol.colorlike.isColorLike = function(color) {
|
||||
return (
|
||||
typeof color === 'string' ||
|
||||
color instanceof CanvasPattern ||
|
||||
color instanceof CanvasGradient
|
||||
);
|
||||
};
|
||||
@@ -5,14 +5,14 @@ goog.provide('ol.control.Attribution');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.classlist');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.source.Tile');
|
||||
|
||||
|
||||
@@ -64,27 +64,27 @@ ol.control.Attribution = function(opt_options) {
|
||||
this.collapsed_ = false;
|
||||
}
|
||||
|
||||
var className = options.className ? options.className : 'ol-attribution';
|
||||
var className = options.className !== undefined ? options.className : 'ol-attribution';
|
||||
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Attributions';
|
||||
var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions';
|
||||
|
||||
var collapseLabel = options.collapseLabel ? options.collapseLabel : '\u00BB';
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00BB';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.collapseLabel_ = goog.isString(collapseLabel) ?
|
||||
this.collapseLabel_ = typeof collapseLabel === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, collapseLabel) :
|
||||
collapseLabel;
|
||||
|
||||
var label = options.label ? options.label : 'i';
|
||||
var label = options.label !== undefined ? options.label : 'i';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.label_ = goog.isString(label) ?
|
||||
this.label_ = typeof label === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, label) :
|
||||
label;
|
||||
|
||||
@@ -95,8 +95,7 @@ ol.control.Attribution = function(opt_options) {
|
||||
'title': tipLabel
|
||||
}, activeLabel);
|
||||
|
||||
goog.events.listen(button, goog.events.EventType.CLICK,
|
||||
this.handleClick_, false, this);
|
||||
ol.events.listen(button, ol.events.EventType.CLICK, this.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL +
|
||||
@@ -151,7 +150,7 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
|
||||
var intersectsTileRange;
|
||||
var layerStatesArray = frameState.layerStatesArray;
|
||||
/** @type {Object.<string, ol.Attribution>} */
|
||||
var attributions = goog.object.clone(frameState.attributions);
|
||||
var attributions = ol.object.assign({}, frameState.attributions);
|
||||
/** @type {Object.<string, ol.Attribution>} */
|
||||
var hiddenAttributions = {};
|
||||
var projection = frameState.viewState.projection;
|
||||
@@ -268,14 +267,14 @@ ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
}
|
||||
|
||||
var renderVisible =
|
||||
!goog.object.isEmpty(this.attributionElementRenderedVisible_) ||
|
||||
!goog.object.isEmpty(frameState.logos);
|
||||
!ol.object.isEmpty(this.attributionElementRenderedVisible_) ||
|
||||
!ol.object.isEmpty(frameState.logos);
|
||||
if (this.renderedVisible_ != renderVisible) {
|
||||
goog.style.setElementShown(this.element, renderVisible);
|
||||
this.renderedVisible_ = renderVisible;
|
||||
}
|
||||
if (renderVisible &&
|
||||
goog.object.isEmpty(this.attributionElementRenderedVisible_)) {
|
||||
ol.object.isEmpty(this.attributionElementRenderedVisible_)) {
|
||||
goog.dom.classlist.add(this.element, 'ol-logo-only');
|
||||
} else {
|
||||
goog.dom.classlist.remove(this.element, 'ol-logo-only');
|
||||
@@ -322,13 +321,13 @@ ol.control.Attribution.prototype.insertLogos_ = function(frameState) {
|
||||
}
|
||||
}
|
||||
|
||||
goog.style.setElementShown(this.logoLi_, !goog.object.isEmpty(logos));
|
||||
goog.style.setElementShown(this.logoLi_, !ol.object.isEmpty(logos));
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} event The event to handle
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.Attribution.prototype.handleClick_ = function(event) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.control.Control');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol');
|
||||
goog.require('ol.MapEventType');
|
||||
goog.require('ol.Object');
|
||||
@@ -60,7 +60,7 @@ ol.control.Control = function(options) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {!Array.<?number>}
|
||||
* @type {!Array.<ol.events.Key>}
|
||||
*/
|
||||
this.listenerKeys = [];
|
||||
|
||||
@@ -107,18 +107,18 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
if (this.map_) {
|
||||
goog.dom.removeNode(this.element);
|
||||
}
|
||||
if (this.listenerKeys.length > 0) {
|
||||
this.listenerKeys.forEach(goog.events.unlistenByKey);
|
||||
this.listenerKeys.length = 0;
|
||||
for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
|
||||
ol.events.unlistenByKey(this.listenerKeys[i]);
|
||||
}
|
||||
this.listenerKeys.length = 0;
|
||||
this.map_ = map;
|
||||
if (this.map_) {
|
||||
var target = this.target_ ?
|
||||
this.target_ : map.getOverlayContainerStopEvent();
|
||||
target.appendChild(this.element);
|
||||
if (this.render !== ol.nullFunction) {
|
||||
this.listenerKeys.push(goog.events.listen(map,
|
||||
ol.MapEventType.POSTRENDER, this.render, false, this));
|
||||
this.listenerKeys.push(ol.events.listen(map,
|
||||
ol.MapEventType.POSTRENDER, this.render, this));
|
||||
}
|
||||
map.render();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ goog.require('goog.dom');
|
||||
goog.require('goog.dom.classlist');
|
||||
goog.require('goog.dom.fullscreen');
|
||||
goog.require('goog.dom.fullscreen.EventType');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
@@ -15,6 +15,10 @@ goog.require('ol.css');
|
||||
/**
|
||||
* @classdesc
|
||||
* Provides a button that when clicked fills up the full screen with the map.
|
||||
* The full screen source element is by default the element containing the map viewport unless
|
||||
* overriden by providing the `source` option. In which case, the dom
|
||||
* element introduced using this parameter will be displayed in full screen.
|
||||
*
|
||||
* When in full screen mode, a close button is shown to exit full screen mode.
|
||||
* The [Fullscreen API](http://www.w3.org/TR/fullscreen/) is used to
|
||||
* toggle the map in full screen mode.
|
||||
@@ -33,24 +37,25 @@ ol.control.FullScreen = function(opt_options) {
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.cssClassName_ = options.className ? options.className : 'ol-full-screen';
|
||||
this.cssClassName_ = options.className !== undefined ? options.className :
|
||||
'ol-full-screen';
|
||||
|
||||
var label = options.label ? options.label : '\u2922';
|
||||
var label = options.label !== undefined ? options.label : '\u2922';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.labelNode_ = goog.isString(label) ?
|
||||
this.labelNode_ = typeof label === 'string' ?
|
||||
document.createTextNode(label) : label;
|
||||
|
||||
var labelActive = options.labelActive ? options.labelActive : '\u00d7';
|
||||
var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.labelActiveNode_ = goog.isString(labelActive) ?
|
||||
this.labelActiveNode_ = typeof labelActive === 'string' ?
|
||||
document.createTextNode(labelActive) : labelActive;
|
||||
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
|
||||
@@ -60,12 +65,12 @@ ol.control.FullScreen = function(opt_options) {
|
||||
'title': tipLabel
|
||||
}, this.labelNode_);
|
||||
|
||||
goog.events.listen(button, goog.events.EventType.CLICK,
|
||||
this.handleClick_, false, this);
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
goog.events.listen(goog.global.document,
|
||||
ol.events.listen(goog.global.document,
|
||||
goog.dom.fullscreen.EventType.CHANGE,
|
||||
this.handleFullScreenChange_, false, this);
|
||||
this.handleFullScreenChange_, this);
|
||||
|
||||
var cssClasses = this.cssClassName_ + ' ' + ol.css.CLASS_UNSELECTABLE +
|
||||
' ' + ol.css.CLASS_CONTROL + ' ' +
|
||||
@@ -83,12 +88,18 @@ ol.control.FullScreen = function(opt_options) {
|
||||
*/
|
||||
this.keys_ = options.keys !== undefined ? options.keys : false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Element|string|undefined}
|
||||
*/
|
||||
this.source_ = options.source;
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.FullScreen, ol.control.Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} event The event to handle
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.FullScreen.prototype.handleClick_ = function(event) {
|
||||
@@ -111,7 +122,8 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
if (goog.dom.fullscreen.isFullScreen()) {
|
||||
goog.dom.fullscreen.exitFullScreen();
|
||||
} else {
|
||||
var element = map.getTargetElement();
|
||||
var element = this.source_ ?
|
||||
goog.dom.getElement(this.source_) : map.getTargetElement();
|
||||
goog.asserts.assert(element, 'element should be defined');
|
||||
if (this.keys_) {
|
||||
goog.dom.fullscreen.requestFullScreenWithKeys(element);
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
goog.provide('ol.control.MousePosition');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.CoordinateFormatType');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.Pixel');
|
||||
@@ -40,9 +39,8 @@ ol.control.MousePosition = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
var className = options.className ? options.className : 'ol-mouse-position';
|
||||
|
||||
var element = goog.dom.createDom('DIV', className);
|
||||
var element = document.createElement('DIV');
|
||||
element.className = options.className !== undefined ? options.className : 'ol-mouse-position'
|
||||
|
||||
var render = options.render ?
|
||||
options.render : ol.control.MousePosition.render;
|
||||
@@ -53,9 +51,9 @@ ol.control.MousePosition = function(opt_options) {
|
||||
target: options.target
|
||||
});
|
||||
|
||||
goog.events.listen(this,
|
||||
ol.events.listen(this,
|
||||
ol.Object.getChangeEventType(ol.control.MousePositionProperty.PROJECTION),
|
||||
this.handleProjectionChanged_, false, this);
|
||||
this.handleProjectionChanged_, this);
|
||||
|
||||
if (options.coordinateFormat) {
|
||||
this.setCoordinateFormat(options.coordinateFormat);
|
||||
@@ -68,7 +66,7 @@ ol.control.MousePosition = function(opt_options) {
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.undefinedHTML_ = options.undefinedHTML ? options.undefinedHTML : '';
|
||||
this.undefinedHTML_ = options.undefinedHTML !== undefined ? options.undefinedHTML : '';
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -154,21 +152,21 @@ ol.control.MousePosition.prototype.getProjection = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
ol.control.MousePosition.prototype.handleMouseMove = function(browserEvent) {
|
||||
ol.control.MousePosition.prototype.handleMouseMove = function(event) {
|
||||
var map = this.getMap();
|
||||
this.lastMouseMovePixel_ = map.getEventPixel(browserEvent.getBrowserEvent());
|
||||
this.lastMouseMovePixel_ = map.getEventPixel(event);
|
||||
this.updateHTML_(this.lastMouseMovePixel_);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||
* @param {Event} event Browser event.
|
||||
* @protected
|
||||
*/
|
||||
ol.control.MousePosition.prototype.handleMouseOut = function(browserEvent) {
|
||||
ol.control.MousePosition.prototype.handleMouseOut = function(event) {
|
||||
this.updateHTML_(null);
|
||||
this.lastMouseMovePixel_ = null;
|
||||
};
|
||||
@@ -183,10 +181,10 @@ ol.control.MousePosition.prototype.setMap = function(map) {
|
||||
if (map) {
|
||||
var viewport = map.getViewport();
|
||||
this.listenerKeys.push(
|
||||
goog.events.listen(viewport, goog.events.EventType.MOUSEMOVE,
|
||||
this.handleMouseMove, false, this),
|
||||
goog.events.listen(viewport, goog.events.EventType.MOUSEOUT,
|
||||
this.handleMouseOut, false, this)
|
||||
ol.events.listen(viewport, ol.events.EventType.MOUSEMOVE,
|
||||
this.handleMouseMove, this),
|
||||
ol.events.listen(viewport, ol.events.EventType.MOUSEOUT,
|
||||
this.handleMouseOut, this)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,8 +3,8 @@ goog.provide('ol.control.OverviewMap');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.classlist');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('goog.math.Size');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol');
|
||||
@@ -52,27 +52,27 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
this.collapsed_ = false;
|
||||
}
|
||||
|
||||
var className = options.className ? options.className : 'ol-overviewmap';
|
||||
var className = options.className !== undefined ? options.className : 'ol-overviewmap';
|
||||
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Overview map';
|
||||
var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Overview map';
|
||||
|
||||
var collapseLabel = options.collapseLabel ? options.collapseLabel : '\u00AB';
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00AB';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.collapseLabel_ = goog.isString(collapseLabel) ?
|
||||
this.collapseLabel_ = typeof collapseLabel === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, collapseLabel) :
|
||||
collapseLabel;
|
||||
|
||||
var label = options.label ? options.label : '\u00BB';
|
||||
var label = options.label !== undefined ? options.label : '\u00BB';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Node}
|
||||
*/
|
||||
this.label_ = goog.isString(label) ?
|
||||
this.label_ = typeof label === 'string' ?
|
||||
goog.dom.createDom('SPAN', {}, label) :
|
||||
label;
|
||||
|
||||
@@ -83,10 +83,11 @@ ol.control.OverviewMap = function(opt_options) {
|
||||
'title': tipLabel
|
||||
}, activeLabel);
|
||||
|
||||
goog.events.listen(button, goog.events.EventType.CLICK,
|
||||
this.handleClick_, false, this);
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
var ovmapDiv = goog.dom.createDom('DIV', 'ol-overviewmap-map');
|
||||
var ovmapDiv = document.createElement('DIV');
|
||||
ovmapDiv.className = 'ol-overviewmap-map';
|
||||
|
||||
/**
|
||||
* @type {ol.Map}
|
||||
@@ -159,9 +160,9 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
|
||||
if (map) {
|
||||
this.listenerKeys.push(goog.events.listen(
|
||||
this.listenerKeys.push(ol.events.listen(
|
||||
map, ol.ObjectEventType.PROPERTYCHANGE,
|
||||
this.handleMapPropertyChange_, false, this));
|
||||
this.handleMapPropertyChange_, this));
|
||||
|
||||
// TODO: to really support map switching, this would need to be reworked
|
||||
if (this.ovmap_.getLayers().getLength() === 0) {
|
||||
@@ -203,9 +204,9 @@ ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
||||
goog.events.listen(view,
|
||||
ol.events.listen(view,
|
||||
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
|
||||
this.handleRotationChanged_, false, this);
|
||||
this.handleRotationChanged_, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -215,9 +216,9 @@ ol.control.OverviewMap.prototype.bindView_ = function(view) {
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.unbindView_ = function(view) {
|
||||
goog.events.unlisten(view,
|
||||
ol.events.unlisten(view,
|
||||
ol.Object.getChangeEventType(ol.ViewProperty.ROTATION),
|
||||
this.handleRotationChanged_, false, this);
|
||||
this.handleRotationChanged_, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -432,7 +433,7 @@ ol.control.OverviewMap.prototype.calculateCoordinateRotate_ = function(
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} event The event to handle
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.OverviewMap.prototype.handleClick_ = function(event) {
|
||||
@@ -459,11 +460,11 @@ ol.control.OverviewMap.prototype.handleToggle_ = function() {
|
||||
if (!this.collapsed_ && !ovmap.isRendered()) {
|
||||
ovmap.updateSize();
|
||||
this.resetExtent_();
|
||||
goog.events.listenOnce(ovmap, ol.MapEventType.POSTRENDER,
|
||||
ol.events.listenOnce(ovmap, ol.MapEventType.POSTRENDER,
|
||||
function(event) {
|
||||
this.updateBox_();
|
||||
},
|
||||
false, this);
|
||||
this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ goog.provide('ol.control.Rotate');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.classlist');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
goog.require('ol.animation');
|
||||
goog.require('ol.control.Control');
|
||||
@@ -26,10 +26,9 @@ ol.control.Rotate = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
var className = options.className ?
|
||||
options.className : 'ol-rotate';
|
||||
var className = options.className !== undefined ? options.className : 'ol-rotate';
|
||||
|
||||
var label = options.label ? options.label : '\u21E7';
|
||||
var label = options.label !== undefined ? options.label : '\u21E7';
|
||||
|
||||
/**
|
||||
* @type {Element}
|
||||
@@ -37,7 +36,7 @@ ol.control.Rotate = function(opt_options) {
|
||||
*/
|
||||
this.label_ = null;
|
||||
|
||||
if (goog.isString(label)) {
|
||||
if (typeof label === 'string') {
|
||||
this.label_ = goog.dom.createDom('SPAN',
|
||||
'ol-compass', label);
|
||||
} else {
|
||||
@@ -53,8 +52,8 @@ ol.control.Rotate = function(opt_options) {
|
||||
'title': tipLabel
|
||||
}, this.label_);
|
||||
|
||||
goog.events.listen(button, goog.events.EventType.CLICK,
|
||||
ol.control.Rotate.prototype.handleClick_, false, this);
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
ol.control.Rotate.prototype.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
@@ -97,7 +96,7 @@ goog.inherits(ol.control.Rotate, ol.control.Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} event The event to handle
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.Rotate.prototype.handleClick_ = function(event) {
|
||||
|
||||
@@ -3,8 +3,7 @@ goog.provide('ol.control.ScaleLineProperty');
|
||||
goog.provide('ol.control.ScaleLineUnits');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('ol.events');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
@@ -55,21 +54,22 @@ ol.control.ScaleLine = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
var className = options.className ? options.className : 'ol-scale-line';
|
||||
var className = options.className !== undefined ? options.className : 'ol-scale-line';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Element}
|
||||
*/
|
||||
this.innerElement_ = goog.dom.createDom('DIV',
|
||||
className + '-inner');
|
||||
this.innerElement_ = document.createElement('DIV');
|
||||
this.innerElement_.className = className + '-inner';
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Element}
|
||||
*/
|
||||
this.element_ = goog.dom.createDom('DIV',
|
||||
className + ' ' + ol.css.CLASS_UNSELECTABLE, this.innerElement_);
|
||||
this.element_ = document.createElement('DIV');
|
||||
this.element_.className = className + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||
this.element_.appendChild(this.innerElement_);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -109,9 +109,9 @@ ol.control.ScaleLine = function(opt_options) {
|
||||
target: options.target
|
||||
});
|
||||
|
||||
goog.events.listen(
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.control.ScaleLineProperty.UNITS),
|
||||
this.handleUnitsChanged_, false, this);
|
||||
this.handleUnitsChanged_, this);
|
||||
|
||||
this.setUnits(/** @type {ol.control.ScaleLineUnits} */ (options.units) ||
|
||||
ol.control.ScaleLineUnits.METRIC);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.control.Zoom');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.animation');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
@@ -24,16 +24,16 @@ ol.control.Zoom = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
var className = options.className ? options.className : 'ol-zoom';
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoom';
|
||||
|
||||
var delta = options.delta ? options.delta : 1;
|
||||
var delta = options.delta !== undefined ? options.delta : 1;
|
||||
|
||||
var zoomInLabel = options.zoomInLabel ? options.zoomInLabel : '+';
|
||||
var zoomOutLabel = options.zoomOutLabel ? options.zoomOutLabel : '\u2212';
|
||||
var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+';
|
||||
var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212';
|
||||
|
||||
var zoomInTipLabel = options.zoomInTipLabel ?
|
||||
var zoomInTipLabel = options.zoomInTipLabel !== undefined ?
|
||||
options.zoomInTipLabel : 'Zoom in';
|
||||
var zoomOutTipLabel = options.zoomOutTipLabel ?
|
||||
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
|
||||
options.zoomOutTipLabel : 'Zoom out';
|
||||
|
||||
var inElement = goog.dom.createDom('BUTTON', {
|
||||
@@ -42,9 +42,9 @@ ol.control.Zoom = function(opt_options) {
|
||||
'title': zoomInTipLabel
|
||||
}, zoomInLabel);
|
||||
|
||||
goog.events.listen(inElement,
|
||||
goog.events.EventType.CLICK, goog.partial(
|
||||
ol.control.Zoom.prototype.handleClick_, delta), false, this);
|
||||
ol.events.listen(inElement,
|
||||
ol.events.EventType.CLICK, goog.partial(
|
||||
ol.control.Zoom.prototype.handleClick_, delta), this);
|
||||
|
||||
var outElement = goog.dom.createDom('BUTTON', {
|
||||
'class': className + '-out',
|
||||
@@ -52,14 +52,13 @@ ol.control.Zoom = function(opt_options) {
|
||||
'title': zoomOutTipLabel
|
||||
}, zoomOutLabel);
|
||||
|
||||
goog.events.listen(outElement,
|
||||
goog.events.EventType.CLICK, goog.partial(
|
||||
ol.control.Zoom.prototype.handleClick_, -delta), false, this);
|
||||
ol.events.listen(outElement,
|
||||
ol.events.EventType.CLICK, goog.partial(
|
||||
ol.control.Zoom.prototype.handleClick_, -delta), this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
var element = goog.dom.createDom('DIV', cssClasses, inElement,
|
||||
outElement);
|
||||
var element = goog.dom.createDom('DIV', cssClasses, inElement, outElement);
|
||||
|
||||
goog.base(this, {
|
||||
element: element,
|
||||
@@ -78,7 +77,7 @@ goog.inherits(ol.control.Zoom, ol.control.Control);
|
||||
|
||||
/**
|
||||
* @param {number} delta Zoom delta.
|
||||
* @param {goog.events.BrowserEvent} event The event to handle
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
|
||||
|
||||
@@ -4,14 +4,12 @@ goog.provide('ol.control.ZoomSlider');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.fx.DragEvent');
|
||||
goog.require('goog.fx.Dragger');
|
||||
goog.require('goog.fx.Dragger.EventType');
|
||||
goog.require('goog.math.Rect');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.pointer.PointerEventHandler');
|
||||
goog.require('ol.Size');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.animation');
|
||||
@@ -55,6 +53,30 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
*/
|
||||
this.direction_ = ol.control.ZoomSlider.direction.VERTICAL;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.dragging_;
|
||||
/**
|
||||
* @type {Array.<ol.events.Key>}
|
||||
*/
|
||||
this.dragListenerKeys_;
|
||||
|
||||
/**
|
||||
* @type {goog.math.Rect}
|
||||
*/
|
||||
this.limits_;
|
||||
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.previousX_;
|
||||
|
||||
/**
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.previousY_;
|
||||
|
||||
/**
|
||||
* The calculated thumb size (border box plus margins). Set when initSlider_
|
||||
* is called.
|
||||
@@ -76,7 +98,7 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 200;
|
||||
|
||||
var className = options.className ? options.className : 'ol-zoomslider';
|
||||
var className = options.className !== undefined ? options.className : 'ol-zoomslider';
|
||||
var thumbElement = goog.dom.createDom('BUTTON', {
|
||||
'type': 'button',
|
||||
'class': className + '-thumb ' + ol.css.CLASS_UNSELECTABLE
|
||||
@@ -85,24 +107,20 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
[className, ol.css.CLASS_UNSELECTABLE, ol.css.CLASS_CONTROL],
|
||||
thumbElement);
|
||||
|
||||
/**
|
||||
* @type {goog.fx.Dragger}
|
||||
* @private
|
||||
*/
|
||||
this.dragger_ = new goog.fx.Dragger(thumbElement);
|
||||
this.registerDisposable(this.dragger_);
|
||||
var dragger = new ol.pointer.PointerEventHandler(containerElement);
|
||||
this.registerDisposable(dragger);
|
||||
|
||||
goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.START,
|
||||
this.handleDraggerStart_, false, this);
|
||||
goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.DRAG,
|
||||
this.handleDraggerDrag_, false, this);
|
||||
goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.END,
|
||||
this.handleDraggerEnd_, false, this);
|
||||
ol.events.listen(dragger, ol.pointer.EventType.POINTERDOWN,
|
||||
this.handleDraggerStart_, this);
|
||||
ol.events.listen(dragger, ol.pointer.EventType.POINTERMOVE,
|
||||
this.handleDraggerDrag_, this);
|
||||
ol.events.listen(dragger, ol.pointer.EventType.POINTERUP,
|
||||
this.handleDraggerEnd_, this);
|
||||
|
||||
goog.events.listen(containerElement, goog.events.EventType.CLICK,
|
||||
this.handleContainerClick_, false, this);
|
||||
goog.events.listen(thumbElement, goog.events.EventType.CLICK,
|
||||
goog.events.Event.stopPropagation);
|
||||
ol.events.listen(containerElement, ol.events.EventType.CLICK,
|
||||
this.handleContainerClick_, this);
|
||||
ol.events.listen(thumbElement, ol.events.EventType.CLICK,
|
||||
ol.events.Event.stopPropagation);
|
||||
|
||||
var render = options.render ? options.render : ol.control.ZoomSlider.render;
|
||||
|
||||
@@ -167,7 +185,7 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
this.direction_ = ol.control.ZoomSlider.direction.VERTICAL;
|
||||
limits = new goog.math.Rect(0, 0, 0, height);
|
||||
}
|
||||
this.dragger_.setLimits(limits);
|
||||
this.limits_ = limits;
|
||||
this.sliderInitialized_ = true;
|
||||
};
|
||||
|
||||
@@ -196,10 +214,10 @@ ol.control.ZoomSlider.render = function(mapEvent) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} browserEvent The browser event to handle.
|
||||
* @param {Event} event The browser event to handle.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(browserEvent) {
|
||||
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
var currentResolution = view.getResolution();
|
||||
@@ -211,8 +229,8 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(browserEvent) {
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
var relativePosition = this.getRelativePosition_(
|
||||
browserEvent.offsetX - this.thumbSize_[0] / 2,
|
||||
browserEvent.offsetY - this.thumbSize_[1] / 2);
|
||||
event.offsetX - this.thumbSize_[0] / 2,
|
||||
event.offsetY - this.thumbSize_[1] / 2);
|
||||
var resolution = this.getResolutionForPosition_(relativePosition);
|
||||
view.setResolution(view.constrainResolution(resolution));
|
||||
};
|
||||
@@ -220,45 +238,79 @@ ol.control.ZoomSlider.prototype.handleContainerClick_ = function(browserEvent) {
|
||||
|
||||
/**
|
||||
* Handle dragger start events.
|
||||
* @param {goog.fx.DragEvent} event The drag event.
|
||||
* @param {ol.pointer.PointerEvent} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleDraggerStart_ = function(event) {
|
||||
this.getMap().getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||
if (!this.dragging_ &&
|
||||
event.originalEvent.target === this.element.firstElementChild) {
|
||||
this.getMap().getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||
this.previousX_ = event.clientX;
|
||||
this.previousY_ = event.clientY;
|
||||
this.dragging_ = true;
|
||||
|
||||
if (!this.dragListenerKeys_) {
|
||||
var drag = this.handleDraggerDrag_;
|
||||
var end = this.handleDraggerEnd_;
|
||||
this.dragListenerKeys_ = [
|
||||
ol.events.listen(document, ol.events.EventType.MOUSEMOVE, drag, this),
|
||||
ol.events.listen(document, ol.events.EventType.TOUCHMOVE, drag, this),
|
||||
ol.events.listen(document, ol.pointer.EventType.POINTERMOVE, drag, this),
|
||||
ol.events.listen(document, ol.events.EventType.MOUSEUP, end, this),
|
||||
ol.events.listen(document, ol.events.EventType.TOUCHEND, end, this),
|
||||
ol.events.listen(document, ol.pointer.EventType.POINTERUP, end, this)
|
||||
];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle dragger drag events.
|
||||
*
|
||||
* @param {goog.fx.DragEvent} event The drag event.
|
||||
* @param {ol.pointer.PointerEvent|Event} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
|
||||
var relativePosition = this.getRelativePosition_(event.left, event.top);
|
||||
this.currentResolution_ = this.getResolutionForPosition_(relativePosition);
|
||||
this.getMap().getView().setResolution(this.currentResolution_);
|
||||
if (this.dragging_) {
|
||||
var element = this.element.firstElementChild;
|
||||
var deltaX = event.clientX - this.previousX_ + parseInt(element.style.left, 10);
|
||||
var deltaY = event.clientY - this.previousY_ + parseInt(element.style.top, 10);
|
||||
var relativePosition = this.getRelativePosition_(deltaX, deltaY);
|
||||
this.currentResolution_ = this.getResolutionForPosition_(relativePosition);
|
||||
this.getMap().getView().setResolution(this.currentResolution_);
|
||||
this.setThumbPosition_(this.currentResolution_);
|
||||
this.previousX_ = event.clientX;
|
||||
this.previousY_ = event.clientY;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle dragger end events.
|
||||
* @param {goog.fx.DragEvent} event The drag event.
|
||||
* @param {ol.pointer.PointerEvent|Event} event The drag event.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||
goog.asserts.assert(this.currentResolution_,
|
||||
'this.currentResolution_ should be defined');
|
||||
map.beforeRender(ol.animation.zoom({
|
||||
resolution: this.currentResolution_,
|
||||
duration: this.duration_,
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
var resolution = view.constrainResolution(this.currentResolution_);
|
||||
view.setResolution(resolution);
|
||||
if (this.dragging_) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||
goog.asserts.assert(this.currentResolution_,
|
||||
'this.currentResolution_ should be defined');
|
||||
map.beforeRender(ol.animation.zoom({
|
||||
resolution: this.currentResolution_,
|
||||
duration: this.duration_,
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
var resolution = view.constrainResolution(this.currentResolution_);
|
||||
view.setResolution(resolution);
|
||||
this.dragging_ = false;
|
||||
this.previousX_ = undefined;
|
||||
this.previousY_ = undefined;
|
||||
this.dragListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||
this.dragListenerKeys_ = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -270,15 +322,14 @@ ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
|
||||
var position = this.getPositionForResolution_(res);
|
||||
var dragger = this.dragger_;
|
||||
var thumb = goog.dom.getFirstElementChild(this.element);
|
||||
|
||||
if (this.direction_ == ol.control.ZoomSlider.direction.HORIZONTAL) {
|
||||
var left = dragger.limits.left + dragger.limits.width * position;
|
||||
var left = this.limits_.left + this.limits_.width * position;
|
||||
goog.style.setPosition(thumb, left);
|
||||
} else {
|
||||
var top = dragger.limits.top + dragger.limits.height * position;
|
||||
goog.style.setPosition(thumb, dragger.limits.left, top);
|
||||
var top = this.limits_.top + this.limits_.height * position;
|
||||
goog.style.setPosition(thumb, this.limits_.left, top);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -294,7 +345,7 @@ ol.control.ZoomSlider.prototype.setThumbPosition_ = function(res) {
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.getRelativePosition_ = function(x, y) {
|
||||
var draggerLimits = this.dragger_.limits;
|
||||
var draggerLimits = this.limits_;
|
||||
var amount;
|
||||
if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) {
|
||||
amount = (x - draggerLimits.left) / draggerLimits.width;
|
||||
|
||||
@@ -2,8 +2,8 @@ goog.provide('ol.control.ZoomToExtent');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.control.Control');
|
||||
goog.require('ol.css');
|
||||
|
||||
@@ -27,19 +27,19 @@ ol.control.ZoomToExtent = function(opt_options) {
|
||||
*/
|
||||
this.extent_ = options.extent ? options.extent : null;
|
||||
|
||||
var className = options.className ? options.className :
|
||||
var className = options.className !== undefined ? options.className :
|
||||
'ol-zoom-extent';
|
||||
|
||||
var label = options.label ? options.label : 'E';
|
||||
var tipLabel = options.tipLabel ?
|
||||
var label = options.label !== undefined ? options.label : 'E';
|
||||
var tipLabel = options.tipLabel !== undefined ?
|
||||
options.tipLabel : 'Fit to extent';
|
||||
var button = goog.dom.createDom('BUTTON', {
|
||||
'type': 'button',
|
||||
'title': tipLabel
|
||||
}, label);
|
||||
|
||||
goog.events.listen(button, goog.events.EventType.CLICK,
|
||||
this.handleClick_, false, this);
|
||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||
this.handleClick_, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE + ' ' +
|
||||
ol.css.CLASS_CONTROL;
|
||||
@@ -54,7 +54,7 @@ goog.inherits(ol.control.ZoomToExtent, ol.control.Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} event The event to handle
|
||||
* @param {Event} event The event to handle
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
@@ -69,8 +69,7 @@ ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
var extent = !this.extent_ ?
|
||||
view.getProjection().getExtent() : this.extent_;
|
||||
var extent = !this.extent_ ? view.getProjection().getExtent() : this.extent_;
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(size, 'size should be defined');
|
||||
view.fit(extent, size);
|
||||
|
||||
@@ -124,14 +124,17 @@ ol.coordinate.createStringXY = function(opt_fractionDigits) {
|
||||
* @private
|
||||
* @param {number} degrees Degrees.
|
||||
* @param {string} hemispheres Hemispheres.
|
||||
* @param {number=} opt_fractionDigits The number of digits to include
|
||||
* after the decimal point. Default is `0`.
|
||||
* @return {string} String.
|
||||
*/
|
||||
ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres) {
|
||||
ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fractionDigits) {
|
||||
var normalizedDegrees = goog.math.modulo(degrees + 180, 360) - 180;
|
||||
var x = Math.abs(Math.round(3600 * normalizedDegrees));
|
||||
var x = Math.abs(3600 * normalizedDegrees);
|
||||
var dflPrecision = opt_fractionDigits || 0;
|
||||
return Math.floor(x / 3600) + '\u00b0 ' +
|
||||
goog.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
|
||||
goog.string.padNumber(Math.floor(x % 60), 2) + '\u2033 ' +
|
||||
goog.string.padNumber((x % 60), 2, dflPrecision) + '\u2033 ' +
|
||||
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
|
||||
};
|
||||
|
||||
@@ -284,20 +287,28 @@ ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) {
|
||||
* Format a geographic coordinate with the hemisphere, degrees, minutes, and
|
||||
* seconds.
|
||||
*
|
||||
* Example:
|
||||
* Example without specifying fractional digits:
|
||||
*
|
||||
* var coord = [7.85, 47.983333];
|
||||
* var out = ol.coordinate.toStringHDMS(coord);
|
||||
* // out is now '47° 59′ 0″ N 7° 51′ 0″ E'
|
||||
* // out is now '47° 58′ 60″ N 7° 50′ 60″ E'
|
||||
*
|
||||
* Example explicitly specifying 1 fractional digit:
|
||||
*
|
||||
* var coord = [7.85, 47.983333];
|
||||
* var out = ol.coordinate.toStringHDMS(coord, 1);
|
||||
* // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'
|
||||
*
|
||||
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
||||
* @param {number=} opt_fractionDigits The number of digits to include
|
||||
* after the decimal point. Default is `0`.
|
||||
* @return {string} Hemisphere, degrees, minutes and seconds.
|
||||
* @api stable
|
||||
*/
|
||||
ol.coordinate.toStringHDMS = function(coordinate) {
|
||||
ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
|
||||
if (coordinate) {
|
||||
return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS') + ' ' +
|
||||
ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW');
|
||||
return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS', opt_fractionDigits) + ' ' +
|
||||
ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW', opt_fractionDigits);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.DeviceOrientation');
|
||||
goog.provide('ol.DeviceOrientationProperty');
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.has');
|
||||
@@ -65,11 +65,11 @@ ol.DeviceOrientationProperty = {
|
||||
* equivalent properties in ol.DeviceOrientation are in radians for consistency
|
||||
* with all other uses of angles throughout OpenLayers.
|
||||
*
|
||||
* @see http://www.w3.org/TR/orientation-event/
|
||||
*
|
||||
* To get notified of device orientation changes, register a listener for the
|
||||
* generic `change` event on your `ol.DeviceOrientation` instance.
|
||||
*
|
||||
* @see {@link http://www.w3.org/TR/orientation-event/}
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {olx.DeviceOrientationOptions=} opt_options Options.
|
||||
@@ -83,13 +83,13 @@ ol.DeviceOrientation = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {goog.events.Key}
|
||||
* @type {?ol.events.Key}
|
||||
*/
|
||||
this.listenerKey_ = null;
|
||||
|
||||
goog.events.listen(this,
|
||||
ol.events.listen(this,
|
||||
ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING),
|
||||
this.handleTrackingChanged_, false, this);
|
||||
this.handleTrackingChanged_, this);
|
||||
|
||||
this.setTracking(options.tracking !== undefined ? options.tracking : false);
|
||||
|
||||
@@ -108,16 +108,15 @@ ol.DeviceOrientation.prototype.disposeInternal = function() {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {goog.events.BrowserEvent} browserEvent Event.
|
||||
* @param {Event} originalEvent Event.
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) {
|
||||
var event = /** @type {DeviceOrientationEvent} */
|
||||
(browserEvent.getBrowserEvent());
|
||||
ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
|
||||
var event = /** @type {DeviceOrientationEvent} */ (originalEvent);
|
||||
if (event.alpha !== null) {
|
||||
var alpha = ol.math.toRadians(event.alpha);
|
||||
this.set(ol.DeviceOrientationProperty.ALPHA, alpha);
|
||||
// event.absolute is undefined in iOS.
|
||||
if (goog.isBoolean(event.absolute) && event.absolute) {
|
||||
if (typeof event.absolute === 'boolean' && event.absolute) {
|
||||
this.set(ol.DeviceOrientationProperty.HEADING, alpha);
|
||||
} else if (goog.isNumber(event.webkitCompassHeading) &&
|
||||
event.webkitCompassAccuracy != -1) {
|
||||
@@ -208,10 +207,10 @@ ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
|
||||
if (ol.has.DEVICE_ORIENTATION) {
|
||||
var tracking = this.getTracking();
|
||||
if (tracking && !this.listenerKey_) {
|
||||
this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation',
|
||||
this.orientationChange_, false, this);
|
||||
} else if (!tracking && this.listenerKey_) {
|
||||
goog.events.unlistenByKey(this.listenerKey_);
|
||||
this.listenerKey_ = ol.events.listen(goog.global, 'deviceorientation',
|
||||
this.orientationChange_, this);
|
||||
} else if (!tracking && this.listenerKey_ !== null) {
|
||||
ol.events.unlistenByKey(this.listenerKey_);
|
||||
this.listenerKey_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
338
src/ol/events.js
Normal file
338
src/ol/events.js
Normal file
@@ -0,0 +1,338 @@
|
||||
goog.provide('ol.events');
|
||||
goog.provide('ol.events.EventType');
|
||||
goog.provide('ol.events.KeyCode');
|
||||
|
||||
goog.require('ol.object');
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @const
|
||||
*/
|
||||
ol.events.EventType = {
|
||||
/**
|
||||
* Generic change event.
|
||||
* @event ol.events.Event#change
|
||||
* @api
|
||||
*/
|
||||
CHANGE: 'change',
|
||||
|
||||
CLICK: 'click',
|
||||
DBLCLICK: 'dblclick',
|
||||
DRAGENTER: 'dragenter',
|
||||
DRAGOVER: 'dragover',
|
||||
DROP: 'drop',
|
||||
ERROR: 'error',
|
||||
KEYDOWN: 'keydown',
|
||||
KEYPRESS: 'keypress',
|
||||
LOAD: 'load',
|
||||
MOUSEDOWN: 'mousedown',
|
||||
MOUSEMOVE: 'mousemove',
|
||||
MOUSEOUT: 'mouseout',
|
||||
MOUSEUP: 'mouseup',
|
||||
MOUSEWHEEL: 'mousewheel',
|
||||
MSPOINTERDOWN: 'mspointerdown',
|
||||
RESIZE: 'resize',
|
||||
TOUCHSTART: 'touchstart',
|
||||
TOUCHMOVE: 'touchmove',
|
||||
TOUCHEND: 'touchend',
|
||||
WHEEL: 'wheel'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
* @const
|
||||
*/
|
||||
ol.events.KeyCode = {
|
||||
LEFT: 37,
|
||||
UP: 38,
|
||||
RIGHT: 39,
|
||||
DOWN: 40
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Property name on an event target for the listener map associated with the
|
||||
* event target.
|
||||
* @const {string}
|
||||
* @private
|
||||
*/
|
||||
ol.events.LISTENER_MAP_PROP_ = 'olm_' + ((Math.random() * 1e4) | 0);
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {EventTarget|ol.events.EventTarget|
|
||||
* {addEventListener: function(string, Function, boolean=),
|
||||
* removeEventListener: function(string, Function, boolean=),
|
||||
* dispatchEvent: function(string)}}
|
||||
*/
|
||||
ol.events.EventTargetLike;
|
||||
|
||||
|
||||
/**
|
||||
* Key to use with {@link ol.Observable#unByKey}.
|
||||
*
|
||||
* @typedef {ol.events.ListenerObjType}
|
||||
* @api
|
||||
*/
|
||||
ol.events.Key;
|
||||
|
||||
|
||||
/**
|
||||
* Listener function. This function is called with an event object as argument.
|
||||
* When the function returns `false`, event propagation will stop.
|
||||
*
|
||||
* @typedef {function(ol.events.Event)|function(ol.events.Event): boolean}
|
||||
* @api
|
||||
*/
|
||||
ol.events.ListenerFunctionType;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{bindTo: (Object|undefined),
|
||||
* boundListener: (ol.events.ListenerFunctionType|undefined),
|
||||
* callOnce: boolean,
|
||||
* deleteIndex: (number|undefined),
|
||||
* listener: ol.events.ListenerFunctionType,
|
||||
* target: (EventTarget|ol.events.EventTarget),
|
||||
* type: string}}
|
||||
*/
|
||||
ol.events.ListenerObjType;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.events.ListenerObjType} listenerObj Listener object.
|
||||
* @return {ol.events.ListenerFunctionType} Bound listener.
|
||||
*/
|
||||
ol.events.bindListener_ = function(listenerObj) {
|
||||
var boundListener = function(evt) {
|
||||
var listener = listenerObj.listener;
|
||||
var bindTo = listenerObj.bindTo || listenerObj.target;
|
||||
if (listenerObj.callOnce) {
|
||||
ol.events.unlistenByKey(listenerObj);
|
||||
}
|
||||
return listener.call(bindTo, evt);
|
||||
}
|
||||
listenerObj.boundListener = boundListener;
|
||||
return boundListener;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Finds the matching {@link ol.events.ListenerObjType} in the given listener
|
||||
* array.
|
||||
*
|
||||
* @param {!Array<!ol.events.ListenerObjType>} listeners Array of listeners.
|
||||
* @param {!Function} listener The listener function.
|
||||
* @param {Object=} opt_this The `this` value inside the listener.
|
||||
* @param {boolean=} opt_setDeleteIndex Set the deleteIndex on the matching
|
||||
* listener, for {@link ol.events.unlistenByKey}.
|
||||
* @return {ol.events.ListenerObjType|undefined} The matching listener object.
|
||||
* @private
|
||||
*/
|
||||
ol.events.findListener_ = function(listeners, listener, opt_this,
|
||||
opt_setDeleteIndex) {
|
||||
var listenerObj;
|
||||
for (var i = 0, ii = listeners.length; i < ii; ++i) {
|
||||
listenerObj = listeners[i];
|
||||
if (listenerObj.listener === listener &&
|
||||
listenerObj.bindTo === opt_this) {
|
||||
if (opt_setDeleteIndex) {
|
||||
listenerObj.deleteIndex = i;
|
||||
}
|
||||
return listenerObj;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.events.EventTargetLike} target Target.
|
||||
* @param {string} type Type.
|
||||
* @return {Array.<ol.events.ListenerObjType>|undefined} Listeners.
|
||||
*/
|
||||
ol.events.getListeners = function(target, type) {
|
||||
var listenerMap = target[ol.events.LISTENER_MAP_PROP_];
|
||||
return listenerMap ? listenerMap[type] : undefined;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the lookup of listeners. If one does not exist on the target, it is
|
||||
* created.
|
||||
* @param {ol.events.EventTargetLike} target Target.
|
||||
* @return {!Object.<string, Array.<ol.events.ListenerObjType>>} Map of
|
||||
* listeners by event type.
|
||||
* @private
|
||||
*/
|
||||
ol.events.getListenerMap_ = function(target) {
|
||||
var listenerMap = target[ol.events.LISTENER_MAP_PROP_];
|
||||
if (!listenerMap) {
|
||||
listenerMap = target[ol.events.LISTENER_MAP_PROP_] = {};
|
||||
}
|
||||
return listenerMap;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clean up all listener objects of the given type. All properties on the
|
||||
* listener objects will be removed, and if no listeners remain in the listener
|
||||
* map, it will be removed from the target.
|
||||
* @param {ol.events.EventTargetLike} target Target.
|
||||
* @param {string} type Type.
|
||||
* @private
|
||||
*/
|
||||
ol.events.removeListeners_ = function(target, type) {
|
||||
var listeners = ol.events.getListeners(target, type);
|
||||
if (listeners) {
|
||||
for (var i = 0, ii = listeners.length; i < ii; ++i) {
|
||||
target.removeEventListener(type, listeners[i].boundListener);
|
||||
ol.object.clear(listeners[i])
|
||||
}
|
||||
listeners.length = 0;
|
||||
var listenerMap = target[ol.events.LISTENER_MAP_PROP_];
|
||||
if (listenerMap) {
|
||||
delete listenerMap[type];
|
||||
if (Object.keys(listenerMap).length === 0) {
|
||||
delete target[ol.events.LISTENER_MAP_PROP_];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Registers an event listener on an event target. Inspired by
|
||||
* {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html}
|
||||
*
|
||||
* This function efficiently binds a `listener` to a `this` object, and returns
|
||||
* a key for use with {@link ol.events.unlistenByKey}.
|
||||
*
|
||||
* @param {ol.events.EventTargetLike} target Event target.
|
||||
* @param {string} type Event type.
|
||||
* @param {ol.events.ListenerFunctionType} listener Listener.
|
||||
* @param {Object=} opt_this Object referenced by the `this` keyword in the
|
||||
* listener. Default is the `target`.
|
||||
* @param {boolean=} opt_once If true, add the listener as one-off listener.
|
||||
* @return {ol.events.Key} Unique key for the listener.
|
||||
*/
|
||||
ol.events.listen = function(target, type, listener, opt_this, opt_once) {
|
||||
var listenerMap = ol.events.getListenerMap_(target);
|
||||
var listeners = listenerMap[type];
|
||||
if (!listeners) {
|
||||
listeners = listenerMap[type] = [];
|
||||
}
|
||||
var listenerObj = ol.events.findListener_(listeners, listener, opt_this,
|
||||
false);
|
||||
if (listenerObj) {
|
||||
if (!opt_once) {
|
||||
// Turn one-off listener into a permanent one.
|
||||
listenerObj.callOnce = false;
|
||||
}
|
||||
} else {
|
||||
listenerObj = /** @type {ol.events.ListenerObjType} */ ({
|
||||
bindTo: opt_this,
|
||||
callOnce: !!opt_once,
|
||||
listener: listener,
|
||||
target: target,
|
||||
type: type
|
||||
});
|
||||
target.addEventListener(type, ol.events.bindListener_(listenerObj));
|
||||
listeners.push(listenerObj);
|
||||
}
|
||||
|
||||
return listenerObj;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Registers a one-off event listener on an event target. Inspired by
|
||||
* {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html}
|
||||
*
|
||||
* This function efficiently binds a `listener` as self-unregistering listener
|
||||
* to a `this` object, and returns a key for use with
|
||||
* {@link ol.events.unlistenByKey} in case the listener needs to be unregistered
|
||||
* before it is called.
|
||||
*
|
||||
* When {@link ol.events.listen} is called with the same arguments after this
|
||||
* function, the self-unregistering listener will be turned into a permanent
|
||||
* listener.
|
||||
*
|
||||
* @param {ol.events.EventTargetLike} target Event target.
|
||||
* @param {string} type Event type.
|
||||
* @param {ol.events.ListenerFunctionType} listener Listener.
|
||||
* @param {Object=} opt_this Object referenced by the `this` keyword in the
|
||||
* listener. Default is the `target`.
|
||||
* @return {ol.events.Key} Key for unlistenByKey.
|
||||
*/
|
||||
ol.events.listenOnce = function(target, type, listener, opt_this) {
|
||||
return ol.events.listen(target, type, listener, opt_this, true);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Unregisters an event listener on an event target. Inspired by
|
||||
* {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html}
|
||||
*
|
||||
* To return a listener, this function needs to be called with the exact same
|
||||
* arguments that were used for a previous {@link ol.events.listen} call.
|
||||
*
|
||||
* @param {ol.events.EventTargetLike} target Event target.
|
||||
* @param {string} type Event type.
|
||||
* @param {ol.events.ListenerFunctionType} listener Listener.
|
||||
* @param {Object=} opt_this Object referenced by the `this` keyword in the
|
||||
* listener. Default is the `target`.
|
||||
*/
|
||||
ol.events.unlisten = function(target, type, listener, opt_this) {
|
||||
var listeners = ol.events.getListeners(target, type);
|
||||
if (listeners) {
|
||||
var listenerObj = ol.events.findListener_(listeners, listener, opt_this,
|
||||
true);
|
||||
if (listenerObj) {
|
||||
ol.events.unlistenByKey(listenerObj);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Unregisters event listeners on an event target. Inspired by
|
||||
* {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html}
|
||||
*
|
||||
* The argument passed to this function is the key returned from
|
||||
* {@link ol.events.listen} or {@link ol.events.listenOnce}.
|
||||
*
|
||||
* @param {ol.events.Key} key The key.
|
||||
*/
|
||||
ol.events.unlistenByKey = function(key) {
|
||||
if (key && key.target) {
|
||||
key.target.removeEventListener(key.type, key.boundListener);
|
||||
var listeners = ol.events.getListeners(key.target, key.type);
|
||||
if (listeners) {
|
||||
var i = 'deleteIndex' in key ? key.deleteIndex : listeners.indexOf(key);
|
||||
if (i !== -1) {
|
||||
listeners.splice(i, 1);
|
||||
}
|
||||
if (listeners.length === 0) {
|
||||
ol.events.removeListeners_(key.target, key.type);
|
||||
}
|
||||
}
|
||||
ol.object.clear(key);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Unregisters all event listeners on an event target. Inspired by
|
||||
* {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html}
|
||||
*
|
||||
* @param {ol.events.EventTargetLike} target Target.
|
||||
*/
|
||||
ol.events.unlistenAll = function(target) {
|
||||
var listenerMap = ol.events.getListenerMap_(target);
|
||||
for (var type in listenerMap) {
|
||||
ol.events.removeListeners_(target, type);
|
||||
}
|
||||
};
|
||||
@@ -26,11 +26,11 @@ ol.events.ConditionType;
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
!browserEvent.shiftKey);
|
||||
originalEvent.altKey &&
|
||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||
!originalEvent.shiftKey);
|
||||
};
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
browserEvent.shiftKey);
|
||||
originalEvent.altKey &&
|
||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||
originalEvent.shiftKey);
|
||||
};
|
||||
|
||||
|
||||
@@ -74,6 +74,22 @@ ol.events.condition.click = function(mapBrowserEvent) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return `true` if the event has an "action"-producing mouse button.
|
||||
*
|
||||
* By definition, this includes left-click on windows/linux, and left-click
|
||||
* without the ctrl key on Macs.
|
||||
*
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} The result.
|
||||
*/
|
||||
ol.events.condition.mouseActionButton = function(mapBrowserEvent) {
|
||||
var originalEvent = mapBrowserEvent.originalEvent;
|
||||
return originalEvent.button == 0 &&
|
||||
!(goog.userAgent.WEBKIT && ol.has.MAC && originalEvent.ctrlKey);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Return always false.
|
||||
*
|
||||
@@ -131,11 +147,11 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
!browserEvent.shiftKey);
|
||||
!originalEvent.altKey &&
|
||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||
!originalEvent.shiftKey);
|
||||
};
|
||||
|
||||
|
||||
@@ -149,11 +165,11 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!browserEvent.altKey &&
|
||||
browserEvent.platformModifierKey &&
|
||||
!browserEvent.shiftKey);
|
||||
!originalEvent.altKey &&
|
||||
(ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
|
||||
!originalEvent.shiftKey);
|
||||
};
|
||||
|
||||
|
||||
@@ -166,11 +182,11 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var originalEvent = mapBrowserEvent.originalEvent;
|
||||
return (
|
||||
!browserEvent.altKey &&
|
||||
!browserEvent.platformModifierKey &&
|
||||
browserEvent.shiftKey);
|
||||
!originalEvent.altKey &&
|
||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||
originalEvent.shiftKey);
|
||||
};
|
||||
|
||||
|
||||
@@ -183,7 +199,7 @@ ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
|
||||
* @api
|
||||
*/
|
||||
ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
|
||||
var target = mapBrowserEvent.browserEvent.target;
|
||||
var target = mapBrowserEvent.originalEvent.target;
|
||||
goog.asserts.assertInstanceof(target, Element,
|
||||
'target should be an Element');
|
||||
var tagName = target.tagName;
|
||||
|
||||
60
src/ol/events/event.js
Normal file
60
src/ol/events/event.js
Normal file
@@ -0,0 +1,60 @@
|
||||
goog.provide('ol.events.Event');
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Stripped down implementation of the W3C DOM Level 2 Event interface.
|
||||
* @see {@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface}
|
||||
*
|
||||
* This implementation only provides `type` and `target` properties, and
|
||||
* `stopPropagation` and `preventDefault` methods. It is meant as base class
|
||||
* for higher level events defined in the library, and works with
|
||||
* {@link ol.events.EventTarget}.
|
||||
*
|
||||
* @constructor
|
||||
* @param {string} type Type.
|
||||
* @param {Object=} opt_target Target.
|
||||
*/
|
||||
ol.events.Event = function(type, opt_target) {
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.propagationStopped;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
this.type = type;
|
||||
|
||||
/**
|
||||
* @type {Object|undefined}
|
||||
*/
|
||||
this.target = opt_target;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stop event propagation
|
||||
*/
|
||||
ol.events.Event.prototype.preventDefault =
|
||||
ol.events.Event.prototype.stopPropagation = function() {
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event|ol.events.Event} evt Event
|
||||
*/
|
||||
ol.events.Event.stopPropagation = function(evt) {
|
||||
evt.stopPropagation();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Event|ol.events.Event} evt Event
|
||||
*/
|
||||
ol.events.Event.preventDefault = function(evt) {
|
||||
evt.preventDefault();
|
||||
};
|
||||
123
src/ol/events/eventtarget.js
Normal file
123
src/ol/events/eventtarget.js
Normal file
@@ -0,0 +1,123 @@
|
||||
goog.provide('ol.events.EventTarget');
|
||||
|
||||
goog.require('goog.Disposable');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* A simplified implementation of the W3C DOM Level 2 EventTarget interface.
|
||||
* @see {@link https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget}
|
||||
*
|
||||
* There are two important simplifications compared to the specification:
|
||||
*
|
||||
* 1. The handling of `useCapture` in `addEventListener` and
|
||||
* `removeEventListener`. There is no real capture model.
|
||||
* 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.
|
||||
* There is no event target hierarchy. When a listener calls
|
||||
* `stopPropagation` or `preventDefault` on an event object, it means that no
|
||||
* more listeners after this one will be called. Same as when the listener
|
||||
* returns false.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {goog.Disposable}
|
||||
*/
|
||||
ol.events.EventTarget = function() {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object.<string, Array.<ol.events.ListenerFunctionType>>}
|
||||
*/
|
||||
this.listeners_ = {};
|
||||
|
||||
};
|
||||
goog.inherits(ol.events.EventTarget, goog.Disposable);
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {ol.events.ListenerFunctionType} listener Listener.
|
||||
*/
|
||||
ol.events.EventTarget.prototype.addEventListener = function(type, listener) {
|
||||
var listeners = this.listeners_[type];
|
||||
if (!listeners) {
|
||||
listeners = this.listeners_[type] = [];
|
||||
}
|
||||
if (listeners.indexOf(listener) === -1) {
|
||||
listeners.unshift(listener);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {{type: string,
|
||||
* target: (EventTarget|ol.events.EventTarget|undefined)}|ol.events.Event|
|
||||
* string} event Event or event type.
|
||||
* @return {boolean|undefined} `false` if anyone called preventDefault on the
|
||||
* event object or if any of the listeners returned false.
|
||||
*/
|
||||
ol.events.EventTarget.prototype.dispatchEvent = function(event) {
|
||||
var evt = typeof event === 'string' ? new ol.events.Event(event) : event;
|
||||
var type = evt.type;
|
||||
evt.target = this;
|
||||
var listeners = this.listeners_[type];
|
||||
if (listeners) {
|
||||
for (var i = listeners.length - 1; i >= 0; --i) {
|
||||
if (listeners[i].call(this, evt) === false ||
|
||||
evt.propagationStopped) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.events.EventTarget.prototype.disposeInternal = function() {
|
||||
ol.events.unlistenAll(this);
|
||||
goog.base(this, 'disposeInternal');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the listeners for a specified event type. Listeners are returned in the
|
||||
* opposite order that they will be called in.
|
||||
*
|
||||
* @param {string} type Type.
|
||||
* @return {Array.<ol.events.ListenerFunctionType>} Listeners.
|
||||
*/
|
||||
ol.events.EventTarget.prototype.getListeners = function(type) {
|
||||
return this.listeners_[type];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string=} opt_type Type. If not provided,
|
||||
* `true` will be returned if this EventTarget has any listeners.
|
||||
* @return {boolean} Has listeners.
|
||||
*/
|
||||
ol.events.EventTarget.prototype.hasListener = function(opt_type) {
|
||||
return opt_type ?
|
||||
opt_type in this.listeners_ :
|
||||
Object.keys(this.listeners_).length > 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} type Type.
|
||||
* @param {ol.events.ListenerFunctionType} listener Listener.
|
||||
*/
|
||||
ol.events.EventTarget.prototype.removeEventListener = function(type, listener) {
|
||||
var listeners = this.listeners_[type];
|
||||
if (listeners) {
|
||||
var index = listeners.indexOf(listener);
|
||||
listeners.splice(index, 1);
|
||||
if (listeners.length === 0) {
|
||||
delete this.listeners_[type];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -575,18 +575,24 @@ ol.extent.getForViewAndSize = function(center, resolution, rotation, size, opt_e
|
||||
var dy = resolution * size[1] / 2;
|
||||
var cosRotation = Math.cos(rotation);
|
||||
var sinRotation = Math.sin(rotation);
|
||||
/** @type {Array.<number>} */
|
||||
var xs = [-dx, -dx, dx, dx];
|
||||
/** @type {Array.<number>} */
|
||||
var ys = [-dy, dy, -dy, dy];
|
||||
var i, x, y;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
x = xs[i];
|
||||
y = ys[i];
|
||||
xs[i] = center[0] + x * cosRotation - y * sinRotation;
|
||||
ys[i] = center[1] + x * sinRotation + y * cosRotation;
|
||||
}
|
||||
return ol.extent.boundingExtentXYs_(xs, ys, opt_extent);
|
||||
var xCos = dx * cosRotation;
|
||||
var xSin = dx * sinRotation;
|
||||
var yCos = dy * cosRotation;
|
||||
var ySin = dy * sinRotation;
|
||||
var x = center[0];
|
||||
var y = center[1];
|
||||
var x0 = x - xCos + ySin;
|
||||
var x1 = x - xCos - ySin;
|
||||
var x2 = x + xCos - ySin;
|
||||
var x3 = x + xCos + ySin;
|
||||
var y0 = y - xSin - yCos;
|
||||
var y1 = y - xSin + yCos;
|
||||
var y2 = y + xSin + yCos;
|
||||
var y3 = y + xSin - yCos;
|
||||
return ol.extent.createOrUpdate(
|
||||
Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3),
|
||||
Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3),
|
||||
opt_extent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ goog.provide('ol.Feature');
|
||||
goog.provide('ol.FeatureStyleFunction');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.geom.Geometry');
|
||||
@@ -87,24 +87,24 @@ ol.Feature = function(opt_geometryOrProperties) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {goog.events.Key}
|
||||
* @type {?ol.events.Key}
|
||||
*/
|
||||
this.geometryChangeKey_ = null;
|
||||
|
||||
goog.events.listen(
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(this.geometryName_),
|
||||
this.handleGeometryChanged_, false, this);
|
||||
this.handleGeometryChanged_, this);
|
||||
|
||||
if (opt_geometryOrProperties !== undefined) {
|
||||
if (opt_geometryOrProperties instanceof ol.geom.Geometry ||
|
||||
!opt_geometryOrProperties) {
|
||||
var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrProperties);
|
||||
var geometry = opt_geometryOrProperties;
|
||||
this.setGeometry(geometry);
|
||||
} else {
|
||||
goog.asserts.assert(goog.isObject(opt_geometryOrProperties),
|
||||
'opt_geometryOrProperties should be an Object');
|
||||
var properties = /** @type {Object.<string, *>} */
|
||||
(opt_geometryOrProperties);
|
||||
/** @type {Object.<string, *>} */
|
||||
var properties = opt_geometryOrProperties;
|
||||
this.setProperties(properties);
|
||||
}
|
||||
}
|
||||
@@ -209,13 +209,13 @@ ol.Feature.prototype.handleGeometryChange_ = function() {
|
||||
*/
|
||||
ol.Feature.prototype.handleGeometryChanged_ = function() {
|
||||
if (this.geometryChangeKey_) {
|
||||
goog.events.unlistenByKey(this.geometryChangeKey_);
|
||||
ol.events.unlistenByKey(this.geometryChangeKey_);
|
||||
this.geometryChangeKey_ = null;
|
||||
}
|
||||
var geometry = this.getGeometry();
|
||||
if (geometry) {
|
||||
this.geometryChangeKey_ = goog.events.listen(geometry,
|
||||
goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this);
|
||||
this.geometryChangeKey_ = ol.events.listen(geometry,
|
||||
ol.events.EventType.CHANGE, this.handleGeometryChange_, this);
|
||||
}
|
||||
this.changed();
|
||||
};
|
||||
@@ -273,13 +273,13 @@ ol.Feature.prototype.setId = function(id) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.Feature.prototype.setGeometryName = function(name) {
|
||||
goog.events.unlisten(
|
||||
ol.events.unlisten(
|
||||
this, ol.Object.getChangeEventType(this.geometryName_),
|
||||
this.handleGeometryChanged_, false, this);
|
||||
this.handleGeometryChanged_, this);
|
||||
this.geometryName_ = name;
|
||||
goog.events.listen(
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(this.geometryName_),
|
||||
this.handleGeometryChanged_, false, this);
|
||||
this.handleGeometryChanged_, this);
|
||||
this.handleGeometryChanged_();
|
||||
};
|
||||
|
||||
|
||||
@@ -3,16 +3,11 @@ goog.provide('ol.FeatureUrlFunction');
|
||||
goog.provide('ol.featureloader');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.net.EventType');
|
||||
goog.require('goog.net.XhrIo');
|
||||
goog.require('goog.net.XhrIo.ResponseType');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.VectorTile');
|
||||
goog.require('ol.format.FormatType');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.proj.Projection');
|
||||
goog.require('ol.proj.Units');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
@@ -68,59 +63,47 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
|
||||
* @this {ol.source.Vector|ol.VectorTile}
|
||||
*/
|
||||
function(extent, resolution, projection) {
|
||||
var xhrIo = new goog.net.XhrIo();
|
||||
xhrIo.setResponseType(
|
||||
format.getType() == ol.format.FormatType.ARRAY_BUFFER ?
|
||||
goog.net.XhrIo.ResponseType.ARRAY_BUFFER :
|
||||
goog.net.XhrIo.ResponseType.TEXT);
|
||||
goog.events.listen(xhrIo, goog.net.EventType.COMPLETE,
|
||||
/**
|
||||
* @param {Event} event Event.
|
||||
* @private
|
||||
* @this {ol.source.Vector}
|
||||
*/
|
||||
function(event) {
|
||||
var xhrIo = event.target;
|
||||
goog.asserts.assertInstanceof(xhrIo, goog.net.XhrIo,
|
||||
'event.target/xhrIo is an instance of goog.net.XhrIo');
|
||||
if (xhrIo.isSuccess()) {
|
||||
var type = format.getType();
|
||||
/** @type {Document|Node|Object|string|undefined} */
|
||||
var source;
|
||||
if (type == ol.format.FormatType.JSON) {
|
||||
source = xhrIo.getResponseText();
|
||||
} else if (type == ol.format.FormatType.TEXT) {
|
||||
source = xhrIo.getResponseText();
|
||||
} else if (type == ol.format.FormatType.XML) {
|
||||
if (!goog.userAgent.IE) {
|
||||
source = xhrIo.getResponseXml();
|
||||
}
|
||||
if (!source) {
|
||||
source = ol.xml.parse(xhrIo.getResponseText());
|
||||
}
|
||||
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
|
||||
source = xhrIo.getResponse();
|
||||
} else {
|
||||
goog.asserts.fail('unexpected format type');
|
||||
}
|
||||
if (source) {
|
||||
success.call(this, format.readFeatures(source,
|
||||
{featureProjection: projection}),
|
||||
format.readProjection(source));
|
||||
} else {
|
||||
goog.asserts.fail('undefined or null source');
|
||||
}
|
||||
} else {
|
||||
failure.call(this);
|
||||
}
|
||||
goog.dispose(xhrIo);
|
||||
}, false, this);
|
||||
if (goog.isFunction(url)) {
|
||||
xhrIo.send(url(extent, resolution, projection));
|
||||
} else {
|
||||
xhrIo.send(url);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET',
|
||||
goog.isFunction(url) ? url(extent, resolution, projection) : url,
|
||||
true);
|
||||
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
|
||||
xhr.responseType = 'arraybuffer';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Event} event Event.
|
||||
* @private
|
||||
*/
|
||||
xhr.onload = function(event) {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
var type = format.getType();
|
||||
/** @type {Document|Node|Object|string|undefined} */
|
||||
var source;
|
||||
if (type == ol.format.FormatType.JSON ||
|
||||
type == ol.format.FormatType.TEXT) {
|
||||
source = xhr.responseText;
|
||||
} else if (type == ol.format.FormatType.XML) {
|
||||
source = xhr.responseXML;
|
||||
if (!source) {
|
||||
source = ol.xml.parse(xhr.responseText);
|
||||
}
|
||||
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
|
||||
source = /** @type {ArrayBuffer} */ (xhr.response);
|
||||
} else {
|
||||
goog.asserts.fail('unexpected format type');
|
||||
}
|
||||
if (source) {
|
||||
success.call(this, format.readFeatures(source,
|
||||
{featureProjection: projection}),
|
||||
format.readProjection(source));
|
||||
} else {
|
||||
goog.asserts.fail('undefined or null source');
|
||||
}
|
||||
} else {
|
||||
failure.call(this);
|
||||
}
|
||||
}.bind(this);
|
||||
xhr.send();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -142,14 +125,7 @@ ol.featureloader.tile = function(url, format) {
|
||||
* @this {ol.VectorTile}
|
||||
*/
|
||||
function(features, dataProjection) {
|
||||
var dataUnits = dataProjection.getUnits();
|
||||
if (dataUnits === ol.proj.Units.TILE_PIXELS) {
|
||||
var projection = new ol.proj.Projection({
|
||||
code: this.getProjection().getCode(),
|
||||
units: dataUnits
|
||||
});
|
||||
this.setProjection(projection);
|
||||
}
|
||||
this.setProjection(dataProjection);
|
||||
this.setFeatures(features);
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
goog.provide('ol.format.EsriJSON');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.JSONFeature');
|
||||
@@ -17,6 +16,7 @@ goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.geom.flat.orient');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
|
||||
} else if (object.rings) {
|
||||
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
|
||||
var rings = ol.format.EsriJSON.convertRings_(object.rings, layout);
|
||||
object = /** @type {EsriJSONGeometry} */(goog.object.clone(object));
|
||||
object = /** @type {EsriJSONGeometry} */(ol.object.assign({}, object));
|
||||
if (rings.length === 1) {
|
||||
type = ol.geom.GeometryType.POLYGON;
|
||||
object.rings = rings[0];
|
||||
@@ -104,7 +104,7 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
|
||||
var holes = [];
|
||||
var i, ii;
|
||||
for (i = 0, ii = rings.length; i < ii; ++i) {
|
||||
var flatRing = goog.array.flatten(rings[i]);
|
||||
var flatRing = ol.array.flatten(rings[i]);
|
||||
// is this ring an outer ring? is it clockwise?
|
||||
var clockwise = ol.geom.flat.orient.linearRingIsClockwise(flatRing, 0,
|
||||
flatRing.length, layout.length);
|
||||
@@ -651,7 +651,7 @@ ol.format.EsriJSON.prototype.writeFeatureObject = function(
|
||||
}
|
||||
var properties = feature.getProperties();
|
||||
delete properties[feature.getGeometryName()];
|
||||
if (!goog.object.isEmpty(properties)) {
|
||||
if (!ol.object.isEmpty(properties)) {
|
||||
object['attributes'] = properties;
|
||||
} else {
|
||||
object['attributes'] = {};
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
goog.provide('ol.format.GeoJSON');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.JSONFeature');
|
||||
@@ -15,6 +14,7 @@ goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(
|
||||
}
|
||||
var properties = feature.getProperties();
|
||||
delete properties[feature.getGeometryName()];
|
||||
if (!goog.object.isEmpty(properties)) {
|
||||
if (!ol.object.isEmpty(properties)) {
|
||||
object.properties = properties;
|
||||
} else {
|
||||
object.properties = null;
|
||||
|
||||
@@ -105,8 +105,8 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Box', 'localName should be Box');
|
||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = ol.xml.pushParseAndPop([null],
|
||||
this.BOX_PARSERS_, node, objectStack, this);
|
||||
return ol.extent.createOrUpdate(flatCoordinates[1][0],
|
||||
flatCoordinates[1][1], flatCoordinates[1][3],
|
||||
@@ -124,8 +124,8 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
||||
'localName should be innerBoundaryIs');
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -149,8 +149,8 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
||||
'localName should be outerBoundaryIs');
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
goog.provide('ol.format.GML');
|
||||
goog.provide('ol.format.GML3');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.format.Feature');
|
||||
@@ -19,6 +18,7 @@ goog.require('ol.geom.MultiLineString');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
@@ -98,8 +98,8 @@ ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'MultiCurve',
|
||||
'localName should be MultiCurve');
|
||||
var lineStrings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
||||
/** @type {Array.<ol.geom.LineString>} */
|
||||
var lineStrings = ol.xml.pushParseAndPop([],
|
||||
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
var multiLineString = new ol.geom.MultiLineString(null);
|
||||
@@ -122,8 +122,8 @@ ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'MultiSurface',
|
||||
'localName should be MultiSurface');
|
||||
var polygons = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.Polygon>} */ ([]),
|
||||
/** @type {Array.<ol.geom.Polygon>} */
|
||||
var polygons = ol.xml.pushParseAndPop([],
|
||||
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||
@@ -177,8 +177,7 @@ ol.format.GML3.prototype.readPatch_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'patches',
|
||||
'localName should be patches');
|
||||
return ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
return ol.xml.pushParseAndPop([null],
|
||||
this.PATCHES_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -194,8 +193,7 @@ ol.format.GML3.prototype.readSegment_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'segments',
|
||||
'localName should be segments');
|
||||
return ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
return ol.xml.pushParseAndPop([null],
|
||||
this.SEGMENTS_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -211,8 +209,7 @@ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
||||
'npde.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'PolygonPatch',
|
||||
'localName should be PolygonPatch');
|
||||
return ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
return ol.xml.pushParseAndPop([null],
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -228,8 +225,7 @@ ol.format.GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'LineStringSegment',
|
||||
'localName should be LineStringSegment');
|
||||
return ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
return ol.xml.pushParseAndPop([null],
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
|
||||
node, objectStack, this);
|
||||
};
|
||||
@@ -245,8 +241,8 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'interior',
|
||||
'localName should be interior');
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -270,8 +266,8 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'exterior',
|
||||
'localName should be exterior');
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -296,8 +292,8 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Surface',
|
||||
'localName should be Surface');
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
var flatLinearRings = ol.xml.pushParseAndPop([null],
|
||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
@@ -305,7 +301,7 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
|
||||
goog.array.extend(flatCoordinates, flatLinearRings[i]);
|
||||
ol.array.extend(flatCoordinates, flatLinearRings[i]);
|
||||
ends.push(flatCoordinates.length);
|
||||
}
|
||||
polygon.setFlatCoordinates(
|
||||
@@ -327,8 +323,8 @@ ol.format.GML3.prototype.readCurve_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Curve', 'localName should be Curve');
|
||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = ol.xml.pushParseAndPop([null],
|
||||
this.CURVE_PARSERS_, node, objectStack, this);
|
||||
if (flatCoordinates) {
|
||||
var lineString = new ol.geom.LineString(null);
|
||||
@@ -351,8 +347,8 @@ ol.format.GML3.prototype.readEnvelope_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Envelope',
|
||||
'localName should be Envelope');
|
||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = ol.xml.pushParseAndPop([null],
|
||||
this.ENVELOPE_PARSERS_, node, objectStack, this);
|
||||
return ol.extent.createOrUpdate(flatCoordinates[1][0],
|
||||
flatCoordinates[1][1], flatCoordinates[2][0],
|
||||
@@ -1007,7 +1003,7 @@ ol.format.GML3.prototype.writeCurveSegments_ = function(node, line, objectStack)
|
||||
ol.format.GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var item = goog.object.clone(context);
|
||||
var item = ol.object.assign({}, context);
|
||||
item.node = node;
|
||||
var value;
|
||||
if (goog.isArray(geometry)) {
|
||||
@@ -1068,7 +1064,7 @@ ol.format.GML3.prototype.writeFeatureElement = function(node, feature, objectSta
|
||||
}
|
||||
}
|
||||
}
|
||||
var item = goog.object.clone(context);
|
||||
var item = ol.object.assign({}, context);
|
||||
item.node = node;
|
||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
|
||||
(item), context.serializers,
|
||||
@@ -1093,7 +1089,7 @@ ol.format.GML3.prototype.writeFeatureMembers_ = function(node, features, objectS
|
||||
serializers[featureNS] = {};
|
||||
serializers[featureNS][featureType] = ol.xml.makeChildAppender(
|
||||
this.writeFeatureElement, this);
|
||||
var item = goog.object.clone(context);
|
||||
var item = ol.object.assign({}, context);
|
||||
item.node = node;
|
||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
|
||||
(item),
|
||||
@@ -1273,7 +1269,7 @@ ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
|
||||
curve: this.curve_, surface: this.surface_,
|
||||
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
|
||||
if (opt_options) {
|
||||
goog.object.extend(context, opt_options);
|
||||
ol.object.assign(context, opt_options);
|
||||
}
|
||||
this.writeGeometryElement(geom, geometry, [context]);
|
||||
return geom;
|
||||
@@ -1316,7 +1312,7 @@ ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) {
|
||||
featureType: this.featureType
|
||||
};
|
||||
if (opt_options) {
|
||||
goog.object.extend(context, opt_options);
|
||||
ol.object.assign(context, opt_options);
|
||||
}
|
||||
this.writeFeatureMembers_(node, features, [context]);
|
||||
return node;
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
// envelopes/extents, only geometries!
|
||||
goog.provide('ol.format.GMLBase');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.string');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.XMLFeature');
|
||||
@@ -20,6 +18,7 @@ goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
@@ -89,6 +88,21 @@ goog.inherits(ol.format.GMLBase, ol.format.XMLFeature);
|
||||
ol.format.GMLBase.GMLNS = 'http://www.opengis.net/gml';
|
||||
|
||||
|
||||
/**
|
||||
* A regular expression that matches if a string only contains whitespace
|
||||
* characters. It will e.g. match `''`, `' '`, `'\n'` etc. The non-breaking
|
||||
* space (0xa0) is explicitly included as IE doesn't include it in its
|
||||
* definition of `\s`.
|
||||
*
|
||||
* Information from `goog.string.isEmptyOrWhitespace`: https://github.com/google/closure-library/blob/e877b1e/closure/goog/string/string.js#L156-L160
|
||||
*
|
||||
* @const
|
||||
* @type {RegExp}
|
||||
* @private
|
||||
*/
|
||||
ol.format.GMLBase.ONLY_WHITESPACE_RE_ = /^[\s\xa0]*$/;
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
@@ -122,14 +136,19 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
if (child.nodeType === 1) {
|
||||
var ft = child.nodeName.split(':').pop();
|
||||
if (featureType.indexOf(ft) === -1) {
|
||||
var key;
|
||||
if (!goog.object.contains(featureNS, child.namespaceURI)) {
|
||||
key = prefix + goog.object.getCount(featureNS);
|
||||
featureNS[key] = child.namespaceURI;
|
||||
} else {
|
||||
key = goog.object.findKey(featureNS, function(value) {
|
||||
return value === child.namespaceURI;
|
||||
});
|
||||
var key = '';
|
||||
var count = 0;
|
||||
var uri = child.namespaceURI;
|
||||
for (var candidate in featureNS) {
|
||||
if (featureNS[candidate] === uri) {
|
||||
key = candidate;
|
||||
break;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
if (!key) {
|
||||
key = prefix + count;
|
||||
featureNS[key] = uri;
|
||||
}
|
||||
featureType.push(key + ':' + ft);
|
||||
}
|
||||
@@ -138,7 +157,7 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
context['featureType'] = featureType;
|
||||
context['featureNS'] = featureNS;
|
||||
}
|
||||
if (goog.isString(featureNS)) {
|
||||
if (typeof featureNS === 'string') {
|
||||
var ns = featureNS;
|
||||
featureNS = {};
|
||||
featureNS[defaultPrefix] = ns;
|
||||
@@ -177,7 +196,8 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
||||
var context = objectStack[0];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
||||
var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null),
|
||||
/** @type {ol.geom.Geometry} */
|
||||
var geometry = ol.xml.pushParseAndPop(null,
|
||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||
if (geometry) {
|
||||
return /** @type {ol.geom.Geometry} */ (
|
||||
@@ -207,7 +227,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
(n.childNodes.length === 1 &&
|
||||
(n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) {
|
||||
var value = ol.xml.getAllTextContent(n, false);
|
||||
if (goog.string.isEmpty(value)) {
|
||||
if (ol.format.GMLBase.ONLY_WHITESPACE_RE_.test(value)) {
|
||||
value = undefined;
|
||||
}
|
||||
values[localName] = value;
|
||||
@@ -261,8 +281,8 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'MultiPoint',
|
||||
'localName should be MultiPoint');
|
||||
var coordinates = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([]),
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
var coordinates = ol.xml.pushParseAndPop([],
|
||||
this.MULTIPOINT_PARSERS_, node, objectStack, this);
|
||||
if (coordinates) {
|
||||
return new ol.geom.MultiPoint(coordinates);
|
||||
@@ -282,8 +302,8 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'MultiLineString',
|
||||
'localName should be MultiLineString');
|
||||
var lineStrings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
||||
/** @type {Array.<ol.geom.LineString>} */
|
||||
var lineStrings = ol.xml.pushParseAndPop([],
|
||||
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
var multiLineString = new ol.geom.MultiLineString(null);
|
||||
@@ -305,8 +325,8 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'MultiPolygon',
|
||||
'localName should be MultiPolygon');
|
||||
var polygons = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.Polygon>} */ ([]),
|
||||
/** @type {Array.<ol.geom.Polygon>} */
|
||||
var polygons = ol.xml.pushParseAndPop([],
|
||||
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||
@@ -399,7 +419,7 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'LinearRing',
|
||||
'localName should be LinearRing');
|
||||
var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null),
|
||||
var ring = ol.xml.pushParseAndPop(null,
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||
objectStack, this);
|
||||
if (ring) {
|
||||
@@ -442,8 +462,8 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Polygon',
|
||||
'localName should be Polygon');
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
var flatLinearRings = ol.xml.pushParseAndPop([null],
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
@@ -451,7 +471,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
|
||||
goog.array.extend(flatCoordinates, flatLinearRings[i]);
|
||||
ol.array.extend(flatCoordinates, flatLinearRings[i]);
|
||||
ends.push(flatCoordinates.length);
|
||||
}
|
||||
polygon.setFlatCoordinates(
|
||||
@@ -472,10 +492,9 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
|
||||
null,
|
||||
return ol.xml.pushParseAndPop(null,
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||
objectStack, this));
|
||||
objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -607,7 +626,7 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
featureNS: this.featureNS
|
||||
};
|
||||
if (opt_options) {
|
||||
goog.object.extend(options, this.getReadOptions(node, opt_options));
|
||||
ol.object.assign(options, this.getReadOptions(node, opt_options));
|
||||
}
|
||||
return this.readFeaturesInternal(node, [options]);
|
||||
};
|
||||
|
||||
@@ -486,8 +486,8 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
return [];
|
||||
}
|
||||
if (node.localName == 'gpx') {
|
||||
var features = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.Feature>} */ ([]), ol.format.GPX.GPX_PARSERS_,
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = ol.xml.pushParseAndPop([], ol.format.GPX.GPX_PARSERS_,
|
||||
node, [this.getReadOptions(node, opt_options)]);
|
||||
if (features) {
|
||||
this.handleReadExtensions_(features);
|
||||
@@ -600,7 +600,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI];
|
||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context),
|
||||
ol.xml.pushSerializeAndPop(context,
|
||||
ol.format.GPX.RTE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values, objectStack, orderedKeys);
|
||||
};
|
||||
@@ -615,6 +615,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
|
||||
ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
||||
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
|
||||
var properties = feature.getProperties();
|
||||
/** @type {ol.xml.NodeStackItem} */
|
||||
var context = {node: node, 'properties': properties};
|
||||
var geometry = feature.getGeometry();
|
||||
if (geometry) {
|
||||
@@ -627,7 +628,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI];
|
||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context),
|
||||
ol.xml.pushSerializeAndPop(context,
|
||||
ol.format.GPX.TRK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values, objectStack, orderedKeys);
|
||||
};
|
||||
@@ -640,9 +641,10 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
|
||||
/** @type {ol.xml.NodeStackItem} */
|
||||
var context = {node: node, 'geometryLayout': lineString.getLayout(),
|
||||
'properties': {}};
|
||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context),
|
||||
ol.xml.pushSerializeAndPop(context,
|
||||
ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_,
|
||||
lineString.getCoordinates(), objectStack);
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ goog.provide('ol.format.IGC');
|
||||
goog.provide('ol.format.IGCZ');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.string.newlines');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.TextFeature');
|
||||
@@ -87,6 +86,16 @@ ol.format.IGC.H_RECORD_RE_ = /^H.([A-Z]{3}).*?:(.*)/;
|
||||
ol.format.IGC.HFDTE_RECORD_RE_ = /^HFDTE(\d{2})(\d{2})(\d{2})/;
|
||||
|
||||
|
||||
/**
|
||||
* A regular expression matching the newline characters `\r\n`, `\r` and `\n`.
|
||||
*
|
||||
* @const
|
||||
* @type {RegExp}
|
||||
* @private
|
||||
*/
|
||||
ol.format.IGC.NEWLINE_RE_ = /\r\n|\r|\n/;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -112,7 +121,7 @@ ol.format.IGC.prototype.readFeature;
|
||||
*/
|
||||
ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
|
||||
var altitudeMode = this.altitudeMode_;
|
||||
var lines = goog.string.newlines.splitLines(text);
|
||||
var lines = text.split(ol.format.IGC.NEWLINE_RE_);
|
||||
/** @type {Object.<string, string>} */
|
||||
var properties = {};
|
||||
var flatCoordinates = [];
|
||||
|
||||
@@ -29,7 +29,7 @@ goog.inherits(ol.format.JSONFeature, ol.format.Feature);
|
||||
ol.format.JSONFeature.prototype.getObject_ = function(source) {
|
||||
if (goog.isObject(source)) {
|
||||
return source;
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var object = goog.json.parse(source);
|
||||
return object ? object : null;
|
||||
} else {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// FIXME http://earth.google.com/kml/1.0 namespace?
|
||||
// FIXME why does node.getAttribute return an unknown type?
|
||||
// FIXME text
|
||||
// FIXME serialize arbitrary feature properties
|
||||
// FIXME don't parse style if extractStyles is false
|
||||
|
||||
goog.provide('ol.format.KML');
|
||||
|
||||
goog.require('goog.Uri');
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
@@ -31,6 +29,7 @@ goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.style.Fill');
|
||||
goog.require('ol.style.Icon');
|
||||
@@ -318,7 +317,6 @@ ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
|
||||
* @private
|
||||
*/
|
||||
ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) {
|
||||
/** @type {?ol.style.Text} */
|
||||
var textStyle = null;
|
||||
var textOffset = [0, 0];
|
||||
var textAlign = 'start';
|
||||
@@ -332,7 +330,7 @@ ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) {
|
||||
textAlign = 'left';
|
||||
}
|
||||
}
|
||||
if (!goog.object.isEmpty(foundStyle.getText())) {
|
||||
if (!ol.object.isEmpty(foundStyle.getText())) {
|
||||
textStyle = /** @type {ol.style.Text} */
|
||||
(goog.object.clone(foundStyle.getText()));
|
||||
textStyle.setText(name);
|
||||
@@ -378,7 +376,6 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
|
||||
var drawName = showPointNames;
|
||||
/** @type {ol.style.Style|undefined} */
|
||||
var nameStyle;
|
||||
/** @type {string} */
|
||||
var name = '';
|
||||
if (drawName) {
|
||||
if (this.getGeometry()) {
|
||||
@@ -388,7 +385,7 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
|
||||
}
|
||||
|
||||
if (drawName) {
|
||||
name = /** @type {string} */ (this.getProperties()['name']);
|
||||
name = /** @type {string} */ (this.get('name'));
|
||||
drawName = drawName && name;
|
||||
}
|
||||
|
||||
@@ -431,7 +428,7 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
|
||||
ol.format.KML.findStyle_ = function(styleValue, defaultStyle, sharedStyles) {
|
||||
if (goog.isArray(styleValue)) {
|
||||
return styleValue;
|
||||
} else if (goog.isString(styleValue)) {
|
||||
} else if (typeof styleValue === 'string') {
|
||||
// KML files in the wild occasionally forget the leading `#` on styleUrls
|
||||
// defined in the same document. Add a leading `#` if it enables to find
|
||||
// a style.
|
||||
@@ -568,8 +565,7 @@ ol.format.KML.readScale_ = function(node) {
|
||||
* @return {Array.<ol.style.Style>|string|undefined} StyleMap.
|
||||
*/
|
||||
ol.format.KML.readStyleMapValue_ = function(node, objectStack) {
|
||||
return ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.style.Style>|string|undefined} */ (undefined),
|
||||
return ol.xml.pushParseAndPop(undefined,
|
||||
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -785,8 +781,8 @@ ol.format.KML.readFlatLinearRing_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'LinearRing',
|
||||
'localName should be LinearRing');
|
||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
|
||||
null, ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack));
|
||||
return ol.xml.pushParseAndPop(null,
|
||||
ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
|
||||
@@ -836,8 +832,7 @@ ol.format.KML.readGxMultiTrack_ = function(node, objectStack) {
|
||||
'namespaceURI of the node should be known to the KML parser');
|
||||
goog.asserts.assert(node.localName == 'MultiTrack',
|
||||
'localName should be MultiTrack');
|
||||
var lineStrings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
||||
var lineStrings = ol.xml.pushParseAndPop([],
|
||||
ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack);
|
||||
if (!lineStrings) {
|
||||
return undefined;
|
||||
@@ -914,8 +909,8 @@ ol.format.KML.readIcon_ = function(node, objectStack) {
|
||||
ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(null,
|
||||
ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack));
|
||||
return ol.xml.pushParseAndPop(null,
|
||||
ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
|
||||
@@ -930,7 +925,7 @@ ol.format.KML.readLineString_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'LineString',
|
||||
'localName should be LineString');
|
||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
||||
var properties = ol.xml.pushParseAndPop({},
|
||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||
objectStack);
|
||||
var flatCoordinates =
|
||||
@@ -957,7 +952,7 @@ ol.format.KML.readLinearRing_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'LinearRing',
|
||||
'localName should be LinearRing');
|
||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
||||
var properties = ol.xml.pushParseAndPop({},
|
||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||
objectStack);
|
||||
var flatCoordinates =
|
||||
@@ -985,8 +980,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'MultiGeometry',
|
||||
'localName should be MultiGeometry');
|
||||
var geometries = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<ol.geom.Geometry>} */ ([]),
|
||||
var geometries = ol.xml.pushParseAndPop([],
|
||||
ol.format.KML.MULTI_GEOMETRY_PARSERS_, node, objectStack);
|
||||
if (!geometries) {
|
||||
return null;
|
||||
@@ -1005,9 +999,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) {
|
||||
}
|
||||
}
|
||||
if (homogeneous) {
|
||||
/** @type {ol.geom.GeometryLayout} */
|
||||
var layout;
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates;
|
||||
if (type == ol.geom.GeometryType.POINT) {
|
||||
var point = geometries[0];
|
||||
@@ -1021,7 +1013,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) {
|
||||
'geometry should be an ol.geom.Point');
|
||||
goog.asserts.assert(geometry.getLayout() == layout,
|
||||
'geometry layout should be consistent');
|
||||
goog.array.extend(flatCoordinates, geometry.getFlatCoordinates());
|
||||
ol.array.extend(flatCoordinates, geometry.getFlatCoordinates());
|
||||
}
|
||||
var multiPoint = new ol.geom.MultiPoint(null);
|
||||
multiPoint.setFlatCoordinates(layout, flatCoordinates);
|
||||
@@ -1059,7 +1051,7 @@ ol.format.KML.readPoint_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Point', 'localName should be Point');
|
||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
||||
var properties = ol.xml.pushParseAndPop({},
|
||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||
objectStack);
|
||||
var flatCoordinates =
|
||||
@@ -1091,8 +1083,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
|
||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||
objectStack);
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
var flatLinearRings = ol.xml.pushParseAndPop([null],
|
||||
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
@@ -1100,7 +1091,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
|
||||
goog.array.extend(flatCoordinates, flatLinearRings[i]);
|
||||
ol.array.extend(flatCoordinates, flatLinearRings[i]);
|
||||
ends.push(flatCoordinates.length);
|
||||
}
|
||||
polygon.setFlatCoordinates(
|
||||
@@ -1278,7 +1269,7 @@ ol.format.KML.PlacemarkStyleMapParser_ = function(node, objectStack) {
|
||||
'placemarkObject should be an Object');
|
||||
if (goog.isArray(styleMapValue)) {
|
||||
placemarkObject['Style'] = styleMapValue;
|
||||
} else if (goog.isString(styleMapValue)) {
|
||||
} else if (typeof styleMapValue === 'string') {
|
||||
placemarkObject['styleUrl'] = styleMapValue;
|
||||
} else {
|
||||
goog.asserts.fail('styleMapValue has an unknown type');
|
||||
@@ -1330,8 +1321,8 @@ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
||||
'localName should be innerBoundaryIs');
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||
ol.format.KML.INNER_BOUNDARY_IS_PARSERS_, node, objectStack);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -1355,8 +1346,8 @@ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
||||
'localName should be outerBoundaryIs');
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>|undefined} */ (undefined),
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||
ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -1766,8 +1757,8 @@ ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) {
|
||||
'Style': this.readSharedStyle_.bind(this),
|
||||
'StyleMap': this.readSharedStyleMap_.bind(this)
|
||||
});
|
||||
var features = ol.xml.pushParseAndPop(/** @type {Array.<ol.Feature>} */ ([]),
|
||||
parsersNS, node, objectStack, this);
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack, this);
|
||||
if (features) {
|
||||
return features;
|
||||
} else {
|
||||
@@ -1955,7 +1946,7 @@ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
var fs = this.readFeaturesFromNode(n, opt_options);
|
||||
if (fs) {
|
||||
goog.array.extend(features, fs);
|
||||
ol.array.extend(features, fs);
|
||||
}
|
||||
}
|
||||
return features;
|
||||
@@ -1977,7 +1968,7 @@ ol.format.KML.prototype.readName = function(source) {
|
||||
return this.readNameFromDocument(/** @type {Document} */ (source));
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readNameFromNode(/** @type {Node} */ (source));
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readNameFromDocument(doc);
|
||||
} else {
|
||||
@@ -2044,14 +2035,14 @@ ol.format.KML.prototype.readNameFromNode = function(node) {
|
||||
ol.format.KML.prototype.readNetworkLinks = function(source) {
|
||||
var networkLinks = [];
|
||||
if (ol.xml.isDocument(source)) {
|
||||
goog.array.extend(networkLinks, this.readNetworkLinksFromDocument(
|
||||
ol.array.extend(networkLinks, this.readNetworkLinksFromDocument(
|
||||
/** @type {Document} */ (source)));
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
goog.array.extend(networkLinks, this.readNetworkLinksFromNode(
|
||||
ol.array.extend(networkLinks, this.readNetworkLinksFromNode(
|
||||
/** @type {Node} */ (source)));
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
goog.array.extend(networkLinks, this.readNetworkLinksFromDocument(doc));
|
||||
ol.array.extend(networkLinks, this.readNetworkLinksFromDocument(doc));
|
||||
} else {
|
||||
goog.asserts.fail('unknown type for source');
|
||||
}
|
||||
@@ -2067,7 +2058,7 @@ ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) {
|
||||
var n, networkLinks = [];
|
||||
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
||||
ol.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
||||
}
|
||||
}
|
||||
return networkLinks;
|
||||
@@ -2094,7 +2085,7 @@ ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
|
||||
(localName == 'Document' ||
|
||||
localName == 'Folder' ||
|
||||
localName == 'kml')) {
|
||||
goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
||||
ol.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
||||
}
|
||||
}
|
||||
return networkLinks;
|
||||
@@ -2394,10 +2385,10 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||
// FIXME the styles returned by the style function are supposed to be
|
||||
// resolution-independent here
|
||||
var styles = styleFunction.call(feature, 0);
|
||||
if (styles && styles.length > 0) {
|
||||
var style = styles[0];
|
||||
if (styles) {
|
||||
var style = goog.isArray(styles) ? styles[0] : styles;
|
||||
if (this.writeStyles_) {
|
||||
properties['Style'] = styles[0];
|
||||
properties['Style'] = style;
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (textStyle) {
|
||||
|
||||
@@ -41,7 +41,7 @@ ol.format.MVT = function(opt_options) {
|
||||
* @type {ol.proj.Projection}
|
||||
*/
|
||||
this.defaultDataProjection = new ol.proj.Projection({
|
||||
code: 'EPSG:3857',
|
||||
code: '',
|
||||
units: ol.proj.Units.TILE_PIXELS
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// FIXME add typedef for stack state objects
|
||||
goog.provide('ol.format.OSMXML');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.XMLFeature');
|
||||
@@ -12,6 +11,7 @@ goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
@@ -64,16 +64,17 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
|
||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
var id = node.getAttribute('id');
|
||||
var coordinates = /** @type {Array.<number>} */ ([
|
||||
/** @type {ol.Coordinate} */
|
||||
var coordinates = [
|
||||
parseFloat(node.getAttribute('lon')),
|
||||
parseFloat(node.getAttribute('lat'))
|
||||
]);
|
||||
];
|
||||
state.nodes[id] = coordinates;
|
||||
|
||||
var values = ol.xml.pushParseAndPop({
|
||||
tags: {}
|
||||
}, ol.format.OSMXML.NODE_PARSERS_, node, objectStack);
|
||||
if (!goog.object.isEmpty(values.tags)) {
|
||||
if (!ol.object.isEmpty(values.tags)) {
|
||||
var geometry = new ol.geom.Point(coordinates);
|
||||
ol.format.Feature.transformWithOptions(geometry, false, options);
|
||||
var feature = new ol.Feature(geometry);
|
||||
@@ -100,10 +101,11 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) {
|
||||
tags: {}
|
||||
}, ol.format.OSMXML.WAY_PARSERS_, node, objectStack);
|
||||
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
var flatCoordinates = /** @type {Array.<number>} */ ([]);
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = [];
|
||||
for (var i = 0, ii = values.ndrefs.length; i < ii; i++) {
|
||||
var point = state.nodes[values.ndrefs[i]];
|
||||
goog.array.extend(flatCoordinates, point);
|
||||
ol.array.extend(flatCoordinates, point);
|
||||
}
|
||||
var geometry;
|
||||
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
|
||||
|
||||
@@ -26,7 +26,7 @@ goog.inherits(ol.format.TextFeature, ol.format.Feature);
|
||||
* @return {string} Text.
|
||||
*/
|
||||
ol.format.TextFeature.prototype.getText_ = function(source) {
|
||||
if (goog.isString(source)) {
|
||||
if (typeof source === 'string') {
|
||||
return source;
|
||||
} else {
|
||||
goog.asserts.fail();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.format.TopoJSON');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.JSONFeature');
|
||||
@@ -11,6 +10,7 @@ goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.MultiPolygon');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
|
||||
}
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = [];
|
||||
var topoJSONFeatures = goog.object.getValues(topoJSONTopology.objects);
|
||||
var topoJSONFeatures = ol.object.getValues(topoJSONTopology.objects);
|
||||
var i, ii;
|
||||
var feature;
|
||||
for (i = 0, ii = topoJSONFeatures.length; i < ii; ++i) {
|
||||
|
||||
@@ -2,13 +2,13 @@ goog.provide('ol.format.WFS');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.format.GML3');
|
||||
goog.require('ol.format.GMLBase');
|
||||
goog.require('ol.format.XMLFeature');
|
||||
goog.require('ol.format.XSD');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.xml');
|
||||
|
||||
@@ -122,7 +122,7 @@ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
'featureType': this.featureType_,
|
||||
'featureNS': this.featureNS_
|
||||
};
|
||||
goog.object.extend(context, this.getReadOptions(node,
|
||||
ol.object.assign(context, this.getReadOptions(node,
|
||||
opt_options ? opt_options : {}));
|
||||
var objectStack = [context];
|
||||
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[ol.format.GMLBase.GMLNS][
|
||||
@@ -151,7 +151,7 @@ ol.format.WFS.prototype.readTransactionResponse = function(source) {
|
||||
/** @type {Document} */ (source));
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readTransactionResponseFromNode(/** @type {Node} */ (source));
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readTransactionResponseFromDocument(doc);
|
||||
} else {
|
||||
@@ -176,7 +176,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadata = function(source) {
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readFeatureCollectionMetadataFromNode(
|
||||
/** @type {Node} */ (source));
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readFeatureCollectionMetadataFromDocument(doc);
|
||||
} else {
|
||||
@@ -411,6 +411,7 @@ ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
|
||||
ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
goog.asserts.assert(feature.getId() !== undefined, 'feature should have an id');
|
||||
var featureType = context['featureType'];
|
||||
var featurePrefix = context['featurePrefix'];
|
||||
featurePrefix = featurePrefix ? featurePrefix :
|
||||
@@ -420,7 +421,7 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
var fid = feature.getId();
|
||||
if (fid) {
|
||||
if (fid !== undefined) {
|
||||
ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack);
|
||||
}
|
||||
};
|
||||
@@ -435,6 +436,7 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
goog.asserts.assert(feature.getId() !== undefined, 'feature should have an id');
|
||||
var featureType = context['featureType'];
|
||||
var featurePrefix = context['featurePrefix'];
|
||||
featurePrefix = featurePrefix ? featurePrefix :
|
||||
@@ -444,7 +446,7 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
var fid = feature.getId();
|
||||
if (fid) {
|
||||
if (fid !== undefined) {
|
||||
var keys = feature.getKeys();
|
||||
var values = [];
|
||||
for (var i = 0, ii = keys.length; i < ii; i++) {
|
||||
@@ -543,7 +545,7 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
|
||||
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
}
|
||||
var item = goog.object.clone(context);
|
||||
var item = ol.object.assign({}, context);
|
||||
item.node = node;
|
||||
ol.xml.pushSerializeAndPop(item,
|
||||
ol.format.WFS.QUERY_SERIALIZERS_,
|
||||
@@ -610,7 +612,7 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
|
||||
ol.format.WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var item = goog.object.clone(context);
|
||||
var item = ol.object.assign({}, context);
|
||||
item.node = node;
|
||||
ol.xml.pushSerializeAndPop(item,
|
||||
ol.format.WFS.GETFEATURE_SERIALIZERS_,
|
||||
@@ -698,7 +700,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
if (inserts) {
|
||||
obj = {node: node, featureNS: options.featureNS,
|
||||
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
||||
goog.object.extend(obj, baseObj);
|
||||
ol.object.assign(obj, baseObj);
|
||||
ol.xml.pushSerializeAndPop(obj,
|
||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||
ol.xml.makeSimpleNodeFactory('Insert'), inserts,
|
||||
@@ -707,7 +709,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
if (updates) {
|
||||
obj = {node: node, featureNS: options.featureNS,
|
||||
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
||||
goog.object.extend(obj, baseObj);
|
||||
ol.object.assign(obj, baseObj);
|
||||
ol.xml.pushSerializeAndPop(obj,
|
||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||
ol.xml.makeSimpleNodeFactory('Update'), updates,
|
||||
|
||||
@@ -2,7 +2,6 @@ goog.provide('ol.format.WMSCapabilities');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.format.XLink');
|
||||
goog.require('ol.format.XML');
|
||||
@@ -154,10 +153,10 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
|
||||
eastBoundLongitude === undefined || northBoundLatitude === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return /** @type {ol.Extent} */ ([
|
||||
return [
|
||||
westBoundLongitude, southBoundLatitude,
|
||||
eastBoundLongitude, northBoundLatitude
|
||||
]);
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -288,8 +287,8 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
|
||||
var parentLayerObject = /** @type {Object.<string,*>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
|
||||
var layerObject = /** @type {Object.<string,*>} */ (ol.xml.pushParseAndPop(
|
||||
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack));
|
||||
var layerObject = ol.xml.pushParseAndPop(
|
||||
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||
|
||||
if (!layerObject) {
|
||||
return undefined;
|
||||
@@ -339,9 +338,8 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
|
||||
var addKeys = ['Style', 'CRS', 'AuthorityURL'];
|
||||
addKeys.forEach(function(key) {
|
||||
if (key in parentLayerObject) {
|
||||
var childValue = goog.object.setIfUndefined(layerObject, key, []);
|
||||
childValue = childValue.concat(parentLayerObject[key]);
|
||||
layerObject[key] = childValue;
|
||||
var childValue = layerObject[key] || [];
|
||||
layerObject[key] = childValue.concat(parentLayerObject[key]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
goog.provide('ol.format.WMSGetFeatureInfo');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.format.GML2');
|
||||
goog.require('ol.format.XMLFeature');
|
||||
goog.require('ol.object');
|
||||
goog.require('ol.xml');
|
||||
|
||||
|
||||
@@ -16,9 +16,12 @@ goog.require('ol.xml');
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.format.XMLFeature}
|
||||
* @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
ol.format.WMSGetFeatureInfo = function() {
|
||||
ol.format.WMSGetFeatureInfo = function(opt_options) {
|
||||
|
||||
var options = opt_options ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -33,6 +36,13 @@ ol.format.WMSGetFeatureInfo = function() {
|
||||
*/
|
||||
this.gmlFormat_ = new ol.format.GML2();
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<string>}
|
||||
*/
|
||||
this.layers_ = options.layers ? options.layers : null;
|
||||
|
||||
goog.base(this);
|
||||
};
|
||||
goog.inherits(ol.format.WMSGetFeatureInfo, ol.format.XMLFeature);
|
||||
@@ -62,7 +72,7 @@ ol.format.WMSGetFeatureInfo.layerIdentifier_ = '_layer';
|
||||
*/
|
||||
ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
|
||||
|
||||
node.namespaceURI = this.featureNS_;
|
||||
node.setAttribute('namespaceURI', this.featureNS_);
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||
'node.nodeType should be ELEMENT');
|
||||
var localName = ol.xml.getLocalName(node);
|
||||
@@ -86,7 +96,13 @@ ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack
|
||||
'localName of layer node should match layerIdentifier');
|
||||
|
||||
var toRemove = ol.format.WMSGetFeatureInfo.layerIdentifier_;
|
||||
var featureType = layer.localName.replace(toRemove, '') +
|
||||
var layerName = layer.localName.replace(toRemove, '');
|
||||
|
||||
if (this.layers_ && !ol.array.includes(this.layers_, layerName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var featureType = layerName +
|
||||
ol.format.WMSGetFeatureInfo.featureIdentifier_;
|
||||
|
||||
context['featureType'] = featureType;
|
||||
@@ -97,11 +113,11 @@ ol.format.WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack
|
||||
this.gmlFormat_.readFeatureElement, this.gmlFormat_);
|
||||
var parsersNS = ol.xml.makeStructureNS(
|
||||
[context['featureNS'], null], parsers);
|
||||
layer.namespaceURI = this.featureNS_;
|
||||
layer.setAttribute('namespaceURI', this.featureNS_);
|
||||
var layerFeatures = ol.xml.pushParseAndPop(
|
||||
[], parsersNS, layer, objectStack, this.gmlFormat_);
|
||||
if (layerFeatures) {
|
||||
goog.array.extend(features, layerFeatures);
|
||||
ol.array.extend(features, layerFeatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +154,7 @@ ol.format.WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_
|
||||
'featureNS': this.featureNS
|
||||
};
|
||||
if (opt_options) {
|
||||
goog.object.extend(options, this.getReadOptions(node, opt_options));
|
||||
ol.object.assign(options, this.getReadOptions(node, opt_options));
|
||||
}
|
||||
return this.readFeatures_(node, [options]);
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
goog.provide('ol.format.XMLFeature');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dom.NodeType');
|
||||
goog.require('goog.dom.xml');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.FormatType');
|
||||
goog.require('ol.proj');
|
||||
@@ -42,7 +42,7 @@ ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) {
|
||||
/** @type {Document} */ (source), opt_options);
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readFeatureFromDocument(doc, opt_options);
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@ ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) {
|
||||
/** @type {Document} */ (source), opt_options);
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readFeaturesFromDocument(doc, opt_options);
|
||||
} else {
|
||||
@@ -108,7 +108,7 @@ ol.format.XMLFeature.prototype.readFeaturesFromDocument = function(
|
||||
var n;
|
||||
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
goog.array.extend(features, this.readFeaturesFromNode(n, opt_options));
|
||||
ol.array.extend(features, this.readFeaturesFromNode(n, opt_options));
|
||||
}
|
||||
}
|
||||
return features;
|
||||
@@ -133,7 +133,7 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
|
||||
/** @type {Document} */ (source), opt_options);
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readGeometryFromDocument(doc, opt_options);
|
||||
} else {
|
||||
@@ -169,7 +169,7 @@ ol.format.XMLFeature.prototype.readProjection = function(source) {
|
||||
return this.readProjectionFromDocument(/** @type {Document} */ (source));
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readProjectionFromNode(/** @type {Node} */ (source));
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readProjectionFromDocument(doc);
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ ol.format.XML.prototype.read = function(source) {
|
||||
return this.readFromDocument(/** @type {Document} */ (source));
|
||||
} else if (ol.xml.isNode(source)) {
|
||||
return this.readFromNode(/** @type {Node} */ (source));
|
||||
} else if (goog.isString(source)) {
|
||||
} else if (typeof source === 'string') {
|
||||
var doc = ol.xml.parse(source);
|
||||
return this.readFromDocument(doc);
|
||||
} else {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
goog.provide('ol.Geolocation');
|
||||
goog.provide('ol.GeolocationProperty');
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.geom.Geometry');
|
||||
@@ -52,6 +52,7 @@ ol.GeolocationProperty = {
|
||||
* window.console.log(geolocation.getPosition());
|
||||
* });
|
||||
*
|
||||
* @fires error
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {olx.GeolocationOptions=} opt_options Options.
|
||||
@@ -82,12 +83,12 @@ ol.Geolocation = function(opt_options) {
|
||||
*/
|
||||
this.watchId_ = undefined;
|
||||
|
||||
goog.events.listen(
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.GeolocationProperty.PROJECTION),
|
||||
this.handleProjectionChanged_, false, this);
|
||||
goog.events.listen(
|
||||
this.handleProjectionChanged_, this);
|
||||
ol.events.listen(
|
||||
this, ol.Object.getChangeEventType(ol.GeolocationProperty.TRACKING),
|
||||
this.handleTrackingChanged_, false, this);
|
||||
this.handleTrackingChanged_, this);
|
||||
|
||||
if (options.projection !== undefined) {
|
||||
this.setProjection(ol.proj.get(options.projection));
|
||||
@@ -177,15 +178,20 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
this.changed();
|
||||
};
|
||||
|
||||
/**
|
||||
* Triggered when the Geolocation returns an error.
|
||||
* @event error
|
||||
* @api
|
||||
*/
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {GeolocationPositionError} error error object.
|
||||
*/
|
||||
ol.Geolocation.prototype.positionError_ = function(error) {
|
||||
error.type = goog.events.EventType.ERROR;
|
||||
error.type = ol.events.EventType.ERROR;
|
||||
this.setTracking(false);
|
||||
this.dispatchEvent(error);
|
||||
this.dispatchEvent(/** @type {{type: string, target: undefined}} */ (error));
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ ol.geom.flat.contains.linearRingContainsExtent = function(flatCoordinates, offse
|
||||
var outside = ol.extent.forEachCorner(extent,
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @return {boolean} Contains (x, y).
|
||||
*/
|
||||
function(coordinate) {
|
||||
return !ol.geom.flat.contains.linearRingContainsXY(flatCoordinates,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.geom.flat.interpolate');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.math');
|
||||
goog.require('ol.array');
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,6 +15,7 @@ goog.require('goog.math');
|
||||
* @return {Array.<number>} Destination.
|
||||
*/
|
||||
ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, stride, fraction, opt_dest) {
|
||||
// FIXME does not work when vertices are repeated
|
||||
// FIXME interpolate extra dimensions
|
||||
goog.asserts.assert(0 <= fraction && fraction <= 1,
|
||||
'fraction should be in between 0 and 1');
|
||||
@@ -46,7 +47,7 @@ ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, str
|
||||
y1 = y2;
|
||||
}
|
||||
var target = fraction * length;
|
||||
var index = goog.array.binarySearch(cumulativeLengths, target);
|
||||
var index = ol.array.binarySearch(cumulativeLengths, target);
|
||||
if (index < 0) {
|
||||
var t = (target - cumulativeLengths[-index - 2]) /
|
||||
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
goog.provide('ol.geom.GeometryCollection');
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.object');
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,9 +56,9 @@ ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
|
||||
return;
|
||||
}
|
||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||
goog.events.unlisten(
|
||||
this.geometries_[i], goog.events.EventType.CHANGE,
|
||||
this.changed, false, this);
|
||||
ol.events.unlisten(
|
||||
this.geometries_[i], ol.events.EventType.CHANGE,
|
||||
this.changed, this);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,9 +72,9 @@ ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() {
|
||||
return;
|
||||
}
|
||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||
goog.events.listen(
|
||||
this.geometries_[i], goog.events.EventType.CHANGE,
|
||||
this.changed, false, this);
|
||||
ol.events.listen(
|
||||
this.geometries_[i], ol.events.EventType.CHANGE,
|
||||
this.changed, this);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -160,7 +160,7 @@ ol.geom.GeometryCollection.prototype.getGeometriesArray = function() {
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
||||
if (this.simplifiedGeometryRevision != this.getRevision()) {
|
||||
goog.object.clear(this.simplifiedGeometryCache);
|
||||
ol.object.clear(this.simplifiedGeometryCache);
|
||||
this.simplifiedGeometryMaxMinSquaredTolerance = 0;
|
||||
this.simplifiedGeometryRevision = this.getRevision();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.geom.LineString');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -72,7 +72,7 @@ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = coordinate.slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, coordinate);
|
||||
ol.array.extend(this.flatCoordinates, coordinate);
|
||||
}
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.geom.MultiLineString');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -65,7 +65,7 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = lineString.getFlatCoordinates().slice();
|
||||
} else {
|
||||
goog.array.extend(
|
||||
ol.array.extend(
|
||||
this.flatCoordinates, lineString.getFlatCoordinates().slice());
|
||||
}
|
||||
this.ends_.push(this.flatCoordinates.length);
|
||||
@@ -216,7 +216,7 @@ ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
|
||||
var end = ends[i];
|
||||
var midpoint = ol.geom.flat.interpolate.lineString(
|
||||
flatCoordinates, offset, end, stride, 0.5);
|
||||
goog.array.extend(midpoints, midpoint);
|
||||
ol.array.extend(midpoints, midpoint);
|
||||
offset = end;
|
||||
}
|
||||
return midpoints;
|
||||
@@ -319,7 +319,7 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
|
||||
goog.asserts.assert(lineString.getLayout() == layout,
|
||||
'layout of lineString should match layout');
|
||||
}
|
||||
goog.array.extend(flatCoordinates, lineString.getFlatCoordinates());
|
||||
ol.array.extend(flatCoordinates, lineString.getFlatCoordinates());
|
||||
ends.push(flatCoordinates.length);
|
||||
}
|
||||
this.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
goog.provide('ol.geom.MultiPoint');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -40,7 +40,7 @@ ol.geom.MultiPoint.prototype.appendPoint = function(point) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = point.getFlatCoordinates().slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, point.getFlatCoordinates());
|
||||
ol.array.extend(this.flatCoordinates, point.getFlatCoordinates());
|
||||
}
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
goog.provide('ol.geom.MultiPolygon');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -100,7 +99,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
||||
this.endss_.push();
|
||||
} else {
|
||||
var offset = this.flatCoordinates.length;
|
||||
goog.array.extend(this.flatCoordinates, polygon.getFlatCoordinates());
|
||||
ol.array.extend(this.flatCoordinates, polygon.getFlatCoordinates());
|
||||
ends = polygon.getEnds().slice();
|
||||
var i, ii;
|
||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||
@@ -119,8 +118,13 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.clone = function() {
|
||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||
var newEndss = /** @type {Array.<Array.<number>>} */
|
||||
(goog.object.unsafeClone(this.endss_));
|
||||
|
||||
var len = this.endss_.length;
|
||||
var newEndss = new Array(len);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
newEndss[i] = this.endss_[i].slice();
|
||||
}
|
||||
|
||||
multiPolygon.setFlatCoordinates(
|
||||
this.layout, this.flatCoordinates.slice(), newEndss);
|
||||
return multiPolygon;
|
||||
@@ -424,7 +428,7 @@ ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) {
|
||||
for (j = 0, jj = ends.length; j < jj; ++j) {
|
||||
ends[j] += offset;
|
||||
}
|
||||
goog.array.extend(flatCoordinates, polygon.getFlatCoordinates());
|
||||
ol.array.extend(flatCoordinates, polygon.getFlatCoordinates());
|
||||
endss.push(ends);
|
||||
}
|
||||
this.setFlatCoordinates(layout, flatCoordinates, endss);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
goog.provide('ol.geom.Polygon');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.math');
|
||||
goog.require('ol');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
@@ -94,7 +94,7 @@ ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
||||
ol.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
||||
}
|
||||
this.ends_.push(this.flatCoordinates.length);
|
||||
this.changed();
|
||||
@@ -390,7 +390,7 @@ ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
|
||||
var flatCoordinates = [];
|
||||
var i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
goog.array.extend(
|
||||
ol.array.extend(
|
||||
flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n));
|
||||
}
|
||||
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
||||
@@ -435,7 +435,11 @@ ol.geom.Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||
var stride = circle.getStride();
|
||||
var layout = circle.getLayout();
|
||||
var polygon = new ol.geom.Polygon(null, layout);
|
||||
var flatCoordinates = goog.array.repeat(0, stride * (sides + 1));
|
||||
var arrayLength = stride * (sides + 1);
|
||||
var flatCoordinates = new Array(arrayLength);
|
||||
for (var i = 0; i < arrayLength; i++) {
|
||||
flatCoordinates[i] = 0;
|
||||
}
|
||||
var ends = [flatCoordinates.length];
|
||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
ol.geom.Polygon.makeRegular(
|
||||
|
||||
@@ -2,11 +2,11 @@ goog.provide('ol.geom.SimpleGeometry');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.functions');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryLayout');
|
||||
goog.require('ol.geom.flat.transform');
|
||||
goog.require('ol.object');
|
||||
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ ol.geom.SimpleGeometry.prototype.getLayout = function() {
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry = function(squaredTolerance) {
|
||||
if (this.simplifiedGeometryRevision != this.getRevision()) {
|
||||
goog.object.clear(this.simplifiedGeometryCache);
|
||||
ol.object.clear(this.simplifiedGeometryCache);
|
||||
this.simplifiedGeometryMaxMinSquaredTolerance = 0;
|
||||
this.simplifiedGeometryRevision = this.getRevision();
|
||||
}
|
||||
@@ -240,7 +240,7 @@ ol.geom.SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesti
|
||||
coordinates = /** @type {Array} */ (coordinates[0]);
|
||||
}
|
||||
}
|
||||
stride = (/** @type {Array} */ (coordinates)).length;
|
||||
stride = coordinates.length;
|
||||
layout = ol.geom.SimpleGeometry.getLayoutForStride_(stride);
|
||||
}
|
||||
this.layout = layout;
|
||||
|
||||
@@ -5,6 +5,28 @@ goog.require('ol.dom');
|
||||
goog.require('ol.webgl');
|
||||
|
||||
|
||||
var ua = typeof navigator !== 'undefined' ?
|
||||
navigator.userAgent.toLowerCase() : '';
|
||||
|
||||
/**
|
||||
* User agent string says we are dealing with Firefox as browser.
|
||||
* @type {boolean}
|
||||
*/
|
||||
ol.has.FIREFOX = ua.indexOf('firefox') !== -1;
|
||||
|
||||
/**
|
||||
* User agent string says we are dealing with Safari as browser.
|
||||
* @type {boolean}
|
||||
*/
|
||||
ol.has.SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') === -1;
|
||||
|
||||
/**
|
||||
* User agent string says we are dealing with a Mac as platform.
|
||||
* @type {boolean}
|
||||
*/
|
||||
ol.has.MAC = ua.indexOf('macintosh') !== -1;
|
||||
|
||||
|
||||
/**
|
||||
* The ratio between physical pixels and device-independent pixels
|
||||
* (dips) on the device (`window.devicePixelRatio`).
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.Image');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.ImageBase');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.object');
|
||||
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<goog.events.Key>}
|
||||
* @type {Array.<ol.events.Key>}
|
||||
*/
|
||||
this.imageListenerKeys_ = null;
|
||||
|
||||
@@ -81,7 +81,7 @@ ol.Image.prototype.getImage = function(opt_context) {
|
||||
var key = goog.getUid(opt_context);
|
||||
if (key in this.imageByContext_) {
|
||||
return this.imageByContext_[key];
|
||||
} else if (goog.object.isEmpty(this.imageByContext_)) {
|
||||
} else if (ol.object.isEmpty(this.imageByContext_)) {
|
||||
image = this.image_;
|
||||
} else {
|
||||
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
||||
@@ -131,10 +131,10 @@ ol.Image.prototype.load = function() {
|
||||
goog.asserts.assert(!this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should be null');
|
||||
this.imageListenerKeys_ = [
|
||||
goog.events.listenOnce(this.image_, goog.events.EventType.ERROR,
|
||||
this.handleImageError_, false, this),
|
||||
goog.events.listenOnce(this.image_, goog.events.EventType.LOAD,
|
||||
this.handleImageLoad_, false, this)
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
|
||||
this.handleImageError_, this),
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.LOAD,
|
||||
this.handleImageLoad_, this)
|
||||
];
|
||||
this.imageLoadFunction_(this, this.src_);
|
||||
}
|
||||
@@ -157,6 +157,6 @@ ol.Image.prototype.setImage = function(image) {
|
||||
ol.Image.prototype.unlistenImage_ = function() {
|
||||
goog.asserts.assert(this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should not be null');
|
||||
this.imageListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||
this.imageListenerKeys_ = null;
|
||||
};
|
||||
|
||||
@@ -2,8 +2,8 @@ goog.provide('ol.ImageBase');
|
||||
goog.provide('ol.ImageState');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events.EventTarget');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events.EventTarget');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Extent');
|
||||
|
||||
@@ -21,7 +21,7 @@ ol.ImageState = {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {goog.events.EventTarget}
|
||||
* @extends {ol.events.EventTarget}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
@@ -63,14 +63,14 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
||||
this.state = state;
|
||||
|
||||
};
|
||||
goog.inherits(ol.ImageBase, goog.events.EventTarget);
|
||||
goog.inherits(ol.ImageBase, ol.events.EventTarget);
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ol.ImageBase.prototype.changed = function() {
|
||||
this.dispatchEvent(goog.events.EventType.CHANGE);
|
||||
this.dispatchEvent(ol.events.EventType.CHANGE);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
goog.provide('ol.ImageTile');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileLoadFunctionType');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.object');
|
||||
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<goog.events.Key>}
|
||||
* @type {Array.<ol.events.Key>}
|
||||
*/
|
||||
this.imageListenerKeys_ = null;
|
||||
|
||||
@@ -87,7 +87,7 @@ ol.ImageTile.prototype.getImage = function(opt_context) {
|
||||
var key = goog.getUid(opt_context);
|
||||
if (key in this.imageByContext_) {
|
||||
return this.imageByContext_[key];
|
||||
} else if (goog.object.isEmpty(this.imageByContext_)) {
|
||||
} else if (ol.object.isEmpty(this.imageByContext_)) {
|
||||
image = this.image_;
|
||||
} else {
|
||||
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
||||
@@ -146,10 +146,10 @@ ol.ImageTile.prototype.load = function() {
|
||||
goog.asserts.assert(!this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should be null');
|
||||
this.imageListenerKeys_ = [
|
||||
goog.events.listenOnce(this.image_, goog.events.EventType.ERROR,
|
||||
this.handleImageError_, false, this),
|
||||
goog.events.listenOnce(this.image_, goog.events.EventType.LOAD,
|
||||
this.handleImageLoad_, false, this)
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
|
||||
this.handleImageError_, this),
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.LOAD,
|
||||
this.handleImageLoad_, this)
|
||||
];
|
||||
this.tileLoadFunction_(this, this.src_);
|
||||
}
|
||||
@@ -164,6 +164,6 @@ ol.ImageTile.prototype.load = function() {
|
||||
ol.ImageTile.prototype.unlistenImage_ = function() {
|
||||
goog.asserts.assert(this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should not be null');
|
||||
this.imageListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||
this.imageListenerKeys_ = null;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var browserEvent = mapBrowserEvent.originalEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var anchor = mapBrowserEvent.coordinate;
|
||||
|
||||
@@ -4,12 +4,10 @@ goog.provide('ol.interaction.DragAndDrop');
|
||||
goog.provide('ol.interaction.DragAndDropEvent');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('goog.events.FileDropHandler');
|
||||
goog.require('goog.events.FileDropHandler.EventType');
|
||||
goog.require('goog.fs.FileReader');
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.proj');
|
||||
|
||||
@@ -48,54 +46,56 @@ ol.interaction.DragAndDrop = function(opt_options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {goog.events.FileDropHandler}
|
||||
* @type {Array.<ol.events.Key>}
|
||||
*/
|
||||
this.fileDropHandler_ = null;
|
||||
this.dropListenKeys_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {goog.events.Key|undefined}
|
||||
* @type {Element}
|
||||
*/
|
||||
this.dropListenKey_ = undefined;
|
||||
this.target = options.target ? options.target : null;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.DragAndDrop, ol.interaction.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param {Event} event Event.
|
||||
* @this {ol.interaction.DragAndDrop}
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.disposeInternal = function() {
|
||||
if (this.dropListenKey_) {
|
||||
goog.events.unlistenByKey(this.dropListenKey_);
|
||||
ol.interaction.DragAndDrop.handleDrop_ = function(event) {
|
||||
var files = event.dataTransfer.files;
|
||||
var i, ii, file;
|
||||
for (i = 0, ii = files.length; i < ii; ++i) {
|
||||
file = files.item(i);
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener(ol.events.EventType.LOAD,
|
||||
goog.partial(this.handleResult_, file).bind(this));
|
||||
reader.readAsText(file);
|
||||
}
|
||||
goog.base(this, 'disposeInternal');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} event Event.
|
||||
* @param {Event} event Event.
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.handleDrop_ = function(event) {
|
||||
var files = event.getBrowserEvent().dataTransfer.files;
|
||||
var i, ii, file;
|
||||
for (i = 0, ii = files.length; i < ii; ++i) {
|
||||
file = files[i];
|
||||
// The empty string param is a workaround for
|
||||
// https://code.google.com/p/closure-library/issues/detail?id=524
|
||||
var reader = goog.fs.FileReader.readAsText(file, '');
|
||||
reader.addCallback(goog.partial(this.handleResult_, file), this);
|
||||
}
|
||||
ol.interaction.DragAndDrop.handleStop_ = function(event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = 'copy';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {File} file File.
|
||||
* @param {string} result Result.
|
||||
* @param {Event} event Load event.
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) {
|
||||
ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, event) {
|
||||
var result = event.target.result;
|
||||
var map = this.getMap();
|
||||
goog.asserts.assert(map, 'map must be set');
|
||||
var projection = this.projection_;
|
||||
@@ -112,19 +112,11 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) {
|
||||
for (i = 0, ii = formatConstructors.length; i < ii; ++i) {
|
||||
var formatConstructor = formatConstructors[i];
|
||||
var format = new formatConstructor();
|
||||
var readFeatures = this.tryReadFeatures_(format, result);
|
||||
if (readFeatures) {
|
||||
var featureProjection = format.readProjection(result);
|
||||
var transform = ol.proj.getTransform(featureProjection, projection);
|
||||
var j, jj;
|
||||
for (j = 0, jj = readFeatures.length; j < jj; ++j) {
|
||||
var feature = readFeatures[j];
|
||||
var geometry = feature.getGeometry();
|
||||
if (geometry) {
|
||||
geometry.applyTransform(transform);
|
||||
}
|
||||
features.push(feature);
|
||||
}
|
||||
features = this.tryReadFeatures_(format, result, {
|
||||
featureProjection: projection
|
||||
});
|
||||
if (features && features.length > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.dispatchEvent(
|
||||
@@ -149,22 +141,23 @@ ol.interaction.DragAndDrop.handleEvent = goog.functions.TRUE;
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
||||
if (this.dropListenKey_) {
|
||||
goog.events.unlistenByKey(this.dropListenKey_);
|
||||
this.dropListenKey_ = undefined;
|
||||
if (this.dropListenKeys_) {
|
||||
this.dropListenKeys_.forEach(ol.events.unlistenByKey);
|
||||
this.dropListenKeys_ = null;
|
||||
}
|
||||
if (this.fileDropHandler_) {
|
||||
goog.dispose(this.fileDropHandler_);
|
||||
this.fileDropHandler_ = null;
|
||||
}
|
||||
goog.asserts.assert(this.dropListenKey_ === undefined,
|
||||
'this.dropListenKey_ should be undefined');
|
||||
goog.base(this, 'setMap', map);
|
||||
if (map) {
|
||||
this.fileDropHandler_ = new goog.events.FileDropHandler(map.getViewport());
|
||||
this.dropListenKey_ = goog.events.listen(
|
||||
this.fileDropHandler_, goog.events.FileDropHandler.EventType.DROP,
|
||||
this.handleDrop_, false, this);
|
||||
var dropArea = this.target ? this.target : map.getViewport();
|
||||
this.dropListenKeys_ = [
|
||||
ol.events.listen(dropArea, ol.events.EventType.DROP,
|
||||
ol.interaction.DragAndDrop.handleDrop_, this),
|
||||
ol.events.listen(dropArea, ol.events.EventType.DRAGENTER,
|
||||
ol.interaction.DragAndDrop.handleStop_, this),
|
||||
ol.events.listen(dropArea, ol.events.EventType.DRAGOVER,
|
||||
ol.interaction.DragAndDrop.handleStop_, this),
|
||||
ol.events.listen(dropArea, ol.events.EventType.DROP,
|
||||
ol.interaction.DragAndDrop.handleStop_, this)
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@@ -172,12 +165,13 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
||||
/**
|
||||
* @param {ol.format.Feature} format Format.
|
||||
* @param {string} text Text.
|
||||
* @param {olx.format.ReadOptions} options Read options.
|
||||
* @private
|
||||
* @return {Array.<ol.Feature>} Features.
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text) {
|
||||
ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text, options) {
|
||||
try {
|
||||
return format.readFeatures(text);
|
||||
return format.readFeatures(text, options);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
@@ -203,7 +197,7 @@ ol.interaction.DragAndDropEventType = {
|
||||
* of this type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {goog.events.Event}
|
||||
* @extends {ol.events.Event}
|
||||
* @implements {oli.interaction.DragAndDropEvent}
|
||||
* @param {ol.interaction.DragAndDropEventType} type Type.
|
||||
* @param {Object} target Target.
|
||||
@@ -237,4 +231,4 @@ ol.interaction.DragAndDropEvent = function(type, target, file, opt_features, opt
|
||||
this.projection = opt_projection;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.DragAndDropEvent, goog.events.Event);
|
||||
goog.inherits(ol.interaction.DragAndDropEvent, ol.events.Event);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
goog.provide('ol.DragBoxEvent');
|
||||
goog.provide('ol.interaction.DragBox');
|
||||
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.condition');
|
||||
@@ -54,7 +54,7 @@ ol.DragBoxEventType = {
|
||||
* @param {string} type The event type.
|
||||
* @param {ol.Coordinate} coordinate The event coordinate.
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Originating event.
|
||||
* @extends {goog.events.Event}
|
||||
* @extends {ol.events.Event}
|
||||
* @constructor
|
||||
* @implements {oli.DragBoxEvent}
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ ol.DragBoxEvent = function(type, coordinate, mapBrowserEvent) {
|
||||
this.mapBrowserEvent = mapBrowserEvent;
|
||||
|
||||
};
|
||||
goog.inherits(ol.DragBoxEvent, goog.events.Event);
|
||||
goog.inherits(ol.DragBoxEvent, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
@@ -234,8 +234,8 @@ ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (browserEvent.isMouseActionButton() && this.condition_(mapBrowserEvent)) {
|
||||
if (ol.events.condition.mouseActionButton(mapBrowserEvent) &&
|
||||
this.condition_(mapBrowserEvent)) {
|
||||
this.startPixel_ = mapBrowserEvent.pixel;
|
||||
this.box_.setMap(mapBrowserEvent.map);
|
||||
this.box_.setPixels(this.startPixel_, this.startPixel_);
|
||||
|
||||
@@ -112,8 +112,8 @@ ol.interaction.DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (browserEvent.isMouseActionButton() && this.condition_(mapBrowserEvent)) {
|
||||
if (ol.events.condition.mouseActionButton(mapBrowserEvent) &&
|
||||
this.condition_(mapBrowserEvent)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
map.getView().setHint(ol.ViewHint.INTERACTING, 1);
|
||||
map.render();
|
||||
|
||||
@@ -5,8 +5,8 @@ goog.provide('ol.interaction.DrawGeometryFunctionType');
|
||||
goog.provide('ol.interaction.DrawMode');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Feature');
|
||||
@@ -55,7 +55,7 @@ ol.interaction.DrawEventType = {
|
||||
* this type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {goog.events.Event}
|
||||
* @extends {ol.events.Event}
|
||||
* @implements {oli.DrawEvent}
|
||||
* @param {ol.interaction.DrawEventType} type Type.
|
||||
* @param {ol.Feature} feature The feature drawn.
|
||||
@@ -72,7 +72,7 @@ ol.interaction.DrawEvent = function(type, feature) {
|
||||
this.feature = feature;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.DrawEvent, goog.events.Event);
|
||||
goog.inherits(ol.interaction.DrawEvent, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
@@ -300,9 +300,9 @@ ol.interaction.Draw = function(options) {
|
||||
this.freehandCondition_ = options.freehandCondition ?
|
||||
options.freehandCondition : ol.events.condition.shiftKeyOnly;
|
||||
|
||||
goog.events.listen(this,
|
||||
ol.events.listen(this,
|
||||
ol.Object.getChangeEventType(ol.interaction.InteractionProperty.ACTIVE),
|
||||
this.updateState_, false, this);
|
||||
this.updateState_, this);
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.Draw, ol.interaction.Pointer);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.interaction.KeyboardPan');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.events.KeyCode');
|
||||
goog.require('ol.events.condition');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
@@ -73,25 +73,24 @@ goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
(mapBrowserEvent.browserEvent);
|
||||
if (mapBrowserEvent.type == ol.events.EventType.KEYDOWN) {
|
||||
var keyEvent = mapBrowserEvent.originalEvent;
|
||||
var keyCode = keyEvent.keyCode;
|
||||
if (this.condition_(mapBrowserEvent) &&
|
||||
(keyCode == goog.events.KeyCodes.DOWN ||
|
||||
keyCode == goog.events.KeyCodes.LEFT ||
|
||||
keyCode == goog.events.KeyCodes.RIGHT ||
|
||||
keyCode == goog.events.KeyCodes.UP)) {
|
||||
(keyCode == ol.events.KeyCode.DOWN ||
|
||||
keyCode == ol.events.KeyCode.LEFT ||
|
||||
keyCode == ol.events.KeyCode.RIGHT ||
|
||||
keyCode == ol.events.KeyCode.UP)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(view, 'map must have view');
|
||||
var mapUnitsDelta = view.getResolution() * this.pixelDelta_;
|
||||
var deltaX = 0, deltaY = 0;
|
||||
if (keyCode == goog.events.KeyCodes.DOWN) {
|
||||
if (keyCode == ol.events.KeyCode.DOWN) {
|
||||
deltaY = -mapUnitsDelta;
|
||||
} else if (keyCode == goog.events.KeyCodes.LEFT) {
|
||||
} else if (keyCode == ol.events.KeyCode.LEFT) {
|
||||
deltaX = -mapUnitsDelta;
|
||||
} else if (keyCode == goog.events.KeyCodes.RIGHT) {
|
||||
} else if (keyCode == ol.events.KeyCode.RIGHT) {
|
||||
deltaX = mapUnitsDelta;
|
||||
} else {
|
||||
deltaY = mapUnitsDelta;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.interaction.KeyboardZoom');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.events.condition');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
@@ -66,9 +66,9 @@ goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.KeyboardZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
(mapBrowserEvent.browserEvent);
|
||||
if (mapBrowserEvent.type == ol.events.EventType.KEYDOWN ||
|
||||
mapBrowserEvent.type == ol.events.EventType.KEYPRESS) {
|
||||
var keyEvent = mapBrowserEvent.originalEvent;
|
||||
var charCode = keyEvent.charCode;
|
||||
if (this.condition_(mapBrowserEvent) &&
|
||||
(charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
goog.provide('ol.interaction.Modify');
|
||||
goog.provide('ol.interaction.ModifyEvent');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.Event');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Collection');
|
||||
@@ -14,6 +13,7 @@ goog.require('ol.Feature');
|
||||
goog.require('ol.MapBrowserEvent.EventType');
|
||||
goog.require('ol.MapBrowserPointerEvent');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events.condition');
|
||||
goog.require('ol.extent');
|
||||
@@ -55,7 +55,7 @@ ol.ModifyEventType = {
|
||||
* this type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {goog.events.Event}
|
||||
* @extends {ol.events.Event}
|
||||
* @implements {oli.ModifyEvent}
|
||||
* @param {ol.ModifyEventType} type Type.
|
||||
* @param {ol.Collection.<ol.Feature>} features The features modified.
|
||||
@@ -80,7 +80,7 @@ ol.interaction.ModifyEvent = function(type, features, mapBrowserPointerEvent) {
|
||||
*/
|
||||
this.mapBrowserPointerEvent = mapBrowserPointerEvent;
|
||||
};
|
||||
goog.inherits(ol.interaction.ModifyEvent, goog.events.Event);
|
||||
goog.inherits(ol.interaction.ModifyEvent, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
@@ -229,10 +229,10 @@ ol.interaction.Modify = function(options) {
|
||||
this.features_ = options.features;
|
||||
|
||||
this.features_.forEach(this.addFeature_, this);
|
||||
goog.events.listen(this.features_, ol.CollectionEventType.ADD,
|
||||
this.handleFeatureAdd_, false, this);
|
||||
goog.events.listen(this.features_, ol.CollectionEventType.REMOVE,
|
||||
this.handleFeatureRemove_, false, this);
|
||||
ol.events.listen(this.features_, ol.CollectionEventType.ADD,
|
||||
this.handleFeatureAdd_, this);
|
||||
ol.events.listen(this.features_, ol.CollectionEventType.REMOVE,
|
||||
this.handleFeatureRemove_, this);
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.Modify, ol.interaction.Pointer);
|
||||
@@ -251,8 +251,8 @@ ol.interaction.Modify.prototype.addFeature_ = function(feature) {
|
||||
if (map) {
|
||||
this.handlePointerAtPixel_(this.lastPixel_, map);
|
||||
}
|
||||
goog.events.listen(feature, goog.events.EventType.CHANGE,
|
||||
this.handleFeatureChange_, false, this);
|
||||
ol.events.listen(feature, ol.events.EventType.CHANGE,
|
||||
this.handleFeatureChange_, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -281,8 +281,8 @@ ol.interaction.Modify.prototype.removeFeature_ = function(feature) {
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
goog.events.unlisten(feature, goog.events.EventType.CHANGE,
|
||||
this.handleFeatureChange_, false, this);
|
||||
ol.events.unlisten(feature, ol.events.EventType.CHANGE,
|
||||
this.handleFeatureChange_, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ ol.interaction.Modify.prototype.handleFeatureAdd_ = function(evt) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.Event} evt Event.
|
||||
* @param {ol.events.Event} evt Event.
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.Modify.prototype.handleFeatureChange_ = function(evt) {
|
||||
@@ -999,9 +999,7 @@ ol.interaction.Modify.prototype.updateSegmentIndices_ = function(
|
||||
this.rBush_.forEachInExtent(geometry.getExtent(), function(segmentDataMatch) {
|
||||
if (segmentDataMatch.geometry === geometry &&
|
||||
(depth === undefined || segmentDataMatch.depth === undefined ||
|
||||
goog.array.equals(
|
||||
/** @type {null|{length: number}} */ (segmentDataMatch.depth),
|
||||
depth)) &&
|
||||
ol.array.equals(segmentDataMatch.depth, depth)) &&
|
||||
segmentDataMatch.index > index) {
|
||||
segmentDataMatch.index += delta;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user