Compare commits
250 Commits
v4.1.2-bet
...
v4.3.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cf01037aa | ||
|
|
89ec2dacad | ||
|
|
b97439cf8e | ||
|
|
b7b2ee0c57 | ||
|
|
fe39b5da1b | ||
|
|
bc0bc3f8a9 | ||
|
|
9c0d0c5681 | ||
|
|
b97daf844b | ||
|
|
f8237c9cd2 | ||
|
|
b317a4474e | ||
|
|
b1772dae44 | ||
|
|
c33383d248 | ||
|
|
645e359cde | ||
|
|
fa71593a2a | ||
|
|
2e903c0293 | ||
|
|
aced192bcd | ||
|
|
19b0b956f7 | ||
|
|
9f9355ac46 | ||
|
|
f28e6c2d95 | ||
|
|
e633380221 | ||
|
|
5f6f757bd0 | ||
|
|
b29fc52842 | ||
|
|
791ffaabeb | ||
|
|
c31d67fe57 | ||
|
|
a1710be335 | ||
|
|
2260d92436 | ||
|
|
4d0e106d98 | ||
|
|
8bc4bde5c3 | ||
|
|
429e2982d0 | ||
|
|
23f8540b4c | ||
|
|
59d8d749e3 | ||
|
|
cff9ef5e63 | ||
|
|
e6e0109a1b | ||
|
|
7739239e89 | ||
|
|
eb8d5bcade | ||
|
|
ff242ef28c | ||
|
|
4a0f97ac6a | ||
|
|
a0e0e76995 | ||
|
|
b5f9b88d0e | ||
|
|
339f048826 | ||
|
|
4f0bfbc1db | ||
|
|
db63cc1b23 | ||
|
|
f88d8b8a7d | ||
|
|
991328904d | ||
|
|
9d3539b3cb | ||
|
|
bd143c0ad1 | ||
|
|
970265acb0 | ||
|
|
36c80f61bc | ||
|
|
d86c7c22dc | ||
|
|
71b334d49c | ||
|
|
ee0eb8b1a0 | ||
|
|
cd4ed759ed | ||
|
|
c0e4da6d8c | ||
|
|
72f5ff917f | ||
|
|
4c9c9fa719 | ||
|
|
163e01a2dc | ||
|
|
79862ca8c2 | ||
|
|
aa8d7b0b36 | ||
|
|
8d0857fd7a | ||
|
|
67f69a32bb | ||
|
|
382674975e | ||
|
|
eaaa895b0a | ||
|
|
70b971d3a4 | ||
|
|
3ddb8712a3 | ||
|
|
533ca8b9fe | ||
|
|
0fc710bc48 | ||
|
|
fe18636ff9 | ||
|
|
c299bfcd0f | ||
|
|
3f5a6bca26 | ||
|
|
a6b35e7d8a | ||
|
|
619e85e737 | ||
|
|
b3407b0554 | ||
|
|
a4c421e699 | ||
|
|
a3a443324d | ||
|
|
7b9833fdce | ||
|
|
bd87ec7c83 | ||
|
|
26bfa7a172 | ||
|
|
f82bc15013 | ||
|
|
da60b96445 | ||
|
|
2ed5abed07 | ||
|
|
49dcda7794 | ||
|
|
9fc0fb5e74 | ||
|
|
d32006b324 | ||
|
|
feabb6440d | ||
|
|
87e9c9ad46 | ||
|
|
7d6929c710 | ||
|
|
887642e69c | ||
|
|
b9e6619b2d | ||
|
|
78b5fe5f8c | ||
|
|
72e9b74b3e | ||
|
|
c6aeda1511 | ||
|
|
eb501e1244 | ||
|
|
1f51c14e7e | ||
|
|
dee3ebdc54 | ||
|
|
d0ef05977b | ||
|
|
a17db4f45c | ||
|
|
20974fea55 | ||
|
|
416df98505 | ||
|
|
fb5891cd48 | ||
|
|
1d4a482c1a | ||
|
|
8d57a879ce | ||
|
|
3e7aecd094 | ||
|
|
c46bc1f02a | ||
|
|
0d0ed6c130 | ||
|
|
0045bed6e7 | ||
|
|
0982dc0551 | ||
|
|
e38efc7cbe | ||
|
|
ea4e5f2293 | ||
|
|
29d1590bc6 | ||
|
|
e14ee2ea72 | ||
|
|
68ca4b3c2a | ||
|
|
4ad85e52e2 | ||
|
|
4255e81b93 | ||
|
|
81e8cdc7ab | ||
|
|
b1b5b54fd0 | ||
|
|
109362f147 | ||
|
|
b5038c18e2 | ||
|
|
87d889f96c | ||
|
|
9b41ea4017 | ||
|
|
51658a0d7c | ||
|
|
2f45e14bea | ||
|
|
aa56afdab7 | ||
|
|
9fda131d37 | ||
|
|
b3ddcd4ed9 | ||
|
|
107792635d | ||
|
|
7ea8cf5fb3 | ||
|
|
1d6ce6db35 | ||
|
|
4e44a09072 | ||
|
|
dc6d0c091a | ||
|
|
af6aaf4bab | ||
|
|
e822731f8c | ||
|
|
a23246aca1 | ||
|
|
f31e45d7d2 | ||
|
|
34e61da366 | ||
|
|
451aef200f | ||
|
|
bb8a1b061c | ||
|
|
d4367cdd7d | ||
|
|
3b15bb80b9 | ||
|
|
399e11edf7 | ||
|
|
f97f370e5b | ||
|
|
070f2e181c | ||
|
|
9d9da4feb9 | ||
|
|
ce858a80ed | ||
|
|
4898c83590 | ||
|
|
d8ed2eb1be | ||
|
|
00c8a5845e | ||
|
|
d8dba61b0a | ||
|
|
b8117b3931 | ||
|
|
aface2f43e | ||
|
|
9691130b83 | ||
|
|
1fbf3caa50 | ||
|
|
e3128c204e | ||
|
|
1e6b27d42a | ||
|
|
c24bd209e6 | ||
|
|
df96cc6e56 | ||
|
|
641549c9ed | ||
|
|
66e0308028 | ||
|
|
22939abb0d | ||
|
|
dfc4bff579 | ||
|
|
588223915c | ||
|
|
5702670bd3 | ||
|
|
d79760e9dd | ||
|
|
21011d00ea | ||
|
|
23cb98272c | ||
|
|
b8b2712f73 | ||
|
|
8b6a29decf | ||
|
|
5475841ca0 | ||
|
|
e8a2ad1d1b | ||
|
|
54a62ea78d | ||
|
|
bcda41b508 | ||
|
|
c0fac0f5ca | ||
|
|
0faf0dd2a1 | ||
|
|
9a698ce1e8 | ||
|
|
a7683c60c9 | ||
|
|
9412b770bf | ||
|
|
29a6473c3d | ||
|
|
7ceed1f42d | ||
|
|
959367629e | ||
|
|
aeed1f79bb | ||
|
|
278d3a0313 | ||
|
|
5af9f71d38 | ||
|
|
b6f446e909 | ||
|
|
7804a2db86 | ||
|
|
0e4d2b50b4 | ||
|
|
b594cf0d74 | ||
|
|
074fdeb212 | ||
|
|
a1355ee766 | ||
|
|
c3e1bb40f4 | ||
|
|
661410a96e | ||
|
|
e272eced94 | ||
|
|
4ab901ed43 | ||
|
|
c1abe4a550 | ||
|
|
3fc76f9c10 | ||
|
|
1e304f56cb | ||
|
|
5929826c5f | ||
|
|
9dad36b117 | ||
|
|
8b9f994cea | ||
|
|
7ecb2c0185 | ||
|
|
342c49f0bb | ||
|
|
bb220b5c3b | ||
|
|
3455f00d23 | ||
|
|
992ab7120c | ||
|
|
5215722c78 | ||
|
|
56b3203fa9 | ||
|
|
3cc4a0c6e3 | ||
|
|
556ede5960 | ||
|
|
46c610f35e | ||
|
|
18357be938 | ||
|
|
a9f369479f | ||
|
|
8c00bbc91d | ||
|
|
9af01c515f | ||
|
|
567cc304ed | ||
|
|
98a1654b47 | ||
|
|
ddbe1986ad | ||
|
|
ac19d4d19c | ||
|
|
142f16afe4 | ||
|
|
07810818cc | ||
|
|
4664a19718 | ||
|
|
46f59acdce | ||
|
|
c61189121e | ||
|
|
8c14262efc | ||
|
|
fa398766d9 | ||
|
|
026fcc66c9 | ||
|
|
7c5a3ae311 | ||
|
|
feacf7614e | ||
|
|
8609e65fc2 | ||
|
|
3ff33699c8 | ||
|
|
df72d7b20f | ||
|
|
1d7144564c | ||
|
|
aced2e4e94 | ||
|
|
9b9ac03760 | ||
|
|
c052de2bbc | ||
|
|
85d0e9797c | ||
|
|
f975319d02 | ||
|
|
b8164df349 | ||
|
|
1458d77844 | ||
|
|
052f2ac321 | ||
|
|
4a6945ac17 | ||
|
|
c9ca9737a7 | ||
|
|
2e1495fc07 | ||
|
|
55de3020d3 | ||
|
|
ff91974345 | ||
|
|
e7dc09cf9f | ||
|
|
fcf9649ef9 | ||
|
|
55e3746554 | ||
|
|
a59a147dbd | ||
|
|
355ce9f679 | ||
|
|
785e7135a7 | ||
|
|
25aeb58c87 | ||
|
|
dd73ac8892 |
@@ -2,6 +2,36 @@
|
|||||||
|
|
||||||
### Next release
|
### Next release
|
||||||
|
|
||||||
|
#### `ol.animate` now takes the shortest arc for rotation animation
|
||||||
|
|
||||||
|
Usually rotation animations should animate along the shortest arc. There are rare occasions where a spinning animation effect is desired. So if you previously had something like
|
||||||
|
```js
|
||||||
|
map.getView().animate({
|
||||||
|
rotation: 2 * Math.PI,
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
```
|
||||||
|
we recommend to split the animation into two parts and use different easing functions. The code below results in the same effect as the snippet above did with previous versions:
|
||||||
|
```js
|
||||||
|
map.getView().animate({
|
||||||
|
rotation: Math.PI,
|
||||||
|
easing: ol.easing.easeIn
|
||||||
|
}, {
|
||||||
|
rotation: 2 * Math.PI,
|
||||||
|
easing: ol.easing.easeOut
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### v4.2.0
|
||||||
|
|
||||||
|
#### Return values of two `ol.style.RegularShape` getters have changed
|
||||||
|
|
||||||
|
To provide a more consistent behaviour the following getters now return the same value that was given to constructor:
|
||||||
|
|
||||||
|
`ol.style.RegularShape#getPoints` does not return the double amount of points anymore if a radius2 is set.
|
||||||
|
|
||||||
|
`ol.style.RegularShape#getRadius2` will return `undefined` if no radius2 is set.
|
||||||
|
|
||||||
### v4.1.0
|
### v4.1.0
|
||||||
|
|
||||||
#### Adding duplicate layers to a map throws
|
#### Adding duplicate layers to a map throws
|
||||||
|
|||||||
151
changelog/v4.2.0.md
Normal file
151
changelog/v4.2.0.md
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
# 4.2.0
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
The v4.2.0 release includes features and fixes from 87 pull requests.
|
||||||
|
|
||||||
|
#### New `movestart` event on `ol.Map`
|
||||||
|
|
||||||
|
The map now has a `movestart` event, as countarpart to the already existing `moveend` event.
|
||||||
|
|
||||||
|
#### New `moveTolerance` option in `ol.Map`
|
||||||
|
|
||||||
|
Some touch devices do not play well with OpenLayers's way of detecting clicks. To overcome this, a new `moveTolerance` option was introduced, so users can override the 1 pixel threshold above which a touch-release sequence won't be considered a click any more.
|
||||||
|
|
||||||
|
#### Support for multiple layers in `ol.format.TopoJSON`
|
||||||
|
|
||||||
|
With the new `layerName` and `layers` options, applications can extract the layer as additional attribute for vector features from `ol.format.TopoJSON`. This can especially be useful for styling vector tile layers.
|
||||||
|
|
||||||
|
#### New `tileJSON` option for `ol.source.TileJSON`
|
||||||
|
|
||||||
|
Like `ol.source.TileUTFGrid`, `ol.source.TileJSON` now also has a `tileJSON` option to configue it with inline TileJSON instead of a TileJSON URL.
|
||||||
|
|
||||||
|
#### New `ol.format.filter.during` filter
|
||||||
|
|
||||||
|
Although OpenLayers has no support for WFS v2.0, we added `ol.format.filter.during` for the `During` temporal operator.
|
||||||
|
|
||||||
|
#### Improved vector tile rendering at non-native resolutions
|
||||||
|
|
||||||
|
The vector tile renderer now uses an internal tile grid for all resolutions to cache pre-rendered tiles, even if the tile source does not have tiles for the viewed resolution. This improves rendering quality and performance.
|
||||||
|
|
||||||
|
#### New `insertVertexCondition` for `ol.interaction.Modify`
|
||||||
|
|
||||||
|
Applications can now control whether a vertex will be inserted into the modified geometry. This makes it easier to modify custom geometries.
|
||||||
|
|
||||||
|
#### New `callback` option for `ol.View#fit()`
|
||||||
|
|
||||||
|
To allow applications to perform custom actions when an animation associated with `ol.View#fit()` is completed, that method now has a new `callback` option.
|
||||||
|
|
||||||
|
#### New `ol.View#getInteracting()` getter
|
||||||
|
|
||||||
|
Like `ol.View#getAnimating()` returns `true` during a view animation, `ol.View#getInteracting()` returns `true` while users are interacting with the view.
|
||||||
|
|
||||||
|
#### New `hasZ` option for `ol.format.WFS#writeTransaction()`
|
||||||
|
|
||||||
|
When the new `hasZ` option is set to `true`, 3D coordinates will be preserved and encoded when writing a WFS transaction.
|
||||||
|
|
||||||
|
#### New `wrapX` option for `ol.source.Stamen`
|
||||||
|
|
||||||
|
Like other tile sources, `ol.source.Stamen` now also has a `wrapX` option, which allows applications to turn off wrapping the world in x direction.
|
||||||
|
|
||||||
|
#### Label support for `ol.Graticule`
|
||||||
|
|
||||||
|
The `ol.Graticule` component has several new options to add and control the output of labels. To turn on labelling, configure `ol.Graticule` with `showLabels: true`. The new options to control label formatting are `lonLabelFormatter`, `latLabelFormatter`, `lonLabelPosition` and `latLabelPosition`.
|
||||||
|
|
||||||
|
#### Return values of two `ol.style.RegularShape` getters have changed
|
||||||
|
|
||||||
|
To provide a more consistent behaviour the following getters now return the same value that was given to constructor:
|
||||||
|
|
||||||
|
`ol.style.RegularShape#getPoints` does not return the double amount of points anymore if a radius2 is set.
|
||||||
|
|
||||||
|
`ol.style.RegularShape#getRadius2` will return `undefined` if no radius2 is set.
|
||||||
|
|
||||||
|
## Detailed changes
|
||||||
|
|
||||||
|
* [#6912](https://github.com/openlayers/openlayers/pull/6912) - Use class instead of style for Translate cursor ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6858](https://github.com/openlayers/openlayers/pull/6858) - Webgl vector improvements ([@GaborFarkas](https://github.com/GaborFarkas))
|
||||||
|
* [#6890](https://github.com/openlayers/openlayers/pull/6890) - Add a movestart event ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6910](https://github.com/openlayers/openlayers/pull/6910) - Avoid duplicates in Observables list ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6902](https://github.com/openlayers/openlayers/pull/6902) - Require minimum duration for kinetic animation ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6904](https://github.com/openlayers/openlayers/pull/6904) - chore(package): update sinon to version 2.3.4 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6901](https://github.com/openlayers/openlayers/pull/6901) - Added release note for changed methods of ol.style.regularShape ([@KlausBenndorf](https://github.com/KlausBenndorf))
|
||||||
|
* [#6886](https://github.com/openlayers/openlayers/pull/6886) - Make ol.source.Cluster extensible ([@gberaudo](https://github.com/gberaudo))
|
||||||
|
* [#6887](https://github.com/openlayers/openlayers/pull/6887) - Disable rotation for views with enableRotation: false ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6900](https://github.com/openlayers/openlayers/pull/6900) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6897](https://github.com/openlayers/openlayers/pull/6897) - ProjectionLike in proj.getPointResolution ([@probins](https://github.com/probins))
|
||||||
|
* [#6888](https://github.com/openlayers/openlayers/pull/6888) - Add note about custom functions to getPointResolution ([@probins](https://github.com/probins))
|
||||||
|
* [#6893](https://github.com/openlayers/openlayers/pull/6893) - Fix decimals options when writing features ([@tchandelle](https://github.com/tchandelle))
|
||||||
|
* [#6759](https://github.com/openlayers/openlayers/pull/6759) - Regular shape points ([@KlausBenndorf](https://github.com/KlausBenndorf))
|
||||||
|
* [#6892](https://github.com/openlayers/openlayers/pull/6892) - Accept a ol.ProjectionLike instead of ol.proj.Projection ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6883](https://github.com/openlayers/openlayers/pull/6883) - Remove unused ol.pointer.EventSource#getMapping function ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6870](https://github.com/openlayers/openlayers/pull/6870) - Center map on proper earth, not one to the left ([@kannes](https://github.com/kannes))
|
||||||
|
* [#6872](https://github.com/openlayers/openlayers/pull/6872) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6876](https://github.com/openlayers/openlayers/pull/6876) - Only test ol.interaction.DragAndDrop if FileReader is supported ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6874](https://github.com/openlayers/openlayers/pull/6874) - Remove unused var from ol.proj ([@probins](https://github.com/probins))
|
||||||
|
* [#6875](https://github.com/openlayers/openlayers/pull/6875) - chore(package): update sinon to version 2.3.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6867](https://github.com/openlayers/openlayers/pull/6867) - add getArea to api ([@cs09g](https://github.com/cs09g))
|
||||||
|
* [#6863](https://github.com/openlayers/openlayers/pull/6863) - change size to optional ([@cs09g](https://github.com/cs09g))
|
||||||
|
* [#6864](https://github.com/openlayers/openlayers/pull/6864) - fix(package): update closure-util to version 1.21.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6834](https://github.com/openlayers/openlayers/pull/6834) - Move tolerance option ([@notnotse](https://github.com/notnotse))
|
||||||
|
* [#6856](https://github.com/openlayers/openlayers/pull/6856) - Fix creation of new URL in readSharedStyle_ and readSharedStyleMap_ ([@oterral](https://github.com/oterral))
|
||||||
|
* [#6852](https://github.com/openlayers/openlayers/pull/6852) - Update mocha to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6851](https://github.com/openlayers/openlayers/pull/6851) - Register/unregister listeners in setActive ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6832](https://github.com/openlayers/openlayers/pull/6832) - Force state of error tiles when usInterimTilesOnError is false ([@oterral](https://github.com/oterral))
|
||||||
|
* [#6849](https://github.com/openlayers/openlayers/pull/6849) - Create URL object only when we can ([@oterral](https://github.com/oterral))
|
||||||
|
* [#6845](https://github.com/openlayers/openlayers/pull/6845) - Snap on circles ([@tchandelle](https://github.com/tchandelle))
|
||||||
|
* [#6842](https://github.com/openlayers/openlayers/pull/6842) - add condition to check if active ([@cs09g](https://github.com/cs09g))
|
||||||
|
* [#6844](https://github.com/openlayers/openlayers/pull/6844) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6841](https://github.com/openlayers/openlayers/pull/6841) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6839](https://github.com/openlayers/openlayers/pull/6839) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6838](https://github.com/openlayers/openlayers/pull/6838) - fix(package): update handlebars to version 4.0.10 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6817](https://github.com/openlayers/openlayers/pull/6817) - Multiple layers in TopoJSON vector tiles ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6833](https://github.com/openlayers/openlayers/pull/6833) - Fix geojson-vt example for line and point geometries ([@oterral](https://github.com/oterral))
|
||||||
|
* [#6829](https://github.com/openlayers/openlayers/pull/6829) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6819](https://github.com/openlayers/openlayers/pull/6819) - Adjust/fix API for working with vector tile features ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6818](https://github.com/openlayers/openlayers/pull/6818) - Add tileJSON option to ol.source.TileJSON ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6805](https://github.com/openlayers/openlayers/pull/6805) - Display country name on click select ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6813](https://github.com/openlayers/openlayers/pull/6813) - Prepend the version with a v ([@tschaub](https://github.com/tschaub))
|
||||||
|
* [#6814](https://github.com/openlayers/openlayers/pull/6814) - Re-add ol.render.Feature#getGeometry() ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6812](https://github.com/openlayers/openlayers/pull/6812) - Update mocha to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6786](https://github.com/openlayers/openlayers/pull/6786) - Add ol.format.filter.during ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6806](https://github.com/openlayers/openlayers/pull/6806) - Add note about features with the same id ([@drnextgis](https://github.com/drnextgis))
|
||||||
|
* [#6802](https://github.com/openlayers/openlayers/pull/6802) - Remove unused setFeatures and getFormat methods ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6801](https://github.com/openlayers/openlayers/pull/6801) - Add getId method for ol.render.Feature ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6778](https://github.com/openlayers/openlayers/pull/6778) - Add a small tolerance when testing pointer event positions ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6796](https://github.com/openlayers/openlayers/pull/6796) - Re-add accidently dropped condition ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6798](https://github.com/openlayers/openlayers/pull/6798) - chore(package): update clean-css-cli to version 4.1.2 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6795](https://github.com/openlayers/openlayers/pull/6795) - Fix ol.DrawGeometryFunctionType coordinates argument type ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6797](https://github.com/openlayers/openlayers/pull/6797) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6779](https://github.com/openlayers/openlayers/pull/6779) - Decouple source and rendered tile grid of vector tile sources ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6785](https://github.com/openlayers/openlayers/pull/6785) - Add insertVertexCondition to ol.interaction.Modify options ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6792](https://github.com/openlayers/openlayers/pull/6792) - Create intermediate canvas when resolutions have changed ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6790](https://github.com/openlayers/openlayers/pull/6790) - Update resemblejs to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6784](https://github.com/openlayers/openlayers/pull/6784) - chore(package): update clean-css-cli to version 4.1.0 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6556](https://github.com/openlayers/openlayers/pull/6556) - Reading kml xunits/yunits insetPixels ([@KlausBenndorf](https://github.com/KlausBenndorf))
|
||||||
|
* [#6775](https://github.com/openlayers/openlayers/pull/6775) - Update closure-util to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6774](https://github.com/openlayers/openlayers/pull/6774) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6770](https://github.com/openlayers/openlayers/pull/6770) - Enforce the "no missing requires" rule ([@tschaub](https://github.com/tschaub))
|
||||||
|
* [#6772](https://github.com/openlayers/openlayers/pull/6772) - Remove html tag from shortdesc ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6769](https://github.com/openlayers/openlayers/pull/6769) - Update handlebars to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6757](https://github.com/openlayers/openlayers/pull/6757) - Fix crashing on creation of snap-interaction, if Circle is among the features to snap to. ([@hajjimurad](https://github.com/hajjimurad))
|
||||||
|
* [#6766](https://github.com/openlayers/openlayers/pull/6766) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6765](https://github.com/openlayers/openlayers/pull/6765) - Add new callback function to view.FitOptions ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6764](https://github.com/openlayers/openlayers/pull/6764) - Added View#getInteracting() to the api ([@mblinsitu](https://github.com/mblinsitu))
|
||||||
|
* [#6760](https://github.com/openlayers/openlayers/pull/6760) - Update handlebars to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6761](https://github.com/openlayers/openlayers/pull/6761) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6755](https://github.com/openlayers/openlayers/pull/6755) - Add missing goog.require ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6751](https://github.com/openlayers/openlayers/pull/6751) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6750](https://github.com/openlayers/openlayers/pull/6750) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6741](https://github.com/openlayers/openlayers/pull/6741) - Allow user selection in overlay container ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6744](https://github.com/openlayers/openlayers/pull/6744) - Update mocha to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6737](https://github.com/openlayers/openlayers/pull/6737) - Graticule labels ([@ahocevar](https://github.com/ahocevar))
|
||||||
|
* [#6740](https://github.com/openlayers/openlayers/pull/6740) - Fix spelling ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6730](https://github.com/openlayers/openlayers/pull/6730) - Update metalsmith-layouts to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6732](https://github.com/openlayers/openlayers/pull/6732) - Use firefox < 53 in travis ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6677](https://github.com/openlayers/openlayers/pull/6677) - Add an option to writeTransaction to support 3D geometries ([@Jenselme](https://github.com/Jenselme))
|
||||||
|
* [#6524](https://github.com/openlayers/openlayers/pull/6524) - Don't append feature prefix twice in WFS requests ([@Jenselme](https://github.com/Jenselme))
|
||||||
|
* [#6727](https://github.com/openlayers/openlayers/pull/6727) - Add default value in doc for the hitTolerance option ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6724](https://github.com/openlayers/openlayers/pull/6724) - Add wrapX option to Stamen source ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6728](https://github.com/openlayers/openlayers/pull/6728) - Fix tissot examples docs ([@fredj](https://github.com/fredj))
|
||||||
|
* [#6725](https://github.com/openlayers/openlayers/pull/6725) - Update dependencies to enable Greenkeeper 🌴 ([@openlayers](https://github.com/openlayers))
|
||||||
|
* [#6711](https://github.com/openlayers/openlayers/pull/6711) - Correct path to cleancss ([@tschaub](https://github.com/tschaub))
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"opts": {
|
"opts": {
|
||||||
"recurse": true,
|
"recurse": true,
|
||||||
"template": "config/jsdoc/api/template"
|
"template": "../../config/jsdoc/api/template"
|
||||||
},
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
"allowUnknownTags": true
|
"allowUnknownTags": true
|
||||||
@@ -16,12 +16,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"node_modules/jsdoc/plugins/markdown",
|
"plugins/markdown",
|
||||||
"config/jsdoc/api/plugins/inheritdoc",
|
"../../config/jsdoc/api/plugins/inheritdoc",
|
||||||
"config/jsdoc/api/plugins/typedefs",
|
"../../config/jsdoc/api/plugins/typedefs",
|
||||||
"config/jsdoc/api/plugins/events",
|
"../../config/jsdoc/api/plugins/events",
|
||||||
"config/jsdoc/api/plugins/observable",
|
"../../config/jsdoc/api/plugins/observable",
|
||||||
"config/jsdoc/api/plugins/api"
|
"../../config/jsdoc/api/plugins/api"
|
||||||
],
|
],
|
||||||
"markdown": {
|
"markdown": {
|
||||||
"parser": "gfm"
|
"parser": "gfm"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ exports.handlers = {
|
|||||||
cls.observables = [];
|
cls.observables = [];
|
||||||
}
|
}
|
||||||
observable = observables[doclet.observable];
|
observable = observables[doclet.observable];
|
||||||
if (cls.observables.indexOf(observable) == -1) {
|
if (observable.type && cls.observables.indexOf(observable) == -1) {
|
||||||
cls.observables.push(observable);
|
cls.observables.push(observable);
|
||||||
}
|
}
|
||||||
if (!cls.fires) {
|
if (!cls.fires) {
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?js
|
<?js
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var propsByName = {};
|
||||||
props.forEach(function(prop) {
|
props.forEach(function(prop) {
|
||||||
if (!prop) { return; }
|
if (!prop || propsByName[prop.name]) { return; }
|
||||||
|
propsByName[prop.name] = prop;
|
||||||
var setter = prop.readonly ? 'no' : 'yes';
|
var setter = prop.readonly ? 'no' : 'yes';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"opts": {
|
"opts": {
|
||||||
"recurse": true,
|
"recurse": true,
|
||||||
"template": "config/jsdoc/info"
|
"template": "../../config/jsdoc/info"
|
||||||
},
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
"allowUnknownTags": true
|
"allowUnknownTags": true
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
"includePattern": "\\.js$"
|
"includePattern": "\\.js$"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"config/jsdoc/info/api-plugin",
|
"../../config/jsdoc/info/api-plugin",
|
||||||
"config/jsdoc/info/define-plugin",
|
"../../config/jsdoc/info/define-plugin",
|
||||||
"config/jsdoc/info/virtual-plugin"
|
"../../config/jsdoc/info/virtual-plugin"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* an api tag) and boolean defines (with a define tag and a default value).
|
* an api tag) and boolean defines (with a define tag and a default value).
|
||||||
*/
|
*/
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var fs = require('fs');
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
|
|
||||||
@@ -89,7 +88,6 @@ exports.publish = function(data, opts) {
|
|||||||
types: getTypes(doc.type.names)
|
types: getTypes(doc.type.names)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var types;
|
|
||||||
var symbol = {
|
var symbol = {
|
||||||
name: doc.longname,
|
name: doc.longname,
|
||||||
kind: doc.kind,
|
kind: doc.kind,
|
||||||
@@ -169,13 +167,15 @@ exports.publish = function(data, opts) {
|
|||||||
return (symbol.name in augments || symbol.virtual);
|
return (symbol.name in augments || symbol.virtual);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.stdout.write(
|
return new Promise(function(resolve, reject) {
|
||||||
JSON.stringify({
|
process.stdout.write(
|
||||||
symbols: symbols,
|
JSON.stringify({
|
||||||
defines: defines,
|
symbols: symbols,
|
||||||
typedefs: typedefs,
|
defines: defines,
|
||||||
externs: externs,
|
typedefs: typedefs,
|
||||||
base: base
|
externs: externs,
|
||||||
}, null, 2));
|
base: base
|
||||||
|
}, null, 2));
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
11
css/ol.css
11
css/ol.css
@@ -49,6 +49,17 @@
|
|||||||
-ms-user-select: auto;
|
-ms-user-select: auto;
|
||||||
user-select: auto;
|
user-select: auto;
|
||||||
}
|
}
|
||||||
|
.ol-grabbing {
|
||||||
|
cursor: -webkit-grabbing;
|
||||||
|
cursor: -moz-grabbing;
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
.ol-grab {
|
||||||
|
cursor: move;
|
||||||
|
cursor: -webkit-grab;
|
||||||
|
cursor: -moz-grab;
|
||||||
|
cursor: grab;
|
||||||
|
}
|
||||||
.ol-control {
|
.ol-control {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: rgba(255,255,255,0.4);
|
background-color: rgba(255,255,255,0.4);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
|
goog.require('ol.easing');
|
||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
@@ -73,9 +74,16 @@ onClick('rotate-right', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onClick('rotate-around-rome', function() {
|
onClick('rotate-around-rome', function() {
|
||||||
|
// Rotation animation takes the shortest arc, so animate in two parts
|
||||||
|
var rotation = view.getRotation();
|
||||||
view.animate({
|
view.animate({
|
||||||
rotation: view.getRotation() + 2 * Math.PI,
|
rotation: rotation + Math.PI,
|
||||||
anchor: rome
|
anchor: rome,
|
||||||
|
easing: ol.easing.easeIn
|
||||||
|
}, {
|
||||||
|
rotation: rotation + 2 * Math.PI,
|
||||||
|
anchor: rome,
|
||||||
|
easing: ol.easing.easeOut
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -103,10 +111,19 @@ onClick('bounce-to-istanbul', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onClick('spin-to-rome', function() {
|
onClick('spin-to-rome', function() {
|
||||||
|
// Rotation animation takes the shortest arc, so animate in two parts
|
||||||
|
var center = view.getCenter();
|
||||||
view.animate({
|
view.animate({
|
||||||
|
center: [
|
||||||
|
center[0] + (rome[0] - center[0]) / 2,
|
||||||
|
center[1] + (rome[1] - center[1]) / 2
|
||||||
|
],
|
||||||
|
rotation: Math.PI,
|
||||||
|
easing: ol.easing.easeIn
|
||||||
|
}, {
|
||||||
center: rome,
|
center: rome,
|
||||||
rotation: 2 * Math.PI,
|
rotation: 2 * Math.PI,
|
||||||
duration: 2000
|
easing: ol.easing.easeOut
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ cloak:
|
|||||||
<select id="layer-select">
|
<select id="layer-select">
|
||||||
<option value="Aerial">Aerial</option>
|
<option value="Aerial">Aerial</option>
|
||||||
<option value="AerialWithLabels" selected>Aerial with labels</option>
|
<option value="AerialWithLabels" selected>Aerial with labels</option>
|
||||||
<option value="Road">Road</option>
|
<option value="Road">Road (static)</option>
|
||||||
|
<option value="RoadOnDemand">Road (dynamic)</option>
|
||||||
<option value="collinsBart">Collins Bart</option>
|
<option value="collinsBart">Collins Bart</option>
|
||||||
<option value="ordnanceSurvey">Ordnance Survey</option>
|
<option value="ordnanceSurvey">Ordnance Survey</option>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ goog.require('ol.source.BingMaps');
|
|||||||
|
|
||||||
var styles = [
|
var styles = [
|
||||||
'Road',
|
'Road',
|
||||||
|
'RoadOnDemand',
|
||||||
'Aerial',
|
'Aerial',
|
||||||
'AerialWithLabels',
|
'AerialWithLabels',
|
||||||
'collinsBart',
|
'collinsBart',
|
||||||
|
|||||||
@@ -45,29 +45,29 @@ var dragBox = new ol.interaction.DragBox({
|
|||||||
|
|
||||||
map.addInteraction(dragBox);
|
map.addInteraction(dragBox);
|
||||||
|
|
||||||
var infoBox = document.getElementById('info');
|
|
||||||
|
|
||||||
dragBox.on('boxend', function() {
|
dragBox.on('boxend', function() {
|
||||||
// features that intersect the box are added to the collection of
|
// features that intersect the box are added to the collection of
|
||||||
// selected features, and their names are displayed in the "info"
|
// selected features
|
||||||
// div
|
|
||||||
var info = [];
|
|
||||||
var extent = dragBox.getGeometry().getExtent();
|
var extent = dragBox.getGeometry().getExtent();
|
||||||
vectorSource.forEachFeatureIntersectingExtent(extent, function(feature) {
|
vectorSource.forEachFeatureIntersectingExtent(extent, function(feature) {
|
||||||
selectedFeatures.push(feature);
|
selectedFeatures.push(feature);
|
||||||
info.push(feature.get('name'));
|
|
||||||
});
|
});
|
||||||
if (info.length > 0) {
|
|
||||||
infoBox.innerHTML = info.join(', ');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// clear selection when drawing a new box and when clicking on the map
|
// clear selection when drawing a new box and when clicking on the map
|
||||||
dragBox.on('boxstart', function() {
|
dragBox.on('boxstart', function() {
|
||||||
selectedFeatures.clear();
|
selectedFeatures.clear();
|
||||||
infoBox.innerHTML = ' ';
|
|
||||||
});
|
});
|
||||||
map.on('click', function() {
|
|
||||||
selectedFeatures.clear();
|
var infoBox = document.getElementById('info');
|
||||||
infoBox.innerHTML = ' ';
|
|
||||||
|
selectedFeatures.on(['add', 'remove'], function() {
|
||||||
|
var names = selectedFeatures.getArray().map(function(feature) {
|
||||||
|
return feature.get('name');
|
||||||
|
});
|
||||||
|
if (names.length > 0) {
|
||||||
|
infoBox.innerHTML = names.join(', ');
|
||||||
|
} else {
|
||||||
|
infoBox.innerHTML = 'No countries selected';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ function rgb2xyz(x) {
|
|||||||
|
|
||||||
function xyz2rgb(x) {
|
function xyz2rgb(x) {
|
||||||
return 255 * (x <= 0.0031308 ?
|
return 255 * (x <= 0.0031308 ?
|
||||||
12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
|
||||||
}
|
}
|
||||||
|
|
||||||
var raster = new ol.source.Raster({
|
var raster = new ol.source.Raster({
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ var lineFeature = new ol.Feature(
|
|||||||
|
|
||||||
var polygonFeature = new ol.Feature(
|
var polygonFeature = new ol.Feature(
|
||||||
new ol.geom.Polygon([[[-3e6, -1e6], [-3e6, 1e6],
|
new ol.geom.Polygon([[[-3e6, -1e6], [-3e6, 1e6],
|
||||||
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
|
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
|
||||||
|
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ function stopAnimation(ended) {
|
|||||||
// if animation cancelled set the marker at the beginning
|
// if animation cancelled set the marker at the beginning
|
||||||
var coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
|
var coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
|
||||||
/** @type {ol.geom.Point} */ (geoMarker.getGeometry())
|
/** @type {ol.geom.Point} */ (geoMarker.getGeometry())
|
||||||
.setCoordinates(coord);
|
.setCoordinates(coord);
|
||||||
//remove listener
|
//remove listener
|
||||||
map.un('postcompose', moveFeature);
|
map.un('postcompose', moveFeature);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,18 +17,30 @@ var replacer = function(key, value) {
|
|||||||
var geometry = value.geometry;
|
var geometry = value.geometry;
|
||||||
|
|
||||||
if (rawType === 1) {
|
if (rawType === 1) {
|
||||||
type = geometry.length === 1 ? 'Point' : 'MultiPoint';
|
type = 'MultiPoint';
|
||||||
|
if (geometry.length == 1) {
|
||||||
|
type = 'Point';
|
||||||
|
geometry = geometry[0];
|
||||||
|
}
|
||||||
} else if (rawType === 2) {
|
} else if (rawType === 2) {
|
||||||
type = geometry.length === 1 ? 'LineString' : 'MultiLineString';
|
type = 'MultiLineString';
|
||||||
|
if (geometry.length == 1) {
|
||||||
|
type = 'LineString';
|
||||||
|
geometry = geometry[0];
|
||||||
|
}
|
||||||
} else if (rawType === 3) {
|
} else if (rawType === 3) {
|
||||||
type = geometry.length === 1 ? 'Polygon' : 'MultiPolygon';
|
type = 'Polygon';
|
||||||
|
if (geometry.length > 1) {
|
||||||
|
type = 'MultiPolygon';
|
||||||
|
geometry = [geometry];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'type': 'Feature',
|
'type': 'Feature',
|
||||||
'geometry': {
|
'geometry': {
|
||||||
'type': type,
|
'type': type,
|
||||||
'coordinates': geometry.length == 1 ? geometry : [geometry]
|
'coordinates': geometry
|
||||||
},
|
},
|
||||||
'properties': value.tags
|
'properties': value.tags
|
||||||
};
|
};
|
||||||
@@ -73,10 +85,10 @@ fetch(url).then(function(response) {
|
|||||||
var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);
|
var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);
|
||||||
|
|
||||||
var features = format.readFeatures(
|
var features = format.readFeatures(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
features: data ? data.features : []
|
features: data ? data.features : []
|
||||||
}, replacer));
|
}, replacer));
|
||||||
tile.setLoader(function() {
|
tile.setLoader(function() {
|
||||||
tile.setFeatures(features);
|
tile.setFeatures(features);
|
||||||
tile.setProjection(tilePixels);
|
tile.setProjection(tilePixels);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ positionFeature.setStyle(new ol.style.Style({
|
|||||||
geolocation.on('change:position', function() {
|
geolocation.on('change:position', function() {
|
||||||
var coordinates = geolocation.getPosition();
|
var coordinates = geolocation.getPosition();
|
||||||
positionFeature.setGeometry(coordinates ?
|
positionFeature.setGeometry(coordinates ?
|
||||||
new ol.geom.Point(coordinates) : null);
|
new ol.geom.Point(coordinates) : null);
|
||||||
});
|
});
|
||||||
|
|
||||||
new ol.layer.Vector({
|
new ol.layer.Vector({
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ var map = new ol.Map({
|
|||||||
|
|
||||||
function createUrl(tpl, layerDesc) {
|
function createUrl(tpl, layerDesc) {
|
||||||
return tpl
|
return tpl
|
||||||
.replace('{base}', layerDesc.base)
|
.replace('{base}', layerDesc.base)
|
||||||
.replace('{type}', layerDesc.type)
|
.replace('{type}', layerDesc.type)
|
||||||
.replace('{scheme}', layerDesc.scheme)
|
.replace('{scheme}', layerDesc.scheme)
|
||||||
.replace('{app_id}', layerDesc.app_id)
|
.replace('{app_id}', layerDesc.app_id)
|
||||||
.replace('{app_code}', layerDesc.app_code);
|
.replace('{app_code}', layerDesc.app_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
var select = document.getElementById('layer-select');
|
var select = document.getElementById('layer-select');
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ layout: example.html
|
|||||||
title: Advanced Mapbox Vector Tiles
|
title: Advanced Mapbox Vector Tiles
|
||||||
shortdesc: Example of a Mapbox vector tiles map with custom tile grid.
|
shortdesc: Example of a Mapbox vector tiles map with custom tile grid.
|
||||||
docs: >
|
docs: >
|
||||||
A vector tiles map which reuses the same tiles for subsequent zoom levels to save bandwidth on mobile devices. **Note**: No map will be visible when the access token has expired.
|
A vector tiles map which reuses the same source tiles for subsequent zoom levels to save bandwidth on mobile devices. **Note**: No map will be visible when the access token has expired.
|
||||||
tags: "mapbox, vector, tiles, mobile"
|
tags: "mapbox, vector, tiles, mobile"
|
||||||
resources:
|
resources:
|
||||||
- resources/mapbox-streets-v6-style.js
|
- resources/mapbox-streets-v6-style.js
|
||||||
|
|||||||
@@ -15,25 +15,16 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
|
|
||||||
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
|
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
|
||||||
|
|
||||||
// For how many zoom levels do we want to use the same vector tiles?
|
// Calculation of resolutions that match zoom levels 1, 3, 5, 7, 9, 11, 13, 15.
|
||||||
// 1 means "use tiles from all zoom levels". 2 means "use the same tiles for 2
|
|
||||||
// subsequent zoom levels".
|
|
||||||
var reuseZoomLevels = 2;
|
|
||||||
|
|
||||||
// Offset of loaded tiles from web mercator zoom level 0.
|
|
||||||
// 0 means "At map zoom level 0, use tiles from zoom level 0". 1 means "At map
|
|
||||||
// zoom level 0, use tiles from zoom level 1".
|
|
||||||
var zoomOffset = 1;
|
|
||||||
|
|
||||||
// Calculation of tile urls
|
|
||||||
var resolutions = [];
|
var resolutions = [];
|
||||||
for (var z = zoomOffset / reuseZoomLevels; z <= 22 / reuseZoomLevels; ++z) {
|
for (var i = 0; i <= 7; ++i) {
|
||||||
resolutions.push(156543.03392804097 / Math.pow(2, z * reuseZoomLevels));
|
resolutions.push(156543.03392804097 / Math.pow(2, i * 2));
|
||||||
}
|
}
|
||||||
|
// Calculation of tile urls for zoom levels 1, 3, 5, 7, 9, 11, 13, 15.
|
||||||
function tileUrlFunction(tileCoord) {
|
function tileUrlFunction(tileCoord) {
|
||||||
return ('https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
|
return ('https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
|
||||||
'{z}/{x}/{y}.vector.pbf?access_token=' + key)
|
'{z}/{x}/{y}.vector.pbf?access_token=' + key)
|
||||||
.replace('{z}', String(tileCoord[0] * reuseZoomLevels + zoomOffset))
|
.replace('{z}', String(tileCoord[0] * 2 - 1))
|
||||||
.replace('{x}', String(tileCoord[1]))
|
.replace('{x}', String(tileCoord[1]))
|
||||||
.replace('{y}', String(-tileCoord[2] - 1))
|
.replace('{y}', String(-tileCoord[2] - 1))
|
||||||
.replace('{a-d}', 'abcd'.substr(
|
.replace('{a-d}', 'abcd'.substr(
|
||||||
@@ -43,8 +34,6 @@ function tileUrlFunction(tileCoord) {
|
|||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
layers: [
|
layers: [
|
||||||
new ol.layer.VectorTile({
|
new ol.layer.VectorTile({
|
||||||
renderMode: 'vector',
|
|
||||||
preload: Infinity,
|
|
||||||
source: new ol.source.VectorTile({
|
source: new ol.source.VectorTile({
|
||||||
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
|
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
|
||||||
'© <a href="https://www.openstreetmap.org/copyright">' +
|
'© <a href="https://www.openstreetmap.org/copyright">' +
|
||||||
@@ -52,9 +41,10 @@ var map = new ol.Map({
|
|||||||
format: new ol.format.MVT(),
|
format: new ol.format.MVT(),
|
||||||
tileGrid: new ol.tilegrid.TileGrid({
|
tileGrid: new ol.tilegrid.TileGrid({
|
||||||
extent: ol.proj.get('EPSG:3857').getExtent(),
|
extent: ol.proj.get('EPSG:3857').getExtent(),
|
||||||
resolutions: resolutions
|
resolutions: resolutions,
|
||||||
|
tileSize: 512
|
||||||
}),
|
}),
|
||||||
tilePixelRatio: 16,
|
tilePixelRatio: 8,
|
||||||
tileUrlFunction: tileUrlFunction
|
tileUrlFunction: tileUrlFunction
|
||||||
}),
|
}),
|
||||||
style: createMapboxStreetsV6Style()
|
style: createMapboxStreetsV6Style()
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ var geojsonObject = {
|
|||||||
'geometry': {
|
'geometry': {
|
||||||
'type': 'Polygon',
|
'type': 'Polygon',
|
||||||
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
|
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
|
||||||
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
|
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
|
||||||
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
|
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'type': 'Feature',
|
'type': 'Feature',
|
||||||
@@ -117,11 +117,11 @@ var geojsonObject = {
|
|||||||
'type': 'MultiPolygon',
|
'type': 'MultiPolygon',
|
||||||
'coordinates': [
|
'coordinates': [
|
||||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||||
[-3e6, 6e6], [-5e6, 6e6]]],
|
[-3e6, 6e6], [-5e6, 6e6]]],
|
||||||
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||||
[0, 6e6], [-3e6, 6e6]]],
|
[0, 6e6], [-3e6, 6e6]]],
|
||||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||||
[3e6, 6e6], [1e6, 6e6]]]
|
[3e6, 6e6], [1e6, 6e6]]]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@@ -222,7 +222,13 @@ var select = new ol.interaction.Select({
|
|||||||
|
|
||||||
var modify = new ol.interaction.Modify({
|
var modify = new ol.interaction.Modify({
|
||||||
features: select.getFeatures(),
|
features: select.getFeatures(),
|
||||||
style: overlayStyle
|
style: overlayStyle,
|
||||||
|
insertVertexCondition: function() {
|
||||||
|
// prevent new vertices to be added to the polygons
|
||||||
|
return !this.features_.getArray().every(function(feature) {
|
||||||
|
return feature.getGeometry().getType().match(/Polygon/);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ goog.require('ol.control');
|
|||||||
goog.require('ol.control.MousePosition');
|
goog.require('ol.control.MousePosition');
|
||||||
goog.require('ol.coordinate');
|
goog.require('ol.coordinate');
|
||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
goog.require('ol.proj');
|
|
||||||
goog.require('ol.source.OSM');
|
goog.require('ol.source.OSM');
|
||||||
|
|
||||||
var mousePositionControl = new ol.control.MousePosition({
|
var mousePositionControl = new ol.control.MousePosition({
|
||||||
@@ -37,7 +36,7 @@ var map = new ol.Map({
|
|||||||
|
|
||||||
var projectionSelect = document.getElementById('projection');
|
var projectionSelect = document.getElementById('projection');
|
||||||
projectionSelect.addEventListener('change', function(event) {
|
projectionSelect.addEventListener('change', function(event) {
|
||||||
mousePositionControl.setProjection(ol.proj.get(event.target.value));
|
mousePositionControl.setProjection(event.target.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
var precisionInput = document.getElementById('precision');
|
var precisionInput = document.getElementById('precision');
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ layout: example.html
|
|||||||
title: OSM Vector Tiles
|
title: OSM Vector Tiles
|
||||||
shortdesc: Using OpenStreetMap vector tiles.
|
shortdesc: Using OpenStreetMap vector tiles.
|
||||||
docs: >
|
docs: >
|
||||||
A simple vector tiles map with Mapzen vector tiles. **Note**: TopoJSON vector tiles are not optimized for rendering - they might clip geometries exactly at the tile boundary instead of adding a buffer, and use geographic coordinates instead of tile relative pixel coordinates in view projection.
|
A simple vector tiles map with Mapzen vector tiles. This example uses the TopoJSON format's `layerName` option to determine the layer ("water", "roads", "buildings") for styling. **Note**: [`ol.format.MVT`](../apidoc/ol.format.MVT.html) is an even more efficient format for vector tiles.
|
||||||
tags: "vector, tiles, osm, mapzen"
|
tags: "vector, tiles, osm, mapzen"
|
||||||
cloak:
|
cloak:
|
||||||
vector-tiles-5eJz6JX: Your Mapzen API key from https://mapzen.com/developers
|
vector-tiles-5eJz6JX: Your Mapzen API key from https://mapzen.com/developers
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
goog.require('ol.Attribution');
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
goog.require('ol.format.TopoJSON');
|
goog.require('ol.format.TopoJSON');
|
||||||
@@ -13,11 +12,6 @@ goog.require('ol.tilegrid');
|
|||||||
|
|
||||||
var key = 'vector-tiles-5eJz6JX';
|
var key = 'vector-tiles-5eJz6JX';
|
||||||
|
|
||||||
var attribution = [new ol.Attribution({
|
|
||||||
html: '© OpenStreetMap contributors, Who’s On First, Natural Earth, and openstreetmapdata.com'
|
|
||||||
})];
|
|
||||||
var format = new ol.format.TopoJSON();
|
|
||||||
var tileGrid = ol.tilegrid.createXYZ({maxZoom: 19});
|
|
||||||
var roadStyleCache = {};
|
var roadStyleCache = {};
|
||||||
var roadColor = {
|
var roadColor = {
|
||||||
'major_road': '#776',
|
'major_road': '#776',
|
||||||
@@ -34,65 +28,58 @@ var buildingStyle = new ol.style.Style({
|
|||||||
width: 1
|
width: 1
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
var waterStyle = new ol.style.Style({
|
||||||
|
fill: new ol.style.Fill({
|
||||||
|
color: '#9db9e8'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
var roadStyle = function(feature) {
|
||||||
|
var kind = feature.get('kind');
|
||||||
|
var railway = feature.get('railway');
|
||||||
|
var sort_key = feature.get('sort_key');
|
||||||
|
var styleKey = kind + '/' + railway + '/' + sort_key;
|
||||||
|
var style = roadStyleCache[styleKey];
|
||||||
|
if (!style) {
|
||||||
|
var color, width;
|
||||||
|
if (railway) {
|
||||||
|
color = '#7de';
|
||||||
|
width = 1;
|
||||||
|
} else {
|
||||||
|
color = roadColor[kind];
|
||||||
|
width = kind == 'highway' ? 1.5 : 1;
|
||||||
|
}
|
||||||
|
style = new ol.style.Style({
|
||||||
|
stroke: new ol.style.Stroke({
|
||||||
|
color: color,
|
||||||
|
width: width
|
||||||
|
}),
|
||||||
|
zIndex: sort_key
|
||||||
|
});
|
||||||
|
roadStyleCache[styleKey] = style;
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
};
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
layers: [
|
layers: [
|
||||||
new ol.layer.VectorTile({
|
new ol.layer.VectorTile({
|
||||||
source: new ol.source.VectorTile({
|
source: new ol.source.VectorTile({
|
||||||
attributions: attribution,
|
attributions: '© OpenStreetMap contributors, Who’s On First, ' +
|
||||||
format: format,
|
'Natural Earth, and openstreetmapdata.com',
|
||||||
tileGrid: tileGrid,
|
format: new ol.format.TopoJSON({
|
||||||
url: 'https://tile.mapzen.com/mapzen/vector/v1/water/{z}/{x}/{y}.topojson?api_key=' + key
|
layerName: 'layer',
|
||||||
|
layers: ['water', 'roads', 'buildings']
|
||||||
|
}),
|
||||||
|
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
|
||||||
|
url: 'https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson?api_key=' + key
|
||||||
}),
|
}),
|
||||||
style: new ol.style.Style({
|
style: function(feature, resolution) {
|
||||||
fill: new ol.style.Fill({
|
switch (feature.get('layer')) {
|
||||||
color: '#9db9e8'
|
case 'water': return waterStyle;
|
||||||
})
|
case 'roads': return roadStyle(feature);
|
||||||
})
|
case 'buildings': return (resolution < 10) ? buildingStyle : null;
|
||||||
}),
|
default: return null;
|
||||||
new ol.layer.VectorTile({
|
|
||||||
source: new ol.source.VectorTile({
|
|
||||||
attributions: attribution,
|
|
||||||
format: format,
|
|
||||||
tileGrid: tileGrid,
|
|
||||||
url: 'https://tile.mapzen.com/mapzen/vector/v1/roads/{z}/{x}/{y}.topojson?api_key=' + key
|
|
||||||
}),
|
|
||||||
style: function(feature) {
|
|
||||||
var kind = feature.get('kind');
|
|
||||||
var railway = feature.get('railway');
|
|
||||||
var sort_key = feature.get('sort_key');
|
|
||||||
var styleKey = kind + '/' + railway + '/' + sort_key;
|
|
||||||
var style = roadStyleCache[styleKey];
|
|
||||||
if (!style) {
|
|
||||||
var color, width;
|
|
||||||
if (railway) {
|
|
||||||
color = '#7de';
|
|
||||||
width = 1;
|
|
||||||
} else {
|
|
||||||
color = roadColor[kind];
|
|
||||||
width = kind == 'highway' ? 1.5 : 1;
|
|
||||||
}
|
|
||||||
style = new ol.style.Style({
|
|
||||||
stroke: new ol.style.Stroke({
|
|
||||||
color: color,
|
|
||||||
width: width
|
|
||||||
}),
|
|
||||||
zIndex: sort_key
|
|
||||||
});
|
|
||||||
roadStyleCache[styleKey] = style;
|
|
||||||
}
|
}
|
||||||
return style;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
new ol.layer.VectorTile({
|
|
||||||
source: new ol.source.VectorTile({
|
|
||||||
attributions: attribution,
|
|
||||||
format: format,
|
|
||||||
tileGrid: tileGrid,
|
|
||||||
url: 'https://tile.mapzen.com/mapzen/vector/v1/buildings/{z}/{x}/{y}.topojson?api_key=' + key
|
|
||||||
}),
|
|
||||||
style: function(f, resolution) {
|
|
||||||
return (resolution < 10) ? buildingStyle : null;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -54,28 +54,28 @@ var geojsonObject = {
|
|||||||
'geometry': {
|
'geometry': {
|
||||||
'type': 'Polygon',
|
'type': 'Polygon',
|
||||||
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||||
[-3e6, 6e6], [-5e6, 6e6]]]
|
[-3e6, 6e6], [-5e6, 6e6]]]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'type': 'Feature',
|
'type': 'Feature',
|
||||||
'geometry': {
|
'geometry': {
|
||||||
'type': 'Polygon',
|
'type': 'Polygon',
|
||||||
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||||
[0, 6e6], [-2e6, 6e6]]]
|
[0, 6e6], [-2e6, 6e6]]]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'type': 'Feature',
|
'type': 'Feature',
|
||||||
'geometry': {
|
'geometry': {
|
||||||
'type': 'Polygon',
|
'type': 'Polygon',
|
||||||
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||||
[3e6, 6e6], [1e6, 6e6]]]
|
[3e6, 6e6], [1e6, 6e6]]]
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'type': 'Feature',
|
'type': 'Feature',
|
||||||
'geometry': {
|
'geometry': {
|
||||||
'type': 'Polygon',
|
'type': 'Polygon',
|
||||||
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
|
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
|
||||||
[0, -1e6], [-2e6, -1e6]]]
|
[0, -1e6], [-2e6, -1e6]]]
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -162,13 +162,13 @@ function plot(resolution, counts, threshold) {
|
|||||||
var value = counts.min + (index * counts.delta);
|
var value = counts.min + (index * counts.delta);
|
||||||
return 'bar' + (value >= threshold ? ' selected' : '');
|
return 'bar' + (value >= threshold ? ' selected' : '');
|
||||||
})
|
})
|
||||||
.attr('width', barWidth - 2);
|
.attr('width', barWidth - 2);
|
||||||
|
|
||||||
bar.transition().attr('transform', function(value, index) {
|
bar.transition().attr('transform', function(value, index) {
|
||||||
return 'translate(' + (index * barWidth) + ', ' +
|
return 'translate(' + (index * barWidth) + ', ' +
|
||||||
(plotHeight - yScale(value)) + ')';
|
(plotHeight - yScale(value)) + ')';
|
||||||
})
|
})
|
||||||
.attr('height', yScale);
|
.attr('height', yScale);
|
||||||
|
|
||||||
bar.on('mousemove', function(count, index) {
|
bar.on('mousemove', function(count, index) {
|
||||||
var threshold = counts.min + (index * counts.delta);
|
var threshold = counts.min + (index * counts.delta);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ var map = new ol.Map({
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
view: new ol.View({
|
view: new ol.View({
|
||||||
center: [-25860000, 4130000],
|
center: [14200000, 4130000],
|
||||||
rotation: Math.PI / 6,
|
rotation: Math.PI / 6,
|
||||||
zoom: 10
|
zoom: 10
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ tags: "draw, edit, modify, vector, snap"
|
|||||||
<option value="Point">Point</option>
|
<option value="Point">Point</option>
|
||||||
<option value="LineString">LineString</option>
|
<option value="LineString">LineString</option>
|
||||||
<option value="Polygon">Polygon</option>
|
<option value="Polygon">Polygon</option>
|
||||||
|
<option value="Circle">Circle</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ var Draw = {
|
|||||||
this.LineString.setActive(false);
|
this.LineString.setActive(false);
|
||||||
map.addInteraction(this.Polygon);
|
map.addInteraction(this.Polygon);
|
||||||
this.Polygon.setActive(false);
|
this.Polygon.setActive(false);
|
||||||
|
map.addInteraction(this.Circle);
|
||||||
|
this.Circle.setActive(false);
|
||||||
},
|
},
|
||||||
Point: new ol.interaction.Draw({
|
Point: new ol.interaction.Draw({
|
||||||
source: vector.getSource(),
|
source: vector.getSource(),
|
||||||
@@ -94,6 +96,10 @@ var Draw = {
|
|||||||
source: vector.getSource(),
|
source: vector.getSource(),
|
||||||
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
||||||
}),
|
}),
|
||||||
|
Circle: new ol.interaction.Draw({
|
||||||
|
source: vector.getSource(),
|
||||||
|
type: /** @type {ol.geom.GeometryType} */ ('Circle')
|
||||||
|
}),
|
||||||
getActive: function() {
|
getActive: function() {
|
||||||
return this.activeType ? this[this.activeType].getActive() : false;
|
return this.activeType ? this[this.activeType].getActive() : false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,13 +29,14 @@ var style = new ol.style.Style({
|
|||||||
var vector = new ol.layer.Vector({
|
var vector = new ol.layer.Vector({
|
||||||
source: new ol.source.Vector({
|
source: new ol.source.Vector({
|
||||||
url: 'data/topojson/world-110m.json',
|
url: 'data/topojson/world-110m.json',
|
||||||
format: new ol.format.TopoJSON(),
|
format: new ol.format.TopoJSON({
|
||||||
|
// don't want to render the full world polygon (stored as 'land' layer),
|
||||||
|
// which repeats all countries
|
||||||
|
layers: ['countries']
|
||||||
|
}),
|
||||||
overlaps: false
|
overlaps: false
|
||||||
}),
|
}),
|
||||||
style: function(feature) {
|
style: style
|
||||||
// don't want to render the full world polygon, which repeats all countries
|
|
||||||
return feature.getId() !== undefined ? style : null;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ var featureRequest = new ol.format.WFS().writeGetFeature({
|
|||||||
featureTypes: ['water_areas'],
|
featureTypes: ['water_areas'],
|
||||||
outputFormat: 'application/json',
|
outputFormat: 'application/json',
|
||||||
filter: ol.format.filter.and(
|
filter: ol.format.filter.and(
|
||||||
ol.format.filter.like('name', 'Mississippi*'),
|
ol.format.filter.like('name', 'Mississippi*'),
|
||||||
ol.format.filter.equalTo('waterway', 'riverbank')
|
ol.format.filter.equalTo('waterway', 'riverbank')
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ var map = new ol.Map({
|
|||||||
tileSize: tileSize,
|
tileSize: tileSize,
|
||||||
tileUrlFunction: function(tileCoord) {
|
tileUrlFunction: function(tileCoord) {
|
||||||
return urlTemplate.replace('{z}', (tileCoord[0] - 1).toString())
|
return urlTemplate.replace('{z}', (tileCoord[0] - 1).toString())
|
||||||
.replace('{x}', tileCoord[1].toString())
|
.replace('{x}', tileCoord[1].toString())
|
||||||
.replace('{y}', (-tileCoord[2] - 1).toString());
|
.replace('{y}', (-tileCoord[2] - 1).toString());
|
||||||
},
|
},
|
||||||
wrapX: true
|
wrapX: true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ olx.interaction.InteractionOptions.prototype.handleEvent;
|
|||||||
* loadTilesWhileAnimating: (boolean|undefined),
|
* loadTilesWhileAnimating: (boolean|undefined),
|
||||||
* loadTilesWhileInteracting: (boolean|undefined),
|
* loadTilesWhileInteracting: (boolean|undefined),
|
||||||
* logo: (boolean|string|olx.LogoOptions|Element|undefined),
|
* logo: (boolean|string|olx.LogoOptions|Element|undefined),
|
||||||
|
* moveTolerance: (number|undefined),
|
||||||
* overlays: (ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined),
|
* overlays: (ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined),
|
||||||
* renderer: (ol.renderer.Type|Array.<ol.renderer.Type>|undefined),
|
* renderer: (ol.renderer.Type|Array.<ol.renderer.Type>|undefined),
|
||||||
* target: (Element|string|undefined),
|
* target: (Element|string|undefined),
|
||||||
@@ -385,6 +386,17 @@ olx.MapOptions.prototype.loadTilesWhileInteracting;
|
|||||||
olx.MapOptions.prototype.logo;
|
olx.MapOptions.prototype.logo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum distance in pixels the cursor must move to be detected
|
||||||
|
* as a map move event instead of a click. Increasing this value can make it
|
||||||
|
* easier to click on the map.
|
||||||
|
* Default is `1`.
|
||||||
|
* @type {number|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.MapOptions.prototype.moveTolerance;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlays initially added to the map. By default, no overlays are added.
|
* Overlays initially added to the map. By default, no overlays are added.
|
||||||
* @type {ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined}
|
* @type {ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined}
|
||||||
@@ -668,7 +680,8 @@ olx.ProjectionOptions.prototype.worldExtent;
|
|||||||
/**
|
/**
|
||||||
* Function to determine resolution at a point. The function is called with a
|
* Function to determine resolution at a point. The function is called with a
|
||||||
* `{number}` view resolution and an `{ol.Coordinate}` as arguments, and returns
|
* `{number}` view resolution and an `{ol.Coordinate}` as arguments, and returns
|
||||||
* the `{number}` resolution at the passed coordinate.
|
* the `{number}` resolution at the passed coordinate. If this is `undefined`,
|
||||||
|
* the default {@link ol.proj#getPointResolution} function will be used.
|
||||||
* @type {(function(number, ol.Coordinate):number|undefined)}
|
* @type {(function(number, ol.Coordinate):number|undefined)}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -1981,9 +1994,9 @@ olx.format.MVTOptions;
|
|||||||
* {@link ol.Feature} to get full editing and geometry support at the cost of
|
* {@link ol.Feature} to get full editing and geometry support at the cost of
|
||||||
* decreased rendering performance. The default is {@link ol.render.Feature},
|
* decreased rendering performance. The default is {@link ol.render.Feature},
|
||||||
* which is optimized for rendering and hit detection.
|
* which is optimized for rendering and hit detection.
|
||||||
* @type {undefined|function((ol.geom.Geometry|Object.<string, *>)=)|
|
* @type {undefined|function((ol.geom.Geometry|Object.<string,*>)=)|
|
||||||
* function(ol.geom.GeometryType,Array.<number>,
|
* function(ol.geom.GeometryType,Array.<number>,
|
||||||
* (Array.<number>|Array.<Array.<number>>),Object.<string, *>)}
|
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.format.MVTOptions.prototype.featureClass;
|
olx.format.MVTOptions.prototype.featureClass;
|
||||||
@@ -2040,7 +2053,11 @@ olx.format.PolylineOptions.prototype.geometryLayout;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{defaultDataProjection: ol.ProjectionLike}}
|
* @typedef {{
|
||||||
|
* defaultDataProjection: ol.ProjectionLike,
|
||||||
|
* layerName: (string|undefined),
|
||||||
|
* layers: (Array.<string>|undefined)
|
||||||
|
* }}
|
||||||
*/
|
*/
|
||||||
olx.format.TopoJSONOptions;
|
olx.format.TopoJSONOptions;
|
||||||
|
|
||||||
@@ -2053,6 +2070,38 @@ olx.format.TopoJSONOptions;
|
|||||||
olx.format.TopoJSONOptions.prototype.defaultDataProjection;
|
olx.format.TopoJSONOptions.prototype.defaultDataProjection;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the name of the TopoJSON topology `objects`'s children as feature
|
||||||
|
* property with the specified name. This means that when set to `'layer'`, a
|
||||||
|
* topology like
|
||||||
|
* ```
|
||||||
|
* {
|
||||||
|
* "type": "Topology",
|
||||||
|
* "objects": {
|
||||||
|
* "example": {
|
||||||
|
* "type": "GeometryCollection",
|
||||||
|
* "geometries": []
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* will result in features that have a property `'layer'` set to `'example'`.
|
||||||
|
* When not set, no property will be added to features.
|
||||||
|
* @type {string|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.format.TopoJSONOptions.prototype.layerName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Names of the TopoJSON topology's `objects`'s children to read features from.
|
||||||
|
* If not provided, features will be read from all children.
|
||||||
|
* @type {Array.<string>|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.format.TopoJSONOptions.prototype.layers;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{altitudeMode: (ol.format.IGCZ|undefined)}}
|
* @typedef {{altitudeMode: (ol.format.IGCZ|undefined)}}
|
||||||
*/
|
*/
|
||||||
@@ -3164,12 +3213,15 @@ olx.interaction.KeyboardZoomOptions.prototype.delta;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{condition: (ol.EventsConditionType|undefined),
|
* @typedef {{
|
||||||
|
* condition: (ol.EventsConditionType|undefined),
|
||||||
* deleteCondition: (ol.EventsConditionType|undefined),
|
* deleteCondition: (ol.EventsConditionType|undefined),
|
||||||
|
* insertVertexCondition: (ol.EventsConditionType|undefined),
|
||||||
* pixelTolerance: (number|undefined),
|
* pixelTolerance: (number|undefined),
|
||||||
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
|
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
|
||||||
* features: ol.Collection.<ol.Feature>,
|
* features: ol.Collection.<ol.Feature>,
|
||||||
* wrapX: (boolean|undefined)}}
|
* wrapX: (boolean|undefined)
|
||||||
|
* }}
|
||||||
*/
|
*/
|
||||||
olx.interaction.ModifyOptions;
|
olx.interaction.ModifyOptions;
|
||||||
|
|
||||||
@@ -3196,6 +3248,16 @@ olx.interaction.ModifyOptions.prototype.condition;
|
|||||||
olx.interaction.ModifyOptions.prototype.deleteCondition;
|
olx.interaction.ModifyOptions.prototype.deleteCondition;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that takes an {@link ol.MapBrowserEvent} and returns a boolean
|
||||||
|
* to indicate whether a new vertex can be added to the sketch features.
|
||||||
|
* Default is {@link ol.events.condition.always}
|
||||||
|
* @type {ol.EventsConditionType|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.interaction.ModifyOptions.prototype.insertVertexCondition;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pixel tolerance for considering the pointer close enough to a segment or
|
* Pixel tolerance for considering the pointer close enough to a segment or
|
||||||
* vertex for editing. Default is `10`.
|
* vertex for editing. Default is `10`.
|
||||||
@@ -4864,7 +4926,7 @@ olx.source.VectorTileOptions.prototype.state;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to instantiate image tiles. Default is {@link ol.VectorTile}.
|
* Class used to instantiate vector tiles. Default is {@link ol.VectorTile}.
|
||||||
* @type {function(new: ol.VectorTile, ol.TileCoord,
|
* @type {function(new: ol.VectorTile, ol.TileCoord,
|
||||||
* ol.TileState, string, ol.format.Feature,
|
* ol.TileState, string, ol.format.Feature,
|
||||||
* ol.TileLoadFunctionType)|undefined}
|
* ol.TileLoadFunctionType)|undefined}
|
||||||
@@ -5991,8 +6053,9 @@ olx.source.TileArcGISRestOptions.prototype.urls;
|
|||||||
* crossOrigin: (null|string|undefined),
|
* crossOrigin: (null|string|undefined),
|
||||||
* jsonp: (boolean|undefined),
|
* jsonp: (boolean|undefined),
|
||||||
* reprojectionErrorThreshold: (number|undefined),
|
* reprojectionErrorThreshold: (number|undefined),
|
||||||
|
* tileJSON: (TileJSON|undefined),
|
||||||
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
||||||
* url: string,
|
* url: (string|undefined),
|
||||||
* wrapX: (boolean|undefined)}}
|
* wrapX: (boolean|undefined)}}
|
||||||
*/
|
*/
|
||||||
olx.source.TileJSONOptions;
|
olx.source.TileJSONOptions;
|
||||||
@@ -6046,6 +6109,15 @@ olx.source.TileJSONOptions.prototype.jsonp;
|
|||||||
olx.source.TileJSONOptions.prototype.reprojectionErrorThreshold;
|
olx.source.TileJSONOptions.prototype.reprojectionErrorThreshold;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TileJSON configuration for this source. If not provided, `url` must be
|
||||||
|
* configured.
|
||||||
|
* @type {TileJSON|undefined}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
olx.source.TileJSONOptions.prototype.tileJSON;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional function to load a tile given a URL. The default is
|
* Optional function to load a tile given a URL. The default is
|
||||||
* ```js
|
* ```js
|
||||||
@@ -6060,8 +6132,8 @@ olx.source.TileJSONOptions.prototype.tileLoadFunction;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to the TileJSON file.
|
* URL to the TileJSON file. If not provided, `tileJSON` must be configured.
|
||||||
* @type {string}
|
* @type {string|undefined}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.source.TileJSONOptions.prototype.url;
|
olx.source.TileJSONOptions.prototype.url;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
|
|||||||
44
package.json
44
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "openlayers",
|
"name": "openlayers",
|
||||||
"version": "4.1.2-beta.1",
|
"version": "4.3.0-beta.2",
|
||||||
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
"description": "Build tools and sources for developing OpenLayers based mapping applications",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"map",
|
"map",
|
||||||
@@ -31,13 +31,13 @@
|
|||||||
"css/ol.css"
|
"css/ol.css"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "2.4.0",
|
"async": "2.5.0",
|
||||||
"closure-util": "1.20.0",
|
"closure-util": "1.22.0",
|
||||||
"derequire": "2.0.6",
|
"derequire": "2.0.6",
|
||||||
"fs-extra": "3.0.1",
|
"fs-extra": "4.0.0",
|
||||||
"glob": "7.1.1",
|
"glob": "7.1.1",
|
||||||
"handlebars": "4.0.8",
|
"handlebars": "4.0.10",
|
||||||
"jsdoc": "3.4.3",
|
"jsdoc": "3.5.3",
|
||||||
"marked": "0.3.6",
|
"marked": "0.3.6",
|
||||||
"metalsmith": "2.3.0",
|
"metalsmith": "2.3.0",
|
||||||
"metalsmith-layouts": "1.8.1",
|
"metalsmith-layouts": "1.8.1",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"pbf": "3.0.5",
|
"pbf": "3.0.5",
|
||||||
"pixelworks": "1.1.0",
|
"pixelworks": "1.1.0",
|
||||||
"rbush": "2.0.1",
|
"rbush": "2.0.1",
|
||||||
"rollup": "^0.41.6",
|
"rollup": "^0.45.0",
|
||||||
"rollup-plugin-cleanup": "^1.0.0",
|
"rollup-plugin-cleanup": "^1.0.0",
|
||||||
"rollup-plugin-commonjs": "^8.0.2",
|
"rollup-plugin-commonjs": "^8.0.2",
|
||||||
"rollup-plugin-node-resolve": "^3.0.0",
|
"rollup-plugin-node-resolve": "^3.0.0",
|
||||||
@@ -54,10 +54,10 @@
|
|||||||
"walk": "2.3.9"
|
"walk": "2.3.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"clean-css-cli": "4.1.0",
|
"clean-css-cli": "4.1.6",
|
||||||
"coveralls": "2.13.1",
|
"coveralls": "2.13.1",
|
||||||
"debounce": "^1.0.0",
|
"debounce": "^1.0.0",
|
||||||
"eslint": "3.19.0",
|
"eslint": "4.2.0",
|
||||||
"eslint-config-openlayers": "7.0.0",
|
"eslint-config-openlayers": "7.0.0",
|
||||||
"eslint-plugin-openlayers-internal": "^3.1.0",
|
"eslint-plugin-openlayers-internal": "^3.1.0",
|
||||||
"expect.js": "0.3.1",
|
"expect.js": "0.3.1",
|
||||||
@@ -65,14 +65,14 @@
|
|||||||
"istanbul": "0.4.5",
|
"istanbul": "0.4.5",
|
||||||
"jquery": "3.2.1",
|
"jquery": "3.2.1",
|
||||||
"jscodeshift": "^0.3.30",
|
"jscodeshift": "^0.3.30",
|
||||||
"mocha": "3.3.0",
|
"mocha": "3.4.2",
|
||||||
"mocha-phantomjs-core": "^2.1.0",
|
"mocha-phantomjs-core": "^2.1.0",
|
||||||
"mustache": "2.3.0",
|
"mustache": "2.3.0",
|
||||||
"phantomjs-prebuilt": "2.1.14",
|
"phantomjs-prebuilt": "2.1.14",
|
||||||
"proj4": "2.4.3",
|
"proj4": "2.4.3",
|
||||||
"resemblejs": "2.2.4",
|
"resemblejs": "2.2.4",
|
||||||
"serve-files": "1.0.1",
|
"serve-files": "1.0.1",
|
||||||
"sinon": "2.2.0",
|
"sinon": "2.3.8",
|
||||||
"slimerjs": "0.10.3"
|
"slimerjs": "0.10.3"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
@@ -100,7 +100,27 @@
|
|||||||
"openlayers-internal/one-provide": 2,
|
"openlayers-internal/one-provide": 2,
|
||||||
"openlayers-internal/requires-first": 2,
|
"openlayers-internal/requires-first": 2,
|
||||||
"openlayers-internal/valid-provide": 2,
|
"openlayers-internal/valid-provide": 2,
|
||||||
"openlayers-internal/valid-requires": 2
|
"openlayers-internal/valid-requires": 2,
|
||||||
|
"indent": [
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
"VariableDeclarator": 2,
|
||||||
|
"SwitchCase": 1,
|
||||||
|
"MemberExpression": 2,
|
||||||
|
"FunctionDeclaration": {
|
||||||
|
"parameters": 2,
|
||||||
|
"body": 1
|
||||||
|
},
|
||||||
|
"FunctionExpression": {
|
||||||
|
"parameters": 2,
|
||||||
|
"body": 1
|
||||||
|
},
|
||||||
|
"CallExpression": {
|
||||||
|
"arguments": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ext": [
|
"ext": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ol",
|
"name": "ol",
|
||||||
"version": "4.1.1",
|
"version": "4.3.0-beta.2",
|
||||||
"description": "OpenLayers as ES2015 modules",
|
"description": "OpenLayers as ES2015 modules",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "index.js",
|
"module": "index.js",
|
||||||
|
|||||||
@@ -9,20 +9,20 @@ goog.require('ol.math');
|
|||||||
*/
|
*/
|
||||||
ol.CenterConstraint.createExtent = function(extent) {
|
ol.CenterConstraint.createExtent = function(extent) {
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|undefined} center Center.
|
* @param {ol.Coordinate|undefined} center Center.
|
||||||
* @return {ol.Coordinate|undefined} Center.
|
* @return {ol.Coordinate|undefined} Center.
|
||||||
*/
|
*/
|
||||||
function(center) {
|
function(center) {
|
||||||
if (center) {
|
if (center) {
|
||||||
return [
|
return [
|
||||||
ol.math.clamp(center[0], extent[0], extent[2]),
|
ol.math.clamp(center[0], extent[0], extent[2]),
|
||||||
ol.math.clamp(center[1], extent[1], extent[3])
|
ol.math.clamp(center[1], extent[1], extent[3])
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,56 +72,56 @@ ol.color.fromNamed = function(color) {
|
|||||||
* @return {ol.Color} Color.
|
* @return {ol.Color} Color.
|
||||||
*/
|
*/
|
||||||
ol.color.fromString = (
|
ol.color.fromString = (
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
// We maintain a small cache of parsed strings. To provide cheap LRU-like
|
// We maintain a small cache of parsed strings. To provide cheap LRU-like
|
||||||
// semantics, whenever the cache grows too large we simply delete an
|
// semantics, whenever the cache grows too large we simply delete an
|
||||||
// arbitrary 25% of the entries.
|
// arbitrary 25% of the entries.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
var MAX_CACHE_SIZE = 1024;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object.<string, ol.Color>}
|
||||||
|
*/
|
||||||
|
var cache = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
var cacheSize = 0;
|
||||||
|
|
||||||
|
return (
|
||||||
/**
|
/**
|
||||||
* @const
|
* @param {string} s String.
|
||||||
* @type {number}
|
* @return {ol.Color} Color.
|
||||||
*/
|
*/
|
||||||
var MAX_CACHE_SIZE = 1024;
|
function(s) {
|
||||||
|
var color;
|
||||||
/**
|
if (cache.hasOwnProperty(s)) {
|
||||||
* @type {Object.<string, ol.Color>}
|
color = cache[s];
|
||||||
*/
|
} else {
|
||||||
var cache = {};
|
if (cacheSize >= MAX_CACHE_SIZE) {
|
||||||
|
var i = 0;
|
||||||
/**
|
var key;
|
||||||
* @type {number}
|
for (key in cache) {
|
||||||
*/
|
if ((i++ & 3) === 0) {
|
||||||
var cacheSize = 0;
|
delete cache[key];
|
||||||
|
--cacheSize;
|
||||||
return (
|
|
||||||
/**
|
|
||||||
* @param {string} s String.
|
|
||||||
* @return {ol.Color} Color.
|
|
||||||
*/
|
|
||||||
function(s) {
|
|
||||||
var color;
|
|
||||||
if (cache.hasOwnProperty(s)) {
|
|
||||||
color = cache[s];
|
|
||||||
} else {
|
|
||||||
if (cacheSize >= MAX_CACHE_SIZE) {
|
|
||||||
var i = 0;
|
|
||||||
var key;
|
|
||||||
for (key in cache) {
|
|
||||||
if ((i++ & 3) === 0) {
|
|
||||||
delete cache[key];
|
|
||||||
--cacheSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
color = ol.color.fromStringInternal_(s);
|
|
||||||
cache[s] = color;
|
|
||||||
++cacheSize;
|
|
||||||
}
|
}
|
||||||
return color;
|
}
|
||||||
});
|
color = ol.color.fromStringInternal_(s);
|
||||||
|
cache[s] = color;
|
||||||
|
++cacheSize;
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ ol.colorlike.asColorLike = function(color) {
|
|||||||
*/
|
*/
|
||||||
ol.colorlike.isColorLike = function(color) {
|
ol.colorlike.isColorLike = function(color) {
|
||||||
return (
|
return (
|
||||||
typeof color === 'string' ||
|
typeof color === 'string' ||
|
||||||
color instanceof CanvasPattern ||
|
color instanceof CanvasPattern ||
|
||||||
color instanceof CanvasGradient
|
color instanceof CanvasGradient
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
goog.provide('ol.Constraints');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @param {ol.CenterConstraintType} centerConstraint Center constraint.
|
|
||||||
* @param {ol.ResolutionConstraintType} resolutionConstraint
|
|
||||||
* Resolution constraint.
|
|
||||||
* @param {ol.RotationConstraintType} rotationConstraint
|
|
||||||
* Rotation constraint.
|
|
||||||
*/
|
|
||||||
ol.Constraints = function(centerConstraint, resolutionConstraint, rotationConstraint) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {ol.CenterConstraintType}
|
|
||||||
*/
|
|
||||||
this.center = centerConstraint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {ol.ResolutionConstraintType}
|
|
||||||
*/
|
|
||||||
this.resolution = resolutionConstraint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {ol.RotationConstraintType}
|
|
||||||
*/
|
|
||||||
this.rotation = rotationConstraint;
|
|
||||||
|
|
||||||
};
|
|
||||||
@@ -35,7 +35,7 @@ ol.control.defaults = function(opt_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var attributionControl = options.attribution !== undefined ?
|
var attributionControl = options.attribution !== undefined ?
|
||||||
options.attribution : true;
|
options.attribution : true;
|
||||||
if (attributionControl) {
|
if (attributionControl) {
|
||||||
controls.push(new ol.control.Attribution(options.attributionOptions));
|
controls.push(new ol.control.Attribution(options.attributionOptions));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.collapsible_ = options.collapsible !== undefined ?
|
this.collapsible_ = options.collapsible !== undefined ?
|
||||||
options.collapsible : true;
|
options.collapsible : true;
|
||||||
|
|
||||||
if (!this.collapsible_) {
|
if (!this.collapsible_) {
|
||||||
this.collapsed_ = false;
|
this.collapsed_ = false;
|
||||||
@@ -91,7 +91,7 @@ ol.control.Attribution = function(opt_options) {
|
|||||||
|
|
||||||
|
|
||||||
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
|
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
|
||||||
this.collapseLabel_ : this.label_;
|
this.collapseLabel_ : this.label_;
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
button.setAttribute('type', 'button');
|
button.setAttribute('type', 'button');
|
||||||
button.title = tipLabel;
|
button.title = tipLabel;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ ol.control.Control.prototype.setMap = function(map) {
|
|||||||
this.map_ = map;
|
this.map_ = map;
|
||||||
if (this.map_) {
|
if (this.map_) {
|
||||||
var target = this.target_ ?
|
var target = this.target_ ?
|
||||||
this.target_ : map.getOverlayContainerStopEvent();
|
this.target_ : map.getOverlayContainerStopEvent();
|
||||||
target.appendChild(this.element);
|
target.appendChild(this.element);
|
||||||
if (this.render !== ol.nullFunction) {
|
if (this.render !== ol.nullFunction) {
|
||||||
this.listenerKeys.push(ol.events.listen(map,
|
this.listenerKeys.push(ol.events.listen(map,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ol.control.FullScreen = function(opt_options) {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.cssClassName_ = options.className !== undefined ? options.className :
|
this.cssClassName_ = options.className !== undefined ? options.className :
|
||||||
'ol-full-screen';
|
'ol-full-screen';
|
||||||
|
|
||||||
var label = options.label !== undefined ? options.label : '\u2922';
|
var label = options.label !== undefined ? options.label : '\u2922';
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ ol.control.FullScreen = function(opt_options) {
|
|||||||
* @type {Node}
|
* @type {Node}
|
||||||
*/
|
*/
|
||||||
this.labelNode_ = typeof label === 'string' ?
|
this.labelNode_ = typeof label === 'string' ?
|
||||||
document.createTextNode(label) : label;
|
document.createTextNode(label) : label;
|
||||||
|
|
||||||
var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
|
var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ ol.control.FullScreen = function(opt_options) {
|
|||||||
* @type {Node}
|
* @type {Node}
|
||||||
*/
|
*/
|
||||||
this.labelActiveNode_ = typeof labelActive === 'string' ?
|
this.labelActiveNode_ = typeof labelActive === 'string' ?
|
||||||
document.createTextNode(labelActive) : labelActive;
|
document.createTextNode(labelActive) : labelActive;
|
||||||
|
|
||||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
|
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
|
element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
|
||||||
|
|
||||||
var render = options.render ?
|
var render = options.render ?
|
||||||
options.render : ol.control.MousePosition.render;
|
options.render : ol.control.MousePosition.render;
|
||||||
|
|
||||||
ol.control.Control.call(this, {
|
ol.control.Control.call(this, {
|
||||||
element: element,
|
element: element,
|
||||||
@@ -47,7 +47,7 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
this.setCoordinateFormat(options.coordinateFormat);
|
this.setCoordinateFormat(options.coordinateFormat);
|
||||||
}
|
}
|
||||||
if (options.projection) {
|
if (options.projection) {
|
||||||
this.setProjection(ol.proj.get(options.projection));
|
this.setProjection(options.projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +122,7 @@ ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.control.MousePosition.prototype.getCoordinateFormat = function() {
|
ol.control.MousePosition.prototype.getCoordinateFormat = function() {
|
||||||
return /** @type {ol.CoordinateFormatType|undefined} */ (
|
return /** @type {ol.CoordinateFormatType|undefined} */ (
|
||||||
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
|
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ ol.control.MousePosition.prototype.getCoordinateFormat = function() {
|
|||||||
*/
|
*/
|
||||||
ol.control.MousePosition.prototype.getProjection = function() {
|
ol.control.MousePosition.prototype.getProjection = function() {
|
||||||
return /** @type {ol.proj.Projection|undefined} */ (
|
return /** @type {ol.proj.Projection|undefined} */ (
|
||||||
this.get(ol.control.MousePosition.Property_.PROJECTION));
|
this.get(ol.control.MousePosition.Property_.PROJECTION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -192,13 +192,13 @@ ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the projection that is used to report the mouse position.
|
* Set the projection that is used to report the mouse position.
|
||||||
* @param {ol.proj.Projection} projection The projection to report mouse
|
* @param {ol.ProjectionLike} projection The projection to report mouse
|
||||||
* position in.
|
* position in.
|
||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.control.MousePosition.prototype.setProjection = function(projection) {
|
ol.control.MousePosition.prototype.setProjection = function(projection) {
|
||||||
this.set(ol.control.MousePosition.Property_.PROJECTION, projection);
|
this.set(ol.control.MousePosition.Property_.PROJECTION, ol.proj.get(projection));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ ol.control.OverviewMap = function(opt_options) {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.collapsible_ = options.collapsible !== undefined ?
|
this.collapsible_ = options.collapsible !== undefined ?
|
||||||
options.collapsible : true;
|
options.collapsible : true;
|
||||||
|
|
||||||
if (!this.collapsible_) {
|
if (!this.collapsible_) {
|
||||||
this.collapsed_ = false;
|
this.collapsed_ = false;
|
||||||
@@ -80,7 +80,7 @@ ol.control.OverviewMap = function(opt_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
|
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
|
||||||
this.collapseLabel_ : this.label_;
|
this.collapseLabel_ : this.label_;
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
button.setAttribute('type', 'button');
|
button.setAttribute('type', 'button');
|
||||||
button.title = tipLabel;
|
button.title = tipLabel;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
|
|||||||
*/
|
*/
|
||||||
ol.control.ScaleLine.prototype.getUnits = function() {
|
ol.control.ScaleLine.prototype.getUnits = function() {
|
||||||
return /** @type {ol.control.ScaleLineUnits|undefined} */ (
|
return /** @type {ol.control.ScaleLineUnits|undefined} */ (
|
||||||
this.get(ol.control.ScaleLine.Property_.UNITS));
|
this.get(ol.control.ScaleLine.Property_.UNITS));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,16 +31,16 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212';
|
var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212';
|
||||||
|
|
||||||
var zoomInTipLabel = options.zoomInTipLabel !== undefined ?
|
var zoomInTipLabel = options.zoomInTipLabel !== undefined ?
|
||||||
options.zoomInTipLabel : 'Zoom in';
|
options.zoomInTipLabel : 'Zoom in';
|
||||||
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
|
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
|
||||||
options.zoomOutTipLabel : 'Zoom out';
|
options.zoomOutTipLabel : 'Zoom out';
|
||||||
|
|
||||||
var inElement = document.createElement('button');
|
var inElement = document.createElement('button');
|
||||||
inElement.className = className + '-in';
|
inElement.className = className + '-in';
|
||||||
inElement.setAttribute('type', 'button');
|
inElement.setAttribute('type', 'button');
|
||||||
inElement.title = zoomInTipLabel;
|
inElement.title = zoomInTipLabel;
|
||||||
inElement.appendChild(
|
inElement.appendChild(
|
||||||
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
|
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
|
||||||
);
|
);
|
||||||
|
|
||||||
ol.events.listen(inElement, ol.events.EventType.CLICK,
|
ol.events.listen(inElement, ol.events.EventType.CLICK,
|
||||||
@@ -51,7 +51,7 @@ ol.control.Zoom = function(opt_options) {
|
|||||||
outElement.setAttribute('type', 'button');
|
outElement.setAttribute('type', 'button');
|
||||||
outElement.title = zoomOutTipLabel;
|
outElement.title = zoomOutTipLabel;
|
||||||
outElement.appendChild(
|
outElement.appendChild(
|
||||||
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
|
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
|
||||||
);
|
);
|
||||||
|
|
||||||
ol.events.listen(outElement, ol.events.EventType.CLICK,
|
ol.events.listen(outElement, ol.events.EventType.CLICK,
|
||||||
|
|||||||
@@ -27,16 +27,16 @@ ol.control.ZoomToExtent = function(opt_options) {
|
|||||||
this.extent_ = options.extent ? options.extent : null;
|
this.extent_ = options.extent ? options.extent : null;
|
||||||
|
|
||||||
var className = options.className !== undefined ? options.className :
|
var className = options.className !== undefined ? options.className :
|
||||||
'ol-zoom-extent';
|
'ol-zoom-extent';
|
||||||
|
|
||||||
var label = options.label !== undefined ? options.label : 'E';
|
var label = options.label !== undefined ? options.label : 'E';
|
||||||
var tipLabel = options.tipLabel !== undefined ?
|
var tipLabel = options.tipLabel !== undefined ?
|
||||||
options.tipLabel : 'Fit to extent';
|
options.tipLabel : 'Fit to extent';
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
button.setAttribute('type', 'button');
|
button.setAttribute('type', 'button');
|
||||||
button.title = tipLabel;
|
button.title = tipLabel;
|
||||||
button.appendChild(
|
button.appendChild(
|
||||||
typeof label === 'string' ? document.createTextNode(label) : label
|
typeof label === 'string' ? document.createTextNode(label) : label
|
||||||
);
|
);
|
||||||
|
|
||||||
ol.events.listen(button, ol.events.EventType.CLICK,
|
ol.events.listen(button, ol.events.EventType.CLICK,
|
||||||
|
|||||||
@@ -26,6 +26,37 @@ ol.coordinate.add = function(coordinate, delta) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the point closest to the passed coordinate on the passed circle.
|
||||||
|
*
|
||||||
|
* @param {ol.Coordinate} coordinate The coordinate.
|
||||||
|
* @param {ol.geom.Circle} circle The circle.
|
||||||
|
* @return {ol.Coordinate} Closest point on the circumference
|
||||||
|
*/
|
||||||
|
ol.coordinate.closestOnCircle = function(coordinate, circle) {
|
||||||
|
var r = circle.getRadius();
|
||||||
|
var center = circle.getCenter();
|
||||||
|
var x0 = center[0];
|
||||||
|
var y0 = center[1];
|
||||||
|
var x1 = coordinate[0];
|
||||||
|
var y1 = coordinate[1];
|
||||||
|
|
||||||
|
var dx = x1 - x0;
|
||||||
|
var dy = y1 - y0;
|
||||||
|
if (dx === 0 && dy === 0) {
|
||||||
|
dx = 1;
|
||||||
|
}
|
||||||
|
var d = Math.sqrt(dx * dx + dy * dy);
|
||||||
|
|
||||||
|
var x, y;
|
||||||
|
|
||||||
|
x = x0 + r * dx / d;
|
||||||
|
y = y0 + r * dy / d;
|
||||||
|
|
||||||
|
return [x, y];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates the point closest to the passed coordinate on the passed segment.
|
* Calculates the point closest to the passed coordinate on the passed segment.
|
||||||
* This is the foot of the perpendicular of the coordinate to the segment when
|
* This is the foot of the perpendicular of the coordinate to the segment when
|
||||||
@@ -49,7 +80,7 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
|
|||||||
var dx = x2 - x1;
|
var dx = x2 - x1;
|
||||||
var dy = y2 - y1;
|
var dy = y2 - y1;
|
||||||
var along = (dx === 0 && dy === 0) ? 0 :
|
var along = (dx === 0 && dy === 0) ? 0 :
|
||||||
((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
|
((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
|
||||||
var x, y;
|
var x, y;
|
||||||
if (along <= 0) {
|
if (along <= 0) {
|
||||||
x = x1;
|
x = x1;
|
||||||
@@ -90,13 +121,13 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
|
|||||||
*/
|
*/
|
||||||
ol.coordinate.createStringXY = function(opt_fractionDigits) {
|
ol.coordinate.createStringXY = function(opt_fractionDigits) {
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
||||||
* @return {string} String XY.
|
* @return {string} String XY.
|
||||||
*/
|
*/
|
||||||
function(coordinate) {
|
function(coordinate) {
|
||||||
return ol.coordinate.toStringXY(coordinate, opt_fractionDigits);
|
return ol.coordinate.toStringXY(coordinate, opt_fractionDigits);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -164,8 +195,8 @@ ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionD
|
|||||||
ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
|
ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
|
||||||
if (coordinate) {
|
if (coordinate) {
|
||||||
return template
|
return template
|
||||||
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
|
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
|
||||||
.replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
|
.replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
|
|||||||
*/
|
*/
|
||||||
ol.DeviceOrientation.prototype.getAlpha = function() {
|
ol.DeviceOrientation.prototype.getAlpha = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.DeviceOrientation.Property_.ALPHA));
|
this.get(ol.DeviceOrientation.Property_.ALPHA));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ ol.DeviceOrientation.prototype.getAlpha = function() {
|
|||||||
*/
|
*/
|
||||||
ol.DeviceOrientation.prototype.getBeta = function() {
|
ol.DeviceOrientation.prototype.getBeta = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.DeviceOrientation.Property_.BETA));
|
this.get(ol.DeviceOrientation.Property_.BETA));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ ol.DeviceOrientation.prototype.getBeta = function() {
|
|||||||
*/
|
*/
|
||||||
ol.DeviceOrientation.prototype.getGamma = function() {
|
ol.DeviceOrientation.prototype.getGamma = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.DeviceOrientation.Property_.GAMMA));
|
this.get(ol.DeviceOrientation.Property_.GAMMA));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ ol.DeviceOrientation.prototype.getGamma = function() {
|
|||||||
*/
|
*/
|
||||||
ol.DeviceOrientation.prototype.getHeading = function() {
|
ol.DeviceOrientation.prototype.getHeading = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.DeviceOrientation.Property_.HEADING));
|
this.get(ol.DeviceOrientation.Property_.HEADING));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ ol.DeviceOrientation.prototype.getHeading = function() {
|
|||||||
*/
|
*/
|
||||||
ol.DeviceOrientation.prototype.getTracking = function() {
|
ol.DeviceOrientation.prototype.getTracking = function() {
|
||||||
return /** @type {boolean} */ (
|
return /** @type {boolean} */ (
|
||||||
this.get(ol.DeviceOrientation.Property_.TRACKING));
|
this.get(ol.DeviceOrientation.Property_.TRACKING));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ goog.require('ol.has');
|
|||||||
ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
||||||
var originalEvent = mapBrowserEvent.originalEvent;
|
var originalEvent = mapBrowserEvent.originalEvent;
|
||||||
return (
|
return (
|
||||||
originalEvent.altKey &&
|
originalEvent.altKey &&
|
||||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||||
!originalEvent.shiftKey);
|
!originalEvent.shiftKey);
|
||||||
};
|
};
|
||||||
@@ -34,7 +34,7 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
|
|||||||
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
|
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
|
||||||
var originalEvent = mapBrowserEvent.originalEvent;
|
var originalEvent = mapBrowserEvent.originalEvent;
|
||||||
return (
|
return (
|
||||||
originalEvent.altKey &&
|
originalEvent.altKey &&
|
||||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||||
originalEvent.shiftKey);
|
originalEvent.shiftKey);
|
||||||
};
|
};
|
||||||
@@ -138,7 +138,7 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
|
|||||||
ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
||||||
var originalEvent = mapBrowserEvent.originalEvent;
|
var originalEvent = mapBrowserEvent.originalEvent;
|
||||||
return (
|
return (
|
||||||
!originalEvent.altKey &&
|
!originalEvent.altKey &&
|
||||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||||
!originalEvent.shiftKey);
|
!originalEvent.shiftKey);
|
||||||
};
|
};
|
||||||
@@ -156,7 +156,7 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
|
|||||||
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
||||||
var originalEvent = mapBrowserEvent.originalEvent;
|
var originalEvent = mapBrowserEvent.originalEvent;
|
||||||
return (
|
return (
|
||||||
!originalEvent.altKey &&
|
!originalEvent.altKey &&
|
||||||
(ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
|
(ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
|
||||||
!originalEvent.shiftKey);
|
!originalEvent.shiftKey);
|
||||||
};
|
};
|
||||||
@@ -173,7 +173,7 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
|
|||||||
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
|
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
|
||||||
var originalEvent = mapBrowserEvent.originalEvent;
|
var originalEvent = mapBrowserEvent.originalEvent;
|
||||||
return (
|
return (
|
||||||
!originalEvent.altKey &&
|
!originalEvent.altKey &&
|
||||||
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
|
||||||
originalEvent.shiftKey);
|
originalEvent.shiftKey);
|
||||||
};
|
};
|
||||||
@@ -191,7 +191,7 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
|
|||||||
var target = mapBrowserEvent.originalEvent.target;
|
var target = mapBrowserEvent.originalEvent.target;
|
||||||
var tagName = target.tagName;
|
var tagName = target.tagName;
|
||||||
return (
|
return (
|
||||||
tagName !== 'INPUT' &&
|
tagName !== 'INPUT' &&
|
||||||
tagName !== 'SELECT' &&
|
tagName !== 'SELECT' &&
|
||||||
tagName !== 'TEXTAREA');
|
tagName !== 'TEXTAREA');
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,15 +47,15 @@ ol.events.Event = function(type) {
|
|||||||
*/
|
*/
|
||||||
ol.events.Event.prototype.preventDefault =
|
ol.events.Event.prototype.preventDefault =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop event propagation.
|
* Stop event propagation.
|
||||||
* @function
|
* @function
|
||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.events.Event.prototype.stopPropagation = function() {
|
ol.events.Event.prototype.stopPropagation = function() {
|
||||||
this.propagationStopped = true;
|
this.propagationStopped = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ ol.events.EventTarget.prototype.getListeners = function(type) {
|
|||||||
*/
|
*/
|
||||||
ol.events.EventTarget.prototype.hasListener = function(opt_type) {
|
ol.events.EventTarget.prototype.hasListener = function(opt_type) {
|
||||||
return opt_type ?
|
return opt_type ?
|
||||||
opt_type in this.listeners_ :
|
opt_type in this.listeners_ :
|
||||||
Object.keys(this.listeners_).length > 0;
|
Object.keys(this.listeners_).length > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -426,8 +426,10 @@ ol.extent.forEachCorner = function(extent, callback, opt_this) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the size of an extent.
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @return {number} Area.
|
* @return {number} Area.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.extent.getArea = function(extent) {
|
ol.extent.getArea = function(extent) {
|
||||||
var area = 0;
|
var area = 0;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ ol.Feature.prototype.clone = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Feature.prototype.getGeometry = function() {
|
ol.Feature.prototype.getGeometry = function() {
|
||||||
return /** @type {ol.geom.Geometry|undefined} */ (
|
return /** @type {ol.geom.Geometry|undefined} */ (
|
||||||
this.get(this.geometryName_));
|
this.get(this.geometryName_));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ ol.Feature.prototype.setGeometry = function(geometry) {
|
|||||||
ol.Feature.prototype.setStyle = function(style) {
|
ol.Feature.prototype.setStyle = function(style) {
|
||||||
this.style_ = style;
|
this.style_ = style;
|
||||||
this.styleFunction_ = !style ?
|
this.styleFunction_ = !style ?
|
||||||
undefined : ol.Feature.createStyleFunction(style);
|
undefined : ol.Feature.createStyleFunction(style);
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,60 +18,60 @@ goog.require('ol.xml');
|
|||||||
*/
|
*/
|
||||||
ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
|
ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
|
||||||
return (
|
return (
|
||||||
|
/**
|
||||||
|
* @param {ol.Extent} extent Extent.
|
||||||
|
* @param {number} resolution Resolution.
|
||||||
|
* @param {ol.proj.Projection} projection Projection.
|
||||||
|
* @this {ol.source.Vector|ol.VectorTile}
|
||||||
|
*/
|
||||||
|
function(extent, resolution, projection) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET',
|
||||||
|
typeof url === 'function' ? url(extent, resolution, projection) : url,
|
||||||
|
true);
|
||||||
|
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
|
||||||
|
xhr.responseType = 'arraybuffer';
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {Event} event Event.
|
||||||
* @param {number} resolution Resolution.
|
* @private
|
||||||
* @param {ol.proj.Projection} projection Projection.
|
|
||||||
* @this {ol.source.Vector|ol.VectorTile}
|
|
||||||
*/
|
*/
|
||||||
function(extent, resolution, projection) {
|
xhr.onload = function(event) {
|
||||||
var xhr = new XMLHttpRequest();
|
// status will be 0 for file:// urls
|
||||||
xhr.open('GET',
|
if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
|
||||||
typeof url === 'function' ? url(extent, resolution, projection) : url,
|
var type = format.getType();
|
||||||
true);
|
/** @type {Document|Node|Object|string|undefined} */
|
||||||
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
|
var source;
|
||||||
xhr.responseType = 'arraybuffer';
|
if (type == ol.format.FormatType.JSON ||
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {Event} event Event.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
xhr.onload = function(event) {
|
|
||||||
// status will be 0 for file:// urls
|
|
||||||
if (!xhr.status || 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) {
|
type == ol.format.FormatType.TEXT) {
|
||||||
source = xhr.responseText;
|
source = xhr.responseText;
|
||||||
} else if (type == ol.format.FormatType.XML) {
|
} else if (type == ol.format.FormatType.XML) {
|
||||||
source = xhr.responseXML;
|
source = xhr.responseXML;
|
||||||
if (!source) {
|
if (!source) {
|
||||||
source = ol.xml.parse(xhr.responseText);
|
source = ol.xml.parse(xhr.responseText);
|
||||||
}
|
|
||||||
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
|
|
||||||
source = /** @type {ArrayBuffer} */ (xhr.response);
|
|
||||||
}
|
|
||||||
if (source) {
|
|
||||||
success.call(this, format.readFeatures(source,
|
|
||||||
{featureProjection: projection}),
|
|
||||||
format.readProjection(source));
|
|
||||||
} else {
|
|
||||||
failure.call(this);
|
|
||||||
}
|
}
|
||||||
|
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
|
||||||
|
source = /** @type {ArrayBuffer} */ (xhr.response);
|
||||||
|
}
|
||||||
|
if (source) {
|
||||||
|
success.call(this, format.readFeatures(source,
|
||||||
|
{featureProjection: projection}),
|
||||||
|
format.readProjection(source));
|
||||||
} else {
|
} else {
|
||||||
failure.call(this);
|
failure.call(this);
|
||||||
}
|
}
|
||||||
}.bind(this);
|
} else {
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
xhr.onerror = function() {
|
|
||||||
failure.call(this);
|
failure.call(this);
|
||||||
}.bind(this);
|
}
|
||||||
xhr.send();
|
}.bind(this);
|
||||||
});
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
xhr.onerror = function() {
|
||||||
|
failure.call(this);
|
||||||
|
}.bind(this);
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
|
|||||||
}
|
}
|
||||||
var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type];
|
var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type];
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(
|
ol.format.Feature.transformWithOptions(
|
||||||
geometryReader(object), false, opt_options));
|
geometryReader(object), false, opt_options));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -121,9 +121,11 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
|
|||||||
// loop over all outer rings and see if they contain our hole.
|
// loop over all outer rings and see if they contain our hole.
|
||||||
for (i = outerRings.length - 1; i >= 0; i--) {
|
for (i = outerRings.length - 1; i >= 0; i--) {
|
||||||
var outerRing = outerRings[i][0];
|
var outerRing = outerRings[i][0];
|
||||||
if (ol.extent.containsExtent(new ol.geom.LinearRing(
|
var containsHole = ol.extent.containsExtent(
|
||||||
outerRing).getExtent(),
|
new ol.geom.LinearRing(outerRing).getExtent(),
|
||||||
new ol.geom.LinearRing(hole).getExtent())) {
|
new ol.geom.LinearRing(hole).getExtent()
|
||||||
|
);
|
||||||
|
if (containsHole) {
|
||||||
// the hole is contained push it into our polygon
|
// the hole is contained push it into our polygon
|
||||||
outerRings[i].push(hole);
|
outerRings[i].push(hole);
|
||||||
matched = true;
|
matched = true;
|
||||||
@@ -468,7 +470,7 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function(
|
|||||||
if (opt_options && opt_options.idField &&
|
if (opt_options && opt_options.idField &&
|
||||||
esriJSONFeature.attributes[opt_options.idField]) {
|
esriJSONFeature.attributes[opt_options.idField]) {
|
||||||
feature.setId(/** @type {number} */(
|
feature.setId(/** @type {number} */(
|
||||||
esriJSONFeature.attributes[opt_options.idField]));
|
esriJSONFeature.attributes[opt_options.idField]));
|
||||||
}
|
}
|
||||||
if (esriJSONFeature.attributes) {
|
if (esriJSONFeature.attributes) {
|
||||||
feature.setProperties(esriJSONFeature.attributes);
|
feature.setProperties(esriJSONFeature.attributes);
|
||||||
@@ -559,8 +561,8 @@ ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
|
|||||||
ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
|
ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
|
||||||
var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
|
var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
|
||||||
return geometryWriter(/** @type {ol.geom.Geometry} */ (
|
return geometryWriter(/** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
|
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
|
||||||
opt_options);
|
opt_options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
|
|||||||
if (opt_options) {
|
if (opt_options) {
|
||||||
options = {
|
options = {
|
||||||
dataProjection: opt_options.dataProjection ?
|
dataProjection: opt_options.dataProjection ?
|
||||||
opt_options.dataProjection : this.readProjection(source),
|
opt_options.dataProjection : this.readProjection(source),
|
||||||
featureProjection: opt_options.featureProjection
|
featureProjection: opt_options.featureProjection
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -166,9 +166,9 @@ ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
|
|||||||
ol.format.Feature.transformWithOptions = function(
|
ol.format.Feature.transformWithOptions = function(
|
||||||
geometry, write, opt_options) {
|
geometry, write, opt_options) {
|
||||||
var featureProjection = opt_options ?
|
var featureProjection = opt_options ?
|
||||||
ol.proj.get(opt_options.featureProjection) : null;
|
ol.proj.get(opt_options.featureProjection) : null;
|
||||||
var dataProjection = opt_options ?
|
var dataProjection = opt_options ?
|
||||||
ol.proj.get(opt_options.dataProjection) : null;
|
ol.proj.get(opt_options.dataProjection) : null;
|
||||||
/**
|
/**
|
||||||
* @type {ol.geom.Geometry|ol.Extent}
|
* @type {ol.geom.Geometry|ol.Extent}
|
||||||
*/
|
*/
|
||||||
@@ -183,14 +183,14 @@ ol.format.Feature.transformWithOptions = function(
|
|||||||
// FIXME this is necessary because ol.format.GML treats extents
|
// FIXME this is necessary because ol.format.GML treats extents
|
||||||
// as geometries
|
// as geometries
|
||||||
transformed = ol.proj.transformExtent(
|
transformed = ol.proj.transformExtent(
|
||||||
write ? geometry.slice() : geometry,
|
geometry,
|
||||||
write ? featureProjection : dataProjection,
|
dataProjection,
|
||||||
write ? dataProjection : featureProjection);
|
featureProjection);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
transformed = geometry;
|
transformed = geometry;
|
||||||
}
|
}
|
||||||
if (write && opt_options && opt_options.decimals) {
|
if (write && opt_options && opt_options.decimals !== undefined) {
|
||||||
var power = Math.pow(10, opt_options.decimals);
|
var power = Math.pow(10, opt_options.decimals);
|
||||||
// if decimals option on write, round each coordinate appropriately
|
// if decimals option on write, round each coordinate appropriately
|
||||||
/**
|
/**
|
||||||
@@ -203,11 +203,10 @@ ol.format.Feature.transformWithOptions = function(
|
|||||||
}
|
}
|
||||||
return coordinates;
|
return coordinates;
|
||||||
};
|
};
|
||||||
if (Array.isArray(transformed)) {
|
if (transformed === geometry) {
|
||||||
transform(transformed);
|
transformed = transformed.clone();
|
||||||
} else {
|
|
||||||
transformed.applyTransform(transform);
|
|
||||||
}
|
}
|
||||||
|
transformed.applyTransform(transform);
|
||||||
}
|
}
|
||||||
return transformed;
|
return transformed;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.format.filter');
|
|||||||
|
|
||||||
goog.require('ol.format.filter.And');
|
goog.require('ol.format.filter.And');
|
||||||
goog.require('ol.format.filter.Bbox');
|
goog.require('ol.format.filter.Bbox');
|
||||||
|
goog.require('ol.format.filter.During');
|
||||||
goog.require('ol.format.filter.EqualTo');
|
goog.require('ol.format.filter.EqualTo');
|
||||||
goog.require('ol.format.filter.GreaterThan');
|
goog.require('ol.format.filter.GreaterThan');
|
||||||
goog.require('ol.format.filter.GreaterThanOrEqualTo');
|
goog.require('ol.format.filter.GreaterThanOrEqualTo');
|
||||||
@@ -228,5 +229,19 @@ ol.format.filter.between = function(propertyName, lowerBoundary, upperBoundary)
|
|||||||
ol.format.filter.like = function(propertyName, pattern,
|
ol.format.filter.like = function(propertyName, pattern,
|
||||||
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
|
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
|
||||||
return new ol.format.filter.IsLike(propertyName, pattern,
|
return new ol.format.filter.IsLike(propertyName, pattern,
|
||||||
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
|
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a `<During>` temporal operator.
|
||||||
|
*
|
||||||
|
* @param {!string} propertyName Name of the context property to compare.
|
||||||
|
* @param {!string} begin The begin date in ISO-8601 format.
|
||||||
|
* @param {!string} end The end date in ISO-8601 format.
|
||||||
|
* @returns {!ol.format.filter.During} `<During>` operator.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.format.filter.during = function(propertyName, begin, end) {
|
||||||
|
return new ol.format.filter.During(propertyName, begin, end);
|
||||||
};
|
};
|
||||||
|
|||||||
33
src/ol/format/filter/during.js
Normal file
33
src/ol/format/filter/during.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
goog.provide('ol.format.filter.During');
|
||||||
|
|
||||||
|
goog.require('ol');
|
||||||
|
goog.require('ol.format.filter.Comparison');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc
|
||||||
|
* Represents a `<During>` comparison operator.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @param {!string} propertyName Name of the context property to compare.
|
||||||
|
* @param {!string} begin The begin date in ISO-8601 format.
|
||||||
|
* @param {!string} end The end date in ISO-8601 format.
|
||||||
|
* @extends {ol.format.filter.Comparison}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.format.filter.During = function(propertyName, begin, end) {
|
||||||
|
ol.format.filter.Comparison.call(this, 'During', propertyName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
* @type {!string}
|
||||||
|
*/
|
||||||
|
this.begin = begin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
* @type {!string}
|
||||||
|
*/
|
||||||
|
this.end = end;
|
||||||
|
};
|
||||||
|
ol.inherits(ol.format.filter.During, ol.format.filter.Comparison);
|
||||||
@@ -39,7 +39,7 @@ ol.format.GeoJSON = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.defaultDataProjection = ol.proj.get(
|
this.defaultDataProjection = ol.proj.get(
|
||||||
options.defaultDataProjection ?
|
options.defaultDataProjection ?
|
||||||
options.defaultDataProjection : 'EPSG:4326');
|
options.defaultDataProjection : 'EPSG:4326');
|
||||||
|
|
||||||
|
|
||||||
if (options.featureProjection) {
|
if (options.featureProjection) {
|
||||||
@@ -69,8 +69,8 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
|
|||||||
}
|
}
|
||||||
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
|
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(
|
ol.format.Feature.transformWithOptions(
|
||||||
geometryReader(object), false, opt_options));
|
geometryReader(object), false, opt_options));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -163,8 +163,8 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
|
|||||||
ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
|
ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
|
||||||
var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
|
var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
|
||||||
return geometryWriter(/** @type {ol.geom.Geometry} */ (
|
return geometryWriter(/** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
|
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
|
||||||
opt_options);
|
opt_options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -329,7 +329,8 @@ ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
|
|||||||
/**
|
/**
|
||||||
* Read a feature from a GeoJSON Feature source. Only works for Feature or
|
* Read a feature from a GeoJSON Feature source. Only works for Feature or
|
||||||
* geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read
|
* geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read
|
||||||
* FeatureCollection source.
|
* FeatureCollection source. If feature at source has an id, it will be used
|
||||||
|
* as Feature id by calling {@link ol.Feature#setId} internally.
|
||||||
*
|
*
|
||||||
* @function
|
* @function
|
||||||
* @param {Document|Node|Object|string} source Source.
|
* @param {Document|Node|Object|string} source Source.
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ ol.format.GML2 = function(opt_options) {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
this.schemaLocation = options.schemaLocation ?
|
this.schemaLocation = options.schemaLocation ?
|
||||||
options.schemaLocation : ol.format.GML2.schemaLocation_;
|
options.schemaLocation : ol.format.GML2.schemaLocation_;
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.GML2, ol.format.GMLBase);
|
ol.inherits(ol.format.GML2, ol.format.GMLBase);
|
||||||
@@ -469,8 +469,8 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
|||||||
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
||||||
}
|
}
|
||||||
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||||
point[0] + ',' + point[1] :
|
point[0] + ',' + point[1] :
|
||||||
point[1] + ',' + point[0]);
|
point[1] + ',' + point[0]);
|
||||||
if (opt_hasZ) {
|
if (opt_hasZ) {
|
||||||
// For newly created points, Z can be undefined.
|
// For newly created points, Z can be undefined.
|
||||||
var z = point[2] || 0;
|
var z = point[2] || 0;
|
||||||
|
|||||||
@@ -52,20 +52,20 @@ ol.format.GML3 = function(opt_options) {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.multiCurve_ = options.multiCurve !== undefined ?
|
this.multiCurve_ = options.multiCurve !== undefined ?
|
||||||
options.multiCurve : true;
|
options.multiCurve : true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.multiSurface_ = options.multiSurface !== undefined ?
|
this.multiSurface_ = options.multiSurface !== undefined ?
|
||||||
options.multiSurface : true;
|
options.multiSurface : true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
this.schemaLocation = options.schemaLocation ?
|
this.schemaLocation = options.schemaLocation ?
|
||||||
options.schemaLocation : ol.format.GML3.schemaLocation_;
|
options.schemaLocation : ol.format.GML3.schemaLocation_;
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.GML3, ol.format.GMLBase);
|
ol.inherits(ol.format.GML3, ol.format.GMLBase);
|
||||||
@@ -601,8 +601,8 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
|||||||
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
||||||
}
|
}
|
||||||
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||||
point[0] + ' ' + point[1] :
|
point[0] + ' ' + point[1] :
|
||||||
point[1] + ' ' + point[0]);
|
point[1] + ' ' + point[0]);
|
||||||
if (opt_hasZ) {
|
if (opt_hasZ) {
|
||||||
// For newly created points, Z can be undefined.
|
// For newly created points, Z can be undefined.
|
||||||
var z = point[2] || 0;
|
var z = point[2] || 0;
|
||||||
|
|||||||
@@ -167,12 +167,12 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
|||||||
var parsers = {};
|
var parsers = {};
|
||||||
for (i = 0, ii = featureTypes.length; i < ii; ++i) {
|
for (i = 0, ii = featureTypes.length; i < ii; ++i) {
|
||||||
var featurePrefix = featureTypes[i].indexOf(':') === -1 ?
|
var featurePrefix = featureTypes[i].indexOf(':') === -1 ?
|
||||||
defaultPrefix : featureTypes[i].split(':')[0];
|
defaultPrefix : featureTypes[i].split(':')[0];
|
||||||
if (featurePrefix === p) {
|
if (featurePrefix === p) {
|
||||||
parsers[featureTypes[i].split(':').pop()] =
|
parsers[featureTypes[i].split(':').pop()] =
|
||||||
(localName == 'featureMembers') ?
|
(localName == 'featureMembers') ?
|
||||||
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
|
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
|
||||||
ol.xml.makeReplacer(this.readFeatureElement, this);
|
ol.xml.makeReplacer(this.readFeatureElement, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parsersNS[featureNS[p]] = parsers;
|
parsersNS[featureNS[p]] = parsers;
|
||||||
@@ -203,7 +203,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
|||||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, false, context));
|
ol.format.Feature.transformWithOptions(geometry, false, context));
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -590,5 +590,5 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
|
|||||||
*/
|
*/
|
||||||
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
|
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
|
||||||
return ol.proj.get(this.srsName ? this.srsName :
|
return ol.proj.get(this.srsName ? this.srsName :
|
||||||
node.firstElementChild.getAttribute('srsName'));
|
node.firstElementChild.getAttribute('srsName'));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -606,8 +606,8 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
|
|||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
var orderedKeys = (node.nodeName == 'rtept') ?
|
var orderedKeys = (node.nodeName == 'rtept') ?
|
||||||
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
|
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
|
||||||
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
|
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
|
||||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||||
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||||
({node: node, 'properties': properties}),
|
({node: node, 'properties': properties}),
|
||||||
@@ -629,7 +629,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
|
|||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
geometry = /** @type {ol.geom.LineString} */
|
geometry = /** @type {ol.geom.LineString} */
|
||||||
(ol.format.Feature.transformWithOptions(geometry, true, options));
|
(ol.format.Feature.transformWithOptions(geometry, true, options));
|
||||||
context['geometryLayout'] = geometry.getLayout();
|
context['geometryLayout'] = geometry.getLayout();
|
||||||
properties['rtept'] = geometry.getCoordinates();
|
properties['rtept'] = geometry.getCoordinates();
|
||||||
}
|
}
|
||||||
@@ -656,7 +656,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
|||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
geometry = /** @type {ol.geom.MultiLineString} */
|
geometry = /** @type {ol.geom.MultiLineString} */
|
||||||
(ol.format.Feature.transformWithOptions(geometry, true, options));
|
(ol.format.Feature.transformWithOptions(geometry, true, options));
|
||||||
properties['trkseg'] = geometry.getLineStrings();
|
properties['trkseg'] = geometry.getLineStrings();
|
||||||
}
|
}
|
||||||
var parentNode = objectStack[objectStack.length - 1].node;
|
var parentNode = objectStack[objectStack.length - 1].node;
|
||||||
@@ -697,7 +697,7 @@ ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
|
|||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
geometry = /** @type {ol.geom.Point} */
|
geometry = /** @type {ol.geom.Point} */
|
||||||
(ol.format.Feature.transformWithOptions(geometry, true, options));
|
(ol.format.Feature.transformWithOptions(geometry, true, options));
|
||||||
context['geometryLayout'] = geometry.getLayout();
|
context['geometryLayout'] = geometry.getLayout();
|
||||||
ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack);
|
ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ ol.format.IGC = function(opt_options) {
|
|||||||
* @type {ol.format.IGCZ}
|
* @type {ol.format.IGCZ}
|
||||||
*/
|
*/
|
||||||
this.altitudeMode_ = options.altitudeMode ?
|
this.altitudeMode_ = options.altitudeMode ?
|
||||||
options.altitudeMode : ol.format.IGCZ.NONE;
|
options.altitudeMode : ol.format.IGCZ.NONE;
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.IGC, ol.format.TextFeature);
|
ol.inherits(ol.format.IGC, ol.format.TextFeature);
|
||||||
@@ -158,7 +158,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
|
|||||||
}
|
}
|
||||||
var lineString = new ol.geom.LineString(null);
|
var lineString = new ol.geom.LineString(null);
|
||||||
var layout = altitudeMode == ol.format.IGCZ.NONE ?
|
var layout = altitudeMode == ol.format.IGCZ.NONE ?
|
||||||
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
|
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
|
||||||
lineString.setFlatCoordinates(layout, flatCoordinates);
|
lineString.setFlatCoordinates(layout, flatCoordinates);
|
||||||
var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
|
var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
|
||||||
lineString, false, opt_options));
|
lineString, false, opt_options));
|
||||||
|
|||||||
@@ -66,21 +66,21 @@ ol.format.KML = function(opt_options) {
|
|||||||
* @type {Array.<ol.style.Style>}
|
* @type {Array.<ol.style.Style>}
|
||||||
*/
|
*/
|
||||||
this.defaultStyle_ = options.defaultStyle ?
|
this.defaultStyle_ = options.defaultStyle ?
|
||||||
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
|
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.extractStyles_ = options.extractStyles !== undefined ?
|
this.extractStyles_ = options.extractStyles !== undefined ?
|
||||||
options.extractStyles : true;
|
options.extractStyles : true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.writeStyles_ = options.writeStyles !== undefined ?
|
this.writeStyles_ = options.writeStyles !== undefined ?
|
||||||
options.writeStyles : true;
|
options.writeStyles : true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -93,7 +93,7 @@ ol.format.KML = function(opt_options) {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.showPointNames_ = options.showPointNames !== undefined ?
|
this.showPointNames_ = options.showPointNames !== undefined ?
|
||||||
options.showPointNames : true;
|
options.showPointNames : true;
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.KML, ol.format.XMLFeature);
|
ol.inherits(ol.format.KML, ol.format.XMLFeature);
|
||||||
@@ -353,53 +353,53 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
|
|||||||
defaultStyle, sharedStyles, showPointNames) {
|
defaultStyle, sharedStyles, showPointNames) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @return {Array.<ol.style.Style>} Style.
|
* @return {Array.<ol.style.Style>} Style.
|
||||||
* @this {ol.Feature}
|
* @this {ol.Feature}
|
||||||
*/
|
*/
|
||||||
function(resolution) {
|
function(resolution) {
|
||||||
var drawName = showPointNames;
|
var drawName = showPointNames;
|
||||||
/** @type {ol.style.Style|undefined} */
|
/** @type {ol.style.Style|undefined} */
|
||||||
var nameStyle;
|
var nameStyle;
|
||||||
var name = '';
|
var name = '';
|
||||||
if (drawName) {
|
if (drawName) {
|
||||||
if (this.getGeometry()) {
|
if (this.getGeometry()) {
|
||||||
drawName = (this.getGeometry().getType() ===
|
drawName = (this.getGeometry().getType() ===
|
||||||
ol.geom.GeometryType.POINT);
|
ol.geom.GeometryType.POINT);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (drawName) {
|
if (drawName) {
|
||||||
name = /** @type {string} */ (this.get('name'));
|
name = /** @type {string} */ (this.get('name'));
|
||||||
drawName = drawName && name;
|
drawName = drawName && name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style) {
|
if (style) {
|
||||||
if (drawName) {
|
|
||||||
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
|
|
||||||
name);
|
|
||||||
return style.concat(nameStyle);
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
if (styleUrl) {
|
|
||||||
var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle,
|
|
||||||
sharedStyles);
|
|
||||||
if (drawName) {
|
|
||||||
nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0],
|
|
||||||
name);
|
|
||||||
return foundStyle.concat(nameStyle);
|
|
||||||
}
|
|
||||||
return foundStyle;
|
|
||||||
}
|
|
||||||
if (drawName) {
|
if (drawName) {
|
||||||
nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0],
|
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
|
||||||
name);
|
name);
|
||||||
return defaultStyle.concat(nameStyle);
|
return style.concat(nameStyle);
|
||||||
}
|
}
|
||||||
return defaultStyle;
|
return style;
|
||||||
});
|
}
|
||||||
|
if (styleUrl) {
|
||||||
|
var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle,
|
||||||
|
sharedStyles);
|
||||||
|
if (drawName) {
|
||||||
|
nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0],
|
||||||
|
name);
|
||||||
|
return foundStyle.concat(nameStyle);
|
||||||
|
}
|
||||||
|
return foundStyle;
|
||||||
|
}
|
||||||
|
if (drawName) {
|
||||||
|
nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0],
|
||||||
|
name);
|
||||||
|
return defaultStyle.concat(nameStyle);
|
||||||
|
}
|
||||||
|
return defaultStyle;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ ol.format.KML.readFlatCoordinates_ = function(node) {
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.readURI_ = function(node) {
|
ol.format.KML.readURI_ = function(node) {
|
||||||
var s = ol.xml.getAllTextContent(node, false).trim();
|
var s = ol.xml.getAllTextContent(node, false).trim();
|
||||||
if (node.baseURI) {
|
if (node.baseURI && node.baseURI !== 'about:blank') {
|
||||||
var url = new URL(s, node.baseURI);
|
var url = new URL(s, node.baseURI);
|
||||||
return url.href;
|
return url.href;
|
||||||
} else {
|
} else {
|
||||||
@@ -549,7 +549,7 @@ ol.format.KML.readStyleMapValue_ = function(node, objectStack) {
|
|||||||
return ol.xml.pushParseAndPop(undefined,
|
return ol.xml.pushParseAndPop(undefined,
|
||||||
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
|
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @param {Node} node Node.
|
* @param {Node} node Node.
|
||||||
* @param {Array.<*>} objectStack Object stack.
|
* @param {Array.<*>} objectStack Object stack.
|
||||||
* @private
|
* @private
|
||||||
@@ -807,7 +807,7 @@ ol.format.KML.readGxTrack_ = function(node, objectStack) {
|
|||||||
var whens = gxTrackObject.whens;
|
var whens = gxTrackObject.whens;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii;
|
for (i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii;
|
||||||
++i) {
|
++i) {
|
||||||
flatCoordinates[4 * i + 3] = whens[i];
|
flatCoordinates[4 * i + 3] = whens[i];
|
||||||
}
|
}
|
||||||
var lineString = new ol.geom.LineString(null);
|
var lineString = new ol.geom.LineString(null);
|
||||||
@@ -1021,23 +1021,23 @@ ol.format.KML.readStyle_ = function(node, objectStack) {
|
|||||||
}
|
}
|
||||||
var fillStyle = /** @type {ol.style.Fill} */
|
var fillStyle = /** @type {ol.style.Fill} */
|
||||||
('fillStyle' in styleObject ?
|
('fillStyle' in styleObject ?
|
||||||
styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_);
|
styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_);
|
||||||
var fill = /** @type {boolean|undefined} */ (styleObject['fill']);
|
var fill = /** @type {boolean|undefined} */ (styleObject['fill']);
|
||||||
if (fill !== undefined && !fill) {
|
if (fill !== undefined && !fill) {
|
||||||
fillStyle = null;
|
fillStyle = null;
|
||||||
}
|
}
|
||||||
var imageStyle = /** @type {ol.style.Image} */
|
var imageStyle = /** @type {ol.style.Image} */
|
||||||
('imageStyle' in styleObject ?
|
('imageStyle' in styleObject ?
|
||||||
styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_);
|
styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_);
|
||||||
if (imageStyle == ol.format.KML.DEFAULT_NO_IMAGE_STYLE_) {
|
if (imageStyle == ol.format.KML.DEFAULT_NO_IMAGE_STYLE_) {
|
||||||
imageStyle = undefined;
|
imageStyle = undefined;
|
||||||
}
|
}
|
||||||
var textStyle = /** @type {ol.style.Text} */
|
var textStyle = /** @type {ol.style.Text} */
|
||||||
('textStyle' in styleObject ?
|
('textStyle' in styleObject ?
|
||||||
styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_);
|
styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_);
|
||||||
var strokeStyle = /** @type {ol.style.Stroke} */
|
var strokeStyle = /** @type {ol.style.Stroke} */
|
||||||
('strokeStyle' in styleObject ?
|
('strokeStyle' in styleObject ?
|
||||||
styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_);
|
styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_);
|
||||||
var outline = /** @type {boolean|undefined} */
|
var outline = /** @type {boolean|undefined} */
|
||||||
(styleObject['outline']);
|
(styleObject['outline']);
|
||||||
if (outline !== undefined && !outline) {
|
if (outline !== undefined && !outline) {
|
||||||
@@ -1092,13 +1092,13 @@ ol.format.KML.setCommonGeometryProperties_ = function(multiGeometry,
|
|||||||
ol.format.KML.DataParser_ = function(node, objectStack) {
|
ol.format.KML.DataParser_ = function(node, objectStack) {
|
||||||
var name = node.getAttribute('name');
|
var name = node.getAttribute('name');
|
||||||
ol.xml.parseNode(ol.format.KML.DATA_PARSERS_, node, objectStack);
|
ol.xml.parseNode(ol.format.KML.DATA_PARSERS_, node, objectStack);
|
||||||
var featureObject =
|
var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||||
/** @type {Object} */ (objectStack[objectStack.length - 1]);
|
|
||||||
if (name !== null) {
|
if (name !== null) {
|
||||||
featureObject[name] = featureObject.value;
|
featureObject[name] = featureObject.value;
|
||||||
} else if (featureObject.displayName !== null) {
|
} else if (featureObject.displayName !== null) {
|
||||||
featureObject[featureObject.displayName] = featureObject.value;
|
featureObject[featureObject.displayName] = featureObject.value;
|
||||||
}
|
}
|
||||||
|
delete featureObject['value'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1737,7 +1737,7 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) {
|
|||||||
var style = ol.format.KML.readStyle_(node, objectStack);
|
var style = ol.format.KML.readStyle_(node, objectStack);
|
||||||
if (style) {
|
if (style) {
|
||||||
var styleUri;
|
var styleUri;
|
||||||
if (node.baseURI) {
|
if (node.baseURI && node.baseURI !== 'about:blank') {
|
||||||
var url = new URL('#' + id, node.baseURI);
|
var url = new URL('#' + id, node.baseURI);
|
||||||
styleUri = url.href;
|
styleUri = url.href;
|
||||||
} else {
|
} else {
|
||||||
@@ -1764,7 +1764,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var styleUri;
|
var styleUri;
|
||||||
if (node.baseURI) {
|
if (node.baseURI && node.baseURI !== 'about:blank') {
|
||||||
var url = new URL('#' + id, node.baseURI);
|
var url = new URL('#' + id, node.baseURI);
|
||||||
styleUri = url.href;
|
styleUri = url.href;
|
||||||
} else {
|
} else {
|
||||||
@@ -2144,16 +2144,16 @@ ol.format.KML.writeDataNode_ = function(node, pair, objectStack) {
|
|||||||
if (typeof value == 'object') {
|
if (typeof value == 'object') {
|
||||||
if (value !== null && value.displayName) {
|
if (value !== null && value.displayName) {
|
||||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
||||||
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']);
|
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value !== null && value.value) {
|
if (value !== null && value.value) {
|
||||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
||||||
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']);
|
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
||||||
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']);
|
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2206,7 +2206,7 @@ ol.format.KML.writeExtendedData_ = function(node, namesAndValues, objectStack) {
|
|||||||
|
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
|
||||||
ol.format.KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack);
|
ol.format.KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2420,7 +2420,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
|||||||
var sequence = ol.xml.makeSequence(properties, keys);
|
var sequence = ol.xml.makeSequence(properties, keys);
|
||||||
var namesAndValues = {names: keys, values: sequence};
|
var namesAndValues = {names: keys, values: sequence};
|
||||||
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
|
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
|
||||||
ol.format.KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack);
|
ol.format.KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
var styleFunction = feature.getStyleFunction();
|
var styleFunction = feature.getStyleFunction();
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ ol.format.MVT = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {function((ol.geom.Geometry|Object.<string, *>)=)|
|
* @type {function((ol.geom.Geometry|Object.<string,*>)=)|
|
||||||
* function(ol.geom.GeometryType,Array.<number>,
|
* function(ol.geom.GeometryType,Array.<number>,
|
||||||
* (Array.<number>|Array.<Array.<number>>),Object.<string, *>)}
|
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
|
||||||
*/
|
*/
|
||||||
this.featureClass_ = options.featureClass ?
|
this.featureClass_ = options.featureClass ?
|
||||||
options.featureClass : ol.render.Feature;
|
options.featureClass : ol.render.Feature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -124,7 +124,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
|
|||||||
var geometryType;
|
var geometryType;
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
geometryType = coords.length === 1 ?
|
geometryType = coords.length === 1 ?
|
||||||
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
|
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
|
||||||
} else if (type === 2) {
|
} else if (type === 2) {
|
||||||
if (coords.length === 1) {
|
if (coords.length === 1) {
|
||||||
geometryType = ol.geom.GeometryType.LINE_STRING;
|
geometryType = ol.geom.GeometryType.LINE_STRING;
|
||||||
@@ -137,8 +137,9 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
|
|||||||
|
|
||||||
var values = rawFeature.properties;
|
var values = rawFeature.properties;
|
||||||
values[this.layerName_] = layer;
|
values[this.layerName_] = layer;
|
||||||
|
var id = rawFeature.id;
|
||||||
|
|
||||||
return new this.featureClass_(geometryType, flatCoordinates, ends, values);
|
return new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ ol.format.MVT.readGeometry_ = function(rawFeature) {
|
|||||||
var geom;
|
var geom;
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
geom = coords.length === 1 ?
|
geom = coords.length === 1 ?
|
||||||
new ol.geom.Point(null) : new ol.geom.MultiPoint(null);
|
new ol.geom.Point(null) : new ol.geom.MultiPoint(null);
|
||||||
} else if (type === 2) {
|
} else if (type === 2) {
|
||||||
if (coords.length === 1) {
|
if (coords.length === 1) {
|
||||||
geom = new ol.geom.LineString(null);
|
geom = new ol.geom.LineString(null);
|
||||||
|
|||||||
@@ -386,13 +386,13 @@ ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
|
|||||||
*/
|
*/
|
||||||
ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
|
ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
|
||||||
ol.xml.makeStructureNS(
|
ol.xml.makeStructureNS(
|
||||||
ol.format.OWS.NAMESPACE_URIS_, {
|
ol.format.OWS.NAMESPACE_URIS_, {
|
||||||
'IndividualName': ol.xml.makeObjectPropertySetter(
|
'IndividualName': ol.xml.makeObjectPropertySetter(
|
||||||
ol.format.XSD.readString),
|
ol.format.XSD.readString),
|
||||||
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
|
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
|
||||||
'ContactInfo': ol.xml.makeObjectPropertySetter(
|
'ContactInfo': ol.xml.makeObjectPropertySetter(
|
||||||
ol.format.OWS.readContactInfo_)
|
ol.format.OWS.readContactInfo_)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -402,12 +402,12 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
|
|||||||
*/
|
*/
|
||||||
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
|
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
|
||||||
ol.xml.makeStructureNS(
|
ol.xml.makeStructureNS(
|
||||||
ol.format.OWS.NAMESPACE_URIS_, {
|
ol.format.OWS.NAMESPACE_URIS_, {
|
||||||
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
|
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
|
||||||
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
|
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
|
||||||
ol.format.XSD.readString),
|
ol.format.XSD.readString),
|
||||||
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
|
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -417,9 +417,9 @@ ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
|
|||||||
*/
|
*/
|
||||||
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =
|
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =
|
||||||
ol.xml.makeStructureNS(
|
ol.xml.makeStructureNS(
|
||||||
ol.format.OWS.NAMESPACE_URIS_, {
|
ol.format.OWS.NAMESPACE_URIS_, {
|
||||||
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
|
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
|
||||||
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
|
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
|
||||||
'ServiceContact': ol.xml.makeObjectPropertySetter(
|
'ServiceContact': ol.xml.makeObjectPropertySetter(
|
||||||
ol.format.OWS.readServiceContact_)
|
ol.format.OWS.readServiceContact_)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ ol.format.Polyline = function(opt_options) {
|
|||||||
* @type {ol.geom.GeometryLayout}
|
* @type {ol.geom.GeometryLayout}
|
||||||
*/
|
*/
|
||||||
this.geometryLayout_ = options.geometryLayout ?
|
this.geometryLayout_ = options.geometryLayout ?
|
||||||
options.geometryLayout : ol.geom.GeometryLayout.XY;
|
options.geometryLayout : ol.geom.GeometryLayout.XY;
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.Polyline, ol.format.TextFeature);
|
ol.inherits(ol.format.Polyline, ol.format.TextFeature);
|
||||||
|
|
||||||
@@ -332,9 +332,9 @@ ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options)
|
|||||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
flatCoordinates, 0, flatCoordinates.length, stride);
|
||||||
|
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(
|
ol.format.Feature.transformWithOptions(
|
||||||
new ol.geom.LineString(coordinates, this.geometryLayout_), false,
|
new ol.geom.LineString(coordinates, this.geometryLayout_), false,
|
||||||
this.adaptOptions(opt_options)));
|
this.adaptOptions(opt_options)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -388,8 +388,8 @@ ol.format.Polyline.prototype.writeGeometry;
|
|||||||
*/
|
*/
|
||||||
ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
|
ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
|
||||||
geometry = /** @type {ol.geom.LineString} */
|
geometry = /** @type {ol.geom.LineString} */
|
||||||
(ol.format.Feature.transformWithOptions(
|
(ol.format.Feature.transformWithOptions(
|
||||||
geometry, true, this.adaptOptions(opt_options)));
|
geometry, true, this.adaptOptions(opt_options)));
|
||||||
var flatCoordinates = geometry.getFlatCoordinates();
|
var flatCoordinates = geometry.getFlatCoordinates();
|
||||||
var stride = geometry.getStride();
|
var stride = geometry.getStride();
|
||||||
ol.geom.flat.flip.flipXY(
|
ol.geom.flat.flip.flipXY(
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ goog.require('ol.geom.MultiPoint');
|
|||||||
goog.require('ol.geom.MultiPolygon');
|
goog.require('ol.geom.MultiPolygon');
|
||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.obj');
|
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
|
|
||||||
|
|
||||||
@@ -29,12 +28,24 @@ ol.format.TopoJSON = function(opt_options) {
|
|||||||
|
|
||||||
ol.format.JSONFeature.call(this);
|
ol.format.JSONFeature.call(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {string|undefined}
|
||||||
|
*/
|
||||||
|
this.layerName_ = options.layerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Array.<string>}
|
||||||
|
*/
|
||||||
|
this.layers_ = options.layers ? options.layers : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
this.defaultDataProjection = ol.proj.get(
|
this.defaultDataProjection = ol.proj.get(
|
||||||
options.defaultDataProjection ?
|
options.defaultDataProjection ?
|
||||||
options.defaultDataProjection : 'EPSG:4326');
|
options.defaultDataProjection : 'EPSG:4326');
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
|
ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
|
||||||
@@ -202,18 +213,21 @@ ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
|
|||||||
* @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs.
|
* @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs.
|
||||||
* @param {Array.<number>} scale Scale for each dimension.
|
* @param {Array.<number>} scale Scale for each dimension.
|
||||||
* @param {Array.<number>} translate Translation for each dimension.
|
* @param {Array.<number>} translate Translation for each dimension.
|
||||||
|
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
|
||||||
|
* object to.
|
||||||
|
* @param {string} name Name of the `Topology`'s child object.
|
||||||
* @param {olx.format.ReadOptions=} opt_options Read options.
|
* @param {olx.format.ReadOptions=} opt_options Read options.
|
||||||
* @return {Array.<ol.Feature>} Array of features.
|
* @return {Array.<ol.Feature>} Array of features.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
|
ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
|
||||||
collection, arcs, scale, translate, opt_options) {
|
collection, arcs, scale, translate, property, name, opt_options) {
|
||||||
var geometries = collection.geometries;
|
var geometries = collection.geometries;
|
||||||
var features = [];
|
var features = [];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||||
features[i] = ol.format.TopoJSON.readFeatureFromGeometry_(
|
features[i] = ol.format.TopoJSON.readFeatureFromGeometry_(
|
||||||
geometries[i], arcs, scale, translate, opt_options);
|
geometries[i], arcs, scale, translate, property, name, opt_options);
|
||||||
}
|
}
|
||||||
return features;
|
return features;
|
||||||
};
|
};
|
||||||
@@ -226,12 +240,15 @@ ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
|
|||||||
* @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs.
|
* @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs.
|
||||||
* @param {Array.<number>} scale Scale for each dimension.
|
* @param {Array.<number>} scale Scale for each dimension.
|
||||||
* @param {Array.<number>} translate Translation for each dimension.
|
* @param {Array.<number>} translate Translation for each dimension.
|
||||||
|
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
|
||||||
|
* object to.
|
||||||
|
* @param {string} name Name of the `Topology`'s child object.
|
||||||
* @param {olx.format.ReadOptions=} opt_options Read options.
|
* @param {olx.format.ReadOptions=} opt_options Read options.
|
||||||
* @return {ol.Feature} Feature.
|
* @return {ol.Feature} Feature.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
|
ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
|
||||||
scale, translate, opt_options) {
|
scale, translate, property, name, opt_options) {
|
||||||
var geometry;
|
var geometry;
|
||||||
var type = object.type;
|
var type = object.type;
|
||||||
var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type];
|
var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type];
|
||||||
@@ -242,12 +259,19 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
|
|||||||
}
|
}
|
||||||
var feature = new ol.Feature();
|
var feature = new ol.Feature();
|
||||||
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
|
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
|
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
|
||||||
if (object.id !== undefined) {
|
if (object.id !== undefined) {
|
||||||
feature.setId(object.id);
|
feature.setId(object.id);
|
||||||
}
|
}
|
||||||
if (object.properties) {
|
var properties = object.properties;
|
||||||
feature.setProperties(object.properties);
|
if (property) {
|
||||||
|
if (!properties) {
|
||||||
|
properties = {};
|
||||||
|
}
|
||||||
|
properties[property] = name;
|
||||||
|
}
|
||||||
|
if (properties) {
|
||||||
|
feature.setProperties(properties);
|
||||||
}
|
}
|
||||||
return feature;
|
return feature;
|
||||||
};
|
};
|
||||||
@@ -283,21 +307,24 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
|
|||||||
}
|
}
|
||||||
/** @type {Array.<ol.Feature>} */
|
/** @type {Array.<ol.Feature>} */
|
||||||
var features = [];
|
var features = [];
|
||||||
var topoJSONFeatures = ol.obj.getValues(topoJSONTopology.objects);
|
var topoJSONFeatures = topoJSONTopology.objects;
|
||||||
var i, ii;
|
var property = this.layerName_;
|
||||||
var feature;
|
var objectName, feature;
|
||||||
for (i = 0, ii = topoJSONFeatures.length; i < ii; ++i) {
|
for (objectName in topoJSONFeatures) {
|
||||||
if (topoJSONFeatures[i].type === 'GeometryCollection') {
|
if (this.layers_ && this.layers_.indexOf(objectName) == -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
|
||||||
feature = /** @type {TopoJSONGeometryCollection} */
|
feature = /** @type {TopoJSONGeometryCollection} */
|
||||||
(topoJSONFeatures[i]);
|
(topoJSONFeatures[objectName]);
|
||||||
features.push.apply(features,
|
features.push.apply(features,
|
||||||
ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
|
ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
|
||||||
feature, arcs, scale, translate, opt_options));
|
feature, arcs, scale, translate, property, objectName, opt_options));
|
||||||
} else {
|
} else {
|
||||||
feature = /** @type {TopoJSONGeometry} */
|
feature = /** @type {TopoJSONGeometry} */
|
||||||
(topoJSONFeatures[i]);
|
(topoJSONFeatures[objectName]);
|
||||||
features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
|
features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
|
||||||
feature, arcs, scale, translate, opt_options));
|
feature, arcs, scale, translate, property, objectName, opt_options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return features;
|
return features;
|
||||||
|
|||||||
@@ -47,15 +47,15 @@ ol.format.WFS = function(opt_options) {
|
|||||||
* @type {ol.format.GMLBase}
|
* @type {ol.format.GMLBase}
|
||||||
*/
|
*/
|
||||||
this.gmlFormat_ = options.gmlFormat ?
|
this.gmlFormat_ = options.gmlFormat ?
|
||||||
options.gmlFormat : new ol.format.GML3();
|
options.gmlFormat : new ol.format.GML3();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.schemaLocation_ = options.schemaLocation ?
|
this.schemaLocation_ = options.schemaLocation ?
|
||||||
options.schemaLocation :
|
options.schemaLocation :
|
||||||
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
|
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
|
||||||
|
|
||||||
ol.format.XMLFeature.call(this);
|
ol.format.XMLFeature.call(this);
|
||||||
};
|
};
|
||||||
@@ -90,6 +90,13 @@ ol.format.WFS.OGCNS = 'http://www.opengis.net/ogc';
|
|||||||
ol.format.WFS.WFSNS = 'http://www.opengis.net/wfs';
|
ol.format.WFS.WFSNS = 'http://www.opengis.net/wfs';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
ol.format.WFS.FESNS = 'http://www.opengis.net/fes';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {Object.<string, string>}
|
* @type {Object.<string, string>}
|
||||||
@@ -407,7 +414,7 @@ ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WFS.getTypeName_ = function(featurePrefix, featureType) {
|
ol.format.WFS.getTypeName_ = function(featurePrefix, featureType) {
|
||||||
featurePrefix = featurePrefix ? featurePrefix :
|
featurePrefix = featurePrefix ? featurePrefix :
|
||||||
ol.format.WFS.FEATURE_PREFIX;
|
ol.format.WFS.FEATURE_PREFIX;
|
||||||
var prefix = featurePrefix + ':';
|
var prefix = featurePrefix + ':';
|
||||||
// The featureType already contains the prefix.
|
// The featureType already contains the prefix.
|
||||||
if (featureType.indexOf(prefix) === 0) {
|
if (featureType.indexOf(prefix) === 0) {
|
||||||
@@ -470,9 +477,9 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
|
|||||||
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
|
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
|
||||||
{'gmlVersion': context['gmlVersion'], node: node,
|
{'gmlVersion': context['gmlVersion'], node: node,
|
||||||
'hasZ': context['hasZ'], 'srsName': context['srsName']}),
|
'hasZ': context['hasZ'], 'srsName': context['srsName']}),
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
ol.xml.makeSimpleNodeFactory('Property'), values,
|
ol.xml.makeSimpleNodeFactory('Property'), values,
|
||||||
objectStack);
|
objectStack);
|
||||||
ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack);
|
ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -646,6 +653,32 @@ ol.format.WFS.writeWithinFilter_ = function(node, filter, objectStack) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Node} node Node.
|
||||||
|
* @param {ol.format.filter.During} filter Filter.
|
||||||
|
* @param {Array.<*>} objectStack Node stack.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.format.WFS.writeDuringFilter_ = function(node, filter, objectStack) {
|
||||||
|
|
||||||
|
var valueReference = ol.xml.createElementNS(ol.format.WFS.FESNS, 'ValueReference');
|
||||||
|
ol.format.XSD.writeStringTextNode(valueReference, filter.propertyName);
|
||||||
|
node.appendChild(valueReference);
|
||||||
|
|
||||||
|
var timePeriod = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'TimePeriod');
|
||||||
|
|
||||||
|
node.appendChild(timePeriod);
|
||||||
|
|
||||||
|
var begin = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'begin');
|
||||||
|
timePeriod.appendChild(begin);
|
||||||
|
ol.format.WFS.writeTimeInstant_(begin, filter.begin);
|
||||||
|
|
||||||
|
var end = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'end');
|
||||||
|
timePeriod.appendChild(end);
|
||||||
|
ol.format.WFS.writeTimeInstant_(end, filter.end);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node Node.
|
* @param {Node} node Node.
|
||||||
* @param {ol.format.filter.LogicalNary} filter Filter.
|
* @param {ol.format.filter.LogicalNary} filter Filter.
|
||||||
@@ -777,6 +810,21 @@ ol.format.WFS.writeOgcLiteral_ = function(node, value) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Node} node Node.
|
||||||
|
* @param {string} time PropertyName value.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.format.WFS.writeTimeInstant_ = function(node, time) {
|
||||||
|
var timeInstant = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'TimeInstant');
|
||||||
|
node.appendChild(timeInstant);
|
||||||
|
|
||||||
|
var timePosition = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'timePosition');
|
||||||
|
timeInstant.appendChild(timePosition);
|
||||||
|
ol.format.XSD.writeStringTextNode(timePosition, time);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||||
* @private
|
* @private
|
||||||
@@ -786,6 +834,7 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
|
|||||||
'Query': ol.xml.makeChildAppender(ol.format.WFS.writeQuery_)
|
'Query': ol.xml.makeChildAppender(ol.format.WFS.writeQuery_)
|
||||||
},
|
},
|
||||||
'http://www.opengis.net/ogc': {
|
'http://www.opengis.net/ogc': {
|
||||||
|
'During': ol.xml.makeChildAppender(ol.format.WFS.writeDuringFilter_),
|
||||||
'And': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
|
'And': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
|
||||||
'Or': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
|
'Or': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
|
||||||
'Not': ol.xml.makeChildAppender(ol.format.WFS.writeNotFilter_),
|
'Not': ol.xml.makeChildAppender(ol.format.WFS.writeNotFilter_),
|
||||||
@@ -915,7 +964,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
var objectStack = [];
|
var objectStack = [];
|
||||||
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction');
|
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction');
|
||||||
var version = options.version ?
|
var version = options.version ?
|
||||||
options.version : ol.format.WFS.DEFAULT_VERSION;
|
options.version : ol.format.WFS.DEFAULT_VERSION;
|
||||||
var gmlVersion = version === '1.0.0' ? 2 : 3;
|
var gmlVersion = version === '1.0.0' ? 2 : 3;
|
||||||
node.setAttribute('service', 'WFS');
|
node.setAttribute('service', 'WFS');
|
||||||
node.setAttribute('version', version);
|
node.setAttribute('version', version);
|
||||||
@@ -931,9 +980,10 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
var schemaLocation = ol.format.WFS.SCHEMA_LOCATIONS[version];
|
var schemaLocation = ol.format.WFS.SCHEMA_LOCATIONS[version];
|
||||||
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
'xsi:schemaLocation', schemaLocation);
|
'xsi:schemaLocation', schemaLocation);
|
||||||
|
var featurePrefix = options.featurePrefix ? options.featurePrefix : ol.format.WFS.FEATURE_PREFIX;
|
||||||
if (inserts) {
|
if (inserts) {
|
||||||
obj = {node: node, 'featureNS': options.featureNS,
|
obj = {node: node, 'featureNS': options.featureNS,
|
||||||
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||||
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
||||||
ol.obj.assign(obj, baseObj);
|
ol.obj.assign(obj, baseObj);
|
||||||
ol.xml.pushSerializeAndPop(obj,
|
ol.xml.pushSerializeAndPop(obj,
|
||||||
@@ -943,7 +993,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
}
|
}
|
||||||
if (updates) {
|
if (updates) {
|
||||||
obj = {node: node, 'featureNS': options.featureNS,
|
obj = {node: node, 'featureNS': options.featureNS,
|
||||||
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||||
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
||||||
ol.obj.assign(obj, baseObj);
|
ol.obj.assign(obj, baseObj);
|
||||||
ol.xml.pushSerializeAndPop(obj,
|
ol.xml.pushSerializeAndPop(obj,
|
||||||
@@ -953,7 +1003,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
}
|
}
|
||||||
if (deletes) {
|
if (deletes) {
|
||||||
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
||||||
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||||
'gmlVersion': gmlVersion, 'srsName': options.srsName},
|
'gmlVersion': gmlVersion, 'srsName': options.srsName},
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
ol.xml.makeSimpleNodeFactory('Delete'), deletes,
|
ol.xml.makeSimpleNodeFactory('Delete'), deletes,
|
||||||
@@ -961,7 +1011,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
}
|
}
|
||||||
if (options.nativeElements) {
|
if (options.nativeElements) {
|
||||||
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
||||||
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
|
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||||
'gmlVersion': gmlVersion, 'srsName': options.srsName},
|
'gmlVersion': gmlVersion, 'srsName': options.srsName},
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
ol.xml.makeSimpleNodeFactory('Native'), options.nativeElements,
|
ol.xml.makeSimpleNodeFactory('Native'), options.nativeElements,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ ol.format.WKT = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.splitCollection_ = options.splitCollection !== undefined ?
|
this.splitCollection_ = options.splitCollection !== undefined ?
|
||||||
options.splitCollection : false;
|
options.splitCollection : false;
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.format.WKT, ol.format.TextFeature);
|
ol.inherits(ol.format.WKT, ol.format.TextFeature);
|
||||||
@@ -330,7 +330,7 @@ ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
|
|||||||
var geometry = this.parse_(text);
|
var geometry = this.parse_(text);
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, false, opt_options));
|
ol.format.Feature.transformWithOptions(geometry, false, opt_options));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -405,7 +405,7 @@ ol.format.WKT.prototype.writeGeometry;
|
|||||||
*/
|
*/
|
||||||
ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
|
ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
|
||||||
return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ (
|
return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
|
ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -535,7 +535,7 @@ ol.format.WKT.Lexer.prototype.readNumber_ = function() {
|
|||||||
}
|
}
|
||||||
c = this.nextChar_();
|
c = this.nextChar_();
|
||||||
} while (
|
} while (
|
||||||
this.isNumeric_(c, decimal) ||
|
this.isNumeric_(c, decimal) ||
|
||||||
// if we haven't detected a scientific number before, 'e' or 'E'
|
// if we haven't detected a scientific number before, 'e' or 'E'
|
||||||
// hint that we should continue to read
|
// hint that we should continue to read
|
||||||
!scientificNotation && (c == 'e' || c == 'E') ||
|
!scientificNotation && (c == 'e' || c == 'E') ||
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -110,9 +110,9 @@ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
|
||||||
var geographicBoundingBox = ol.xml.pushParseAndPop(
|
var geographicBoundingBox = ol.xml.pushParseAndPop(
|
||||||
{},
|
{},
|
||||||
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
|
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
|
||||||
node, objectStack);
|
node, objectStack);
|
||||||
if (!geographicBoundingBox) {
|
if (!geographicBoundingBox) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -167,8 +167,8 @@ ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
|
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
|
||||||
node, objectStack);
|
node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -180,8 +180,8 @@ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack)
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
|
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
|
||||||
node, objectStack);
|
node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -193,8 +193,8 @@ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
|
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
|
||||||
node, objectStack);
|
node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
|
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
|
|||||||
(objectStack[objectStack.length - 1]);
|
(objectStack[objectStack.length - 1]);
|
||||||
|
|
||||||
var layerObject = ol.xml.pushParseAndPop(
|
var layerObject = ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||||
|
|
||||||
if (!layerObject) {
|
if (!layerObject) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -246,7 +246,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
|
|||||||
layerObject['queryable'] = queryable !== undefined ? queryable : false;
|
layerObject['queryable'] = queryable !== undefined ? queryable : false;
|
||||||
|
|
||||||
var cascaded = ol.format.XSD.readNonNegativeIntegerString(
|
var cascaded = ol.format.XSD.readNonNegativeIntegerString(
|
||||||
node.getAttribute('cascaded'));
|
node.getAttribute('cascaded'));
|
||||||
if (cascaded === undefined) {
|
if (cascaded === undefined) {
|
||||||
cascaded = parentLayerObject['cascaded'];
|
cascaded = parentLayerObject['cascaded'];
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
|
|||||||
}
|
}
|
||||||
layerObject['fixedHeight'] = fixedHeight;
|
layerObject['fixedHeight'] = fixedHeight;
|
||||||
|
|
||||||
// See 7.2.4.8
|
// See 7.2.4.8
|
||||||
var addKeys = ['Style', 'CRS', 'AuthorityURL'];
|
var addKeys = ['Style', 'CRS', 'AuthorityURL'];
|
||||||
addKeys.forEach(function(key) {
|
addKeys.forEach(function(key) {
|
||||||
if (key in parentLayerObject) {
|
if (key in parentLayerObject) {
|
||||||
@@ -314,9 +314,9 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
|
|||||||
'unitSymbol': node.getAttribute('unitSymbol'),
|
'unitSymbol': node.getAttribute('unitSymbol'),
|
||||||
'default': node.getAttribute('default'),
|
'default': node.getAttribute('default'),
|
||||||
'multipleValues': ol.format.XSD.readBooleanString(
|
'multipleValues': ol.format.XSD.readBooleanString(
|
||||||
node.getAttribute('multipleValues')),
|
node.getAttribute('multipleValues')),
|
||||||
'nearestValue': ol.format.XSD.readBooleanString(
|
'nearestValue': ol.format.XSD.readBooleanString(
|
||||||
node.getAttribute('nearestValue')),
|
node.getAttribute('nearestValue')),
|
||||||
'current': ol.format.XSD.readBooleanString(node.getAttribute('current')),
|
'current': ol.format.XSD.readBooleanString(node.getAttribute('current')),
|
||||||
'values': ol.format.XSD.readString(node)
|
'values': ol.format.XSD.readString(node)
|
||||||
};
|
};
|
||||||
@@ -332,8 +332,8 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
|
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
|
||||||
node, objectStack);
|
node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
|
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
|
ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(
|
||||||
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
|
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
|
|||||||
}
|
}
|
||||||
WMTSCapabilityObject['version'] = version;
|
WMTSCapabilityObject['version'] = version;
|
||||||
WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject,
|
WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject,
|
||||||
ol.format.WMTSCapabilities.PARSERS_, node, []);
|
ol.format.WMTSCapabilities.PARSERS_, node, []);
|
||||||
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
|
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
|
ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop({},
|
return ol.xml.pushParseAndPop({},
|
||||||
ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
|
ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {
|
ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop({},
|
return ol.xml.pushParseAndPop({},
|
||||||
ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
|
ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
goog.provide('ol.Geolocation');
|
goog.provide('ol.Geolocation');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Object');
|
|
||||||
goog.require('ol.GeolocationProperty');
|
goog.require('ol.GeolocationProperty');
|
||||||
|
goog.require('ol.Object');
|
||||||
|
goog.require('ol.Sphere');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.has');
|
goog.require('ol.has');
|
||||||
goog.require('ol.math');
|
goog.require('ol.math');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.sphere.WGS84');
|
goog.require('ol.proj.EPSG4326');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +60,12 @@ ol.Geolocation = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.transform_ = ol.proj.identityTransform;
|
this.transform_ = ol.proj.identityTransform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.Sphere}
|
||||||
|
*/
|
||||||
|
this.sphere_ = new ol.Sphere(ol.proj.EPSG4326.RADIUS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number|undefined}
|
* @type {number|undefined}
|
||||||
@@ -73,7 +80,7 @@ ol.Geolocation = function(opt_options) {
|
|||||||
this.handleTrackingChanged_, this);
|
this.handleTrackingChanged_, this);
|
||||||
|
|
||||||
if (options.projection !== undefined) {
|
if (options.projection !== undefined) {
|
||||||
this.setProjection(ol.proj.get(options.projection));
|
this.setProjection(options.projection);
|
||||||
}
|
}
|
||||||
if (options.trackingOptions !== undefined) {
|
if (options.trackingOptions !== undefined) {
|
||||||
this.setTrackingOptions(options.trackingOptions);
|
this.setTrackingOptions(options.trackingOptions);
|
||||||
@@ -140,9 +147,9 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
|||||||
coords.altitude === null ? undefined : coords.altitude);
|
coords.altitude === null ? undefined : coords.altitude);
|
||||||
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
|
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
|
||||||
coords.altitudeAccuracy === null ?
|
coords.altitudeAccuracy === null ?
|
||||||
undefined : coords.altitudeAccuracy);
|
undefined : coords.altitudeAccuracy);
|
||||||
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
|
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
|
||||||
undefined : ol.math.toRadians(coords.heading));
|
undefined : ol.math.toRadians(coords.heading));
|
||||||
if (!this.position_) {
|
if (!this.position_) {
|
||||||
this.position_ = [coords.longitude, coords.latitude];
|
this.position_ = [coords.longitude, coords.latitude];
|
||||||
} else {
|
} else {
|
||||||
@@ -154,7 +161,7 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
|||||||
this.set(ol.GeolocationProperty.SPEED,
|
this.set(ol.GeolocationProperty.SPEED,
|
||||||
coords.speed === null ? undefined : coords.speed);
|
coords.speed === null ? undefined : coords.speed);
|
||||||
var geometry = ol.geom.Polygon.circular(
|
var geometry = ol.geom.Polygon.circular(
|
||||||
ol.sphere.WGS84, this.position_, coords.accuracy);
|
this.sphere_, this.position_, coords.accuracy);
|
||||||
geometry.applyTransform(this.transform_);
|
geometry.applyTransform(this.transform_);
|
||||||
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
|
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
|
||||||
this.changed();
|
this.changed();
|
||||||
@@ -186,7 +193,7 @@ ol.Geolocation.prototype.positionError_ = function(error) {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getAccuracy = function() {
|
ol.Geolocation.prototype.getAccuracy = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.ACCURACY));
|
this.get(ol.GeolocationProperty.ACCURACY));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +205,7 @@ ol.Geolocation.prototype.getAccuracy = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getAccuracyGeometry = function() {
|
ol.Geolocation.prototype.getAccuracyGeometry = function() {
|
||||||
return /** @type {?ol.geom.Polygon} */ (
|
return /** @type {?ol.geom.Polygon} */ (
|
||||||
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
|
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -211,7 +218,7 @@ ol.Geolocation.prototype.getAccuracyGeometry = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getAltitude = function() {
|
ol.Geolocation.prototype.getAltitude = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.ALTITUDE));
|
this.get(ol.GeolocationProperty.ALTITUDE));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -224,7 +231,7 @@ ol.Geolocation.prototype.getAltitude = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getAltitudeAccuracy = function() {
|
ol.Geolocation.prototype.getAltitudeAccuracy = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
|
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -236,7 +243,7 @@ ol.Geolocation.prototype.getAltitudeAccuracy = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getHeading = function() {
|
ol.Geolocation.prototype.getHeading = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.HEADING));
|
this.get(ol.GeolocationProperty.HEADING));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -249,7 +256,7 @@ ol.Geolocation.prototype.getHeading = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getPosition = function() {
|
ol.Geolocation.prototype.getPosition = function() {
|
||||||
return /** @type {ol.Coordinate|undefined} */ (
|
return /** @type {ol.Coordinate|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.POSITION));
|
this.get(ol.GeolocationProperty.POSITION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -262,7 +269,7 @@ ol.Geolocation.prototype.getPosition = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getProjection = function() {
|
ol.Geolocation.prototype.getProjection = function() {
|
||||||
return /** @type {ol.proj.Projection|undefined} */ (
|
return /** @type {ol.proj.Projection|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.PROJECTION));
|
this.get(ol.GeolocationProperty.PROJECTION));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -275,7 +282,7 @@ ol.Geolocation.prototype.getProjection = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getSpeed = function() {
|
ol.Geolocation.prototype.getSpeed = function() {
|
||||||
return /** @type {number|undefined} */ (
|
return /** @type {number|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.SPEED));
|
this.get(ol.GeolocationProperty.SPEED));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -287,7 +294,7 @@ ol.Geolocation.prototype.getSpeed = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getTracking = function() {
|
ol.Geolocation.prototype.getTracking = function() {
|
||||||
return /** @type {boolean} */ (
|
return /** @type {boolean} */ (
|
||||||
this.get(ol.GeolocationProperty.TRACKING));
|
this.get(ol.GeolocationProperty.TRACKING));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -302,19 +309,19 @@ ol.Geolocation.prototype.getTracking = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.getTrackingOptions = function() {
|
ol.Geolocation.prototype.getTrackingOptions = function() {
|
||||||
return /** @type {GeolocationPositionOptions|undefined} */ (
|
return /** @type {GeolocationPositionOptions|undefined} */ (
|
||||||
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
|
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the projection to use for transforming the coordinates.
|
* Set the projection to use for transforming the coordinates.
|
||||||
* @param {ol.proj.Projection} projection The projection the position is
|
* @param {ol.ProjectionLike} projection The projection the position is
|
||||||
* reported in.
|
* reported in.
|
||||||
* @observable
|
* @observable
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.setProjection = function(projection) {
|
ol.Geolocation.prototype.setProjection = function(projection) {
|
||||||
this.set(ol.GeolocationProperty.PROJECTION, projection);
|
this.set(ol.GeolocationProperty.PROJECTION, ol.proj.get(projection));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ ol.geom.flat.geodesic.greatCircleArc = function(
|
|||||||
var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
|
var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
|
||||||
var lon = ol.math.toRadians(lon1) +
|
var lon = ol.math.toRadians(lon1) +
|
||||||
Math.atan2(Math.sin(theta) * sinD * cosLat1,
|
Math.atan2(Math.sin(theta) * sinD * cosLat1,
|
||||||
cosD - sinLat1 * Math.sin(lat));
|
cosD - sinLat1 * Math.sin(lat));
|
||||||
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
|
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
|
||||||
}, ol.proj.getTransform(geoProjection, projection), squaredTolerance);
|
}, ol.proj.getTransform(geoProjection, projection), squaredTolerance);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends,
|
|||||||
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
|
||||||
flatCoordinates, offset, end, stride);
|
flatCoordinates, offset, end, stride);
|
||||||
var reverse = i === 0 ?
|
var reverse = i === 0 ?
|
||||||
(right && isClockwise) || (!right && !isClockwise) :
|
(right && isClockwise) || (!right && !isClockwise) :
|
||||||
(right && !isClockwise) || (!right && isClockwise);
|
(right && !isClockwise) || (!right && isClockwise);
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
|
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ goog.require('ol.math');
|
|||||||
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
|
||||||
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
|
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
|
||||||
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
|
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
|
||||||
opt_simplifiedFlatCoordinates : [];
|
opt_simplifiedFlatCoordinates : [];
|
||||||
if (!highQuality) {
|
if (!highQuality) {
|
||||||
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
|
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
|
||||||
stride, squaredTolerance,
|
stride, squaredTolerance,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
|
|||||||
*/
|
*/
|
||||||
ol.geom.MultiPoint.prototype.getPoint = function(index) {
|
ol.geom.MultiPoint.prototype.getPoint = function(index) {
|
||||||
var n = !this.flatCoordinates ?
|
var n = !this.flatCoordinates ?
|
||||||
0 : this.flatCoordinates.length / this.stride;
|
0 : this.flatCoordinates.length / this.stride;
|
||||||
if (index < 0 || n <= index) {
|
if (index < 0 || n <= index) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ ol.geom.MultiPolygon.prototype.setCoordinates = function(coordinates, opt_layout
|
|||||||
} else {
|
} else {
|
||||||
var lastEnds = endss[endss.length - 1];
|
var lastEnds = endss[endss.length - 1];
|
||||||
this.flatCoordinates.length = lastEnds.length === 0 ?
|
this.flatCoordinates.length = lastEnds.length === 0 ?
|
||||||
0 : lastEnds[lastEnds.length - 1];
|
0 : lastEnds[lastEnds.length - 1];
|
||||||
}
|
}
|
||||||
this.changed();
|
this.changed();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,89 +23,89 @@ goog.require('ol.style.Text');
|
|||||||
ol.Graticule = function(opt_options) {
|
ol.Graticule = function(opt_options) {
|
||||||
var options = opt_options || {};
|
var options = opt_options || {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.Map}
|
* @type {ol.Map}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.map_ = null;
|
this.map_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.proj.Projection}
|
* @type {ol.proj.Projection}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.projection_ = null;
|
this.projection_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.maxLat_ = Infinity;
|
this.maxLat_ = Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.maxLon_ = Infinity;
|
this.maxLon_ = Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.minLat_ = -Infinity;
|
this.minLat_ = -Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.minLon_ = -Infinity;
|
this.minLon_ = -Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.maxLatP_ = Infinity;
|
this.maxLatP_ = Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.maxLonP_ = Infinity;
|
this.maxLonP_ = Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.minLatP_ = -Infinity;
|
this.minLatP_ = -Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.minLonP_ = -Infinity;
|
this.minLonP_ = -Infinity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.targetSize_ = options.targetSize !== undefined ?
|
this.targetSize_ = options.targetSize !== undefined ?
|
||||||
options.targetSize : 100;
|
options.targetSize : 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
|
this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array.<ol.geom.LineString>}
|
* @type {Array.<ol.geom.LineString>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.meridians_ = [];
|
this.meridians_ = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array.<ol.geom.LineString>}
|
* @type {Array.<ol.geom.LineString>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.parallels_ = [];
|
this.parallels_ = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,7 +113,7 @@ ol.Graticule = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.strokeStyle_ = options.strokeStyle !== undefined ?
|
this.strokeStyle_ = options.strokeStyle !== undefined ?
|
||||||
options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_;
|
options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.TransformFunction|undefined}
|
* @type {ol.TransformFunction|undefined}
|
||||||
@@ -153,14 +153,14 @@ ol.Graticule = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ?
|
this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ?
|
||||||
degreesToString.bind(this, 'EW') : options.lonLabelFormatter;
|
degreesToString.bind(this, 'EW') : options.lonLabelFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {function(number):string}
|
* @type {function(number):string}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.latLabelFormatter_ = options.latLabelFormatter == undefined ?
|
this.latLabelFormatter_ = options.latLabelFormatter == undefined ?
|
||||||
degreesToString.bind(this, 'NS') : options.latLabelFormatter;
|
degreesToString.bind(this, 'NS') : options.latLabelFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Longitude label position in fractions (0..1) of view extent. 0 means
|
* Longitude label position in fractions (0..1) of view extent. 0 means
|
||||||
@@ -169,7 +169,7 @@ ol.Graticule = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 :
|
this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 :
|
||||||
options.lonLabelPosition;
|
options.lonLabelPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Latitude Label position in fractions (0..1) of view extent. 0 means left, 1
|
* Latitude Label position in fractions (0..1) of view extent. 0 means left, 1
|
||||||
@@ -178,41 +178,41 @@ ol.Graticule = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 :
|
this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 :
|
||||||
options.latLabelPosition;
|
options.latLabelPosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.style.Text}
|
* @type {ol.style.Text}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle :
|
this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle :
|
||||||
new ol.style.Text({
|
new ol.style.Text({
|
||||||
font: '12px Calibri,sans-serif',
|
font: '12px Calibri,sans-serif',
|
||||||
textBaseline: 'bottom',
|
textBaseline: 'bottom',
|
||||||
fill: new ol.style.Fill({
|
fill: new ol.style.Fill({
|
||||||
color: 'rgba(0,0,0,1)'
|
color: 'rgba(0,0,0,1)'
|
||||||
}),
|
}),
|
||||||
stroke: new ol.style.Stroke({
|
stroke: new ol.style.Stroke({
|
||||||
color: 'rgba(255,255,255,1)',
|
color: 'rgba(255,255,255,1)',
|
||||||
width: 3
|
width: 3
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.style.Text}
|
* @type {ol.style.Text}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle :
|
this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle :
|
||||||
new ol.style.Text({
|
new ol.style.Text({
|
||||||
font: '12px Calibri,sans-serif',
|
font: '12px Calibri,sans-serif',
|
||||||
textAlign: 'end',
|
textAlign: 'end',
|
||||||
fill: new ol.style.Fill({
|
fill: new ol.style.Fill({
|
||||||
color: 'rgba(0,0,0,1)'
|
color: 'rgba(0,0,0,1)'
|
||||||
}),
|
}),
|
||||||
stroke: new ol.style.Stroke({
|
stroke: new ol.style.Stroke({
|
||||||
color: 'rgba(255,255,255,1)',
|
color: 'rgba(255,255,255,1)',
|
||||||
width: 3
|
width: 3
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
this.meridiansLabels_ = [];
|
this.meridiansLabels_ = [];
|
||||||
this.parallelsLabels_ = [];
|
this.parallelsLabels_ = [];
|
||||||
@@ -283,7 +283,7 @@ ol.Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
|
|||||||
clampedBottom, clampedTop);
|
clampedBottom, clampedTop);
|
||||||
var coordinate = [flatCoordinates[0], lat];
|
var coordinate = [flatCoordinates[0], lat];
|
||||||
var point = this.meridiansLabels_[index] !== undefined ?
|
var point = this.meridiansLabels_[index] !== undefined ?
|
||||||
this.meridiansLabels_[index].geom : new ol.geom.Point(null);
|
this.meridiansLabels_[index].geom : new ol.geom.Point(null);
|
||||||
point.setCoordinates(coordinate);
|
point.setCoordinates(coordinate);
|
||||||
return point;
|
return point;
|
||||||
};
|
};
|
||||||
@@ -332,7 +332,7 @@ ol.Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) {
|
|||||||
clampedLeft, clampedRight);
|
clampedLeft, clampedRight);
|
||||||
var coordinate = [lon, flatCoordinates[1]];
|
var coordinate = [lon, flatCoordinates[1]];
|
||||||
var point = this.parallelsLabels_[index] !== undefined ?
|
var point = this.parallelsLabels_[index] !== undefined ?
|
||||||
this.parallelsLabels_[index].geom : new ol.geom.Point(null);
|
this.parallelsLabels_[index].geom : new ol.geom.Point(null);
|
||||||
point.setCoordinates(coordinate);
|
point.setCoordinates(coordinate);
|
||||||
return point;
|
return point;
|
||||||
};
|
};
|
||||||
@@ -487,11 +487,11 @@ ol.Graticule.prototype.getMap = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
|
ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
|
||||||
squaredTolerance, index) {
|
squaredTolerance, index) {
|
||||||
var flatCoordinates = ol.geom.flat.geodesic.meridian(lon,
|
var flatCoordinates = ol.geom.flat.geodesic.meridian(lon,
|
||||||
minLat, maxLat, this.projection_, squaredTolerance);
|
minLat, maxLat, this.projection_, squaredTolerance);
|
||||||
var lineString = this.meridians_[index] !== undefined ?
|
var lineString = this.meridians_[index] !== undefined ?
|
||||||
this.meridians_[index] : new ol.geom.LineString(null);
|
this.meridians_[index] : new ol.geom.LineString(null);
|
||||||
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
|
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
|
||||||
return lineString;
|
return lineString;
|
||||||
};
|
};
|
||||||
@@ -517,18 +517,18 @@ ol.Graticule.prototype.getMeridians = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
|
ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
|
||||||
squaredTolerance, index) {
|
squaredTolerance, index) {
|
||||||
var flatCoordinates = ol.geom.flat.geodesic.parallel(lat,
|
var flatCoordinates = ol.geom.flat.geodesic.parallel(lat,
|
||||||
this.minLon_, this.maxLon_, this.projection_, squaredTolerance);
|
this.minLon_, this.maxLon_, this.projection_, squaredTolerance);
|
||||||
var lineString = this.parallels_[index] !== undefined ?
|
var lineString = this.parallels_[index] !== undefined ?
|
||||||
this.parallels_[index] : new ol.geom.LineString(null);
|
this.parallels_[index] : new ol.geom.LineString(null);
|
||||||
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
|
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
|
||||||
return lineString;
|
return lineString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of parallels. Pallels are lines of equal latitude.
|
* Get the list of parallels. Parallels are lines of equal latitude.
|
||||||
* @return {Array.<ol.geom.LineString>} The parallels.
|
* @return {Array.<ol.geom.LineString>} The parallels.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -620,7 +620,7 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
|||||||
var extent = projection.getExtent();
|
var extent = projection.getExtent();
|
||||||
var worldExtent = projection.getWorldExtent();
|
var worldExtent = projection.getWorldExtent();
|
||||||
var worldExtentP = ol.proj.transformExtent(worldExtent,
|
var worldExtentP = ol.proj.transformExtent(worldExtent,
|
||||||
epsg4326Projection, projection);
|
epsg4326Projection, projection);
|
||||||
|
|
||||||
var maxLat = worldExtent[3];
|
var maxLat = worldExtent[3];
|
||||||
var maxLon = worldExtent[2];
|
var maxLon = worldExtent[2];
|
||||||
@@ -644,13 +644,13 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
|||||||
|
|
||||||
|
|
||||||
this.fromLonLatTransform_ = ol.proj.getTransform(
|
this.fromLonLatTransform_ = ol.proj.getTransform(
|
||||||
epsg4326Projection, projection);
|
epsg4326Projection, projection);
|
||||||
|
|
||||||
this.toLonLatTransform_ = ol.proj.getTransform(
|
this.toLonLatTransform_ = ol.proj.getTransform(
|
||||||
projection, epsg4326Projection);
|
projection, epsg4326Projection);
|
||||||
|
|
||||||
this.projectionCenterLonLat_ = this.toLonLatTransform_(
|
this.projectionCenterLonLat_ = this.toLonLatTransform_(
|
||||||
ol.extent.getCenter(extent));
|
ol.extent.getCenter(extent));
|
||||||
|
|
||||||
this.projection_ = projection;
|
this.projection_ = projection;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ goog.require('ol');
|
|||||||
goog.require('ol.webgl');
|
goog.require('ol.webgl');
|
||||||
|
|
||||||
var ua = typeof navigator !== 'undefined' ?
|
var ua = typeof navigator !== 'undefined' ?
|
||||||
navigator.userAgent.toLowerCase() : '';
|
navigator.userAgent.toLowerCase() : '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User agent string says we are dealing with Firefox as browser.
|
* User agent string says we are dealing with Firefox as browser.
|
||||||
@@ -56,27 +56,27 @@ ol.has.CANVAS_LINE_DASH = false;
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.has.CANVAS = ol.ENABLE_CANVAS && (
|
ol.has.CANVAS = ol.ENABLE_CANVAS && (
|
||||||
/**
|
/**
|
||||||
* @return {boolean} Canvas supported.
|
* @return {boolean} Canvas supported.
|
||||||
*/
|
*/
|
||||||
function() {
|
function() {
|
||||||
if (!('HTMLCanvasElement' in window)) {
|
if (!('HTMLCanvasElement' in window)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var context = document.createElement('CANVAS').getContext('2d');
|
||||||
|
if (!context) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
try {
|
if (context.setLineDash !== undefined) {
|
||||||
var context = document.createElement('CANVAS').getContext('2d');
|
ol.has.CANVAS_LINE_DASH = true;
|
||||||
if (!context) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
if (context.setLineDash !== undefined) {
|
|
||||||
ol.has.CANVAS_LINE_DASH = true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
})();
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,7 +148,7 @@ ol.has.WEBGL;
|
|||||||
if (gl) {
|
if (gl) {
|
||||||
hasWebGL = true;
|
hasWebGL = true;
|
||||||
textureSize = /** @type {number} */
|
textureSize = /** @type {number} */
|
||||||
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
|
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
|
||||||
extensions = gl.getSupportedExtensions();
|
extensions = gl.getSupportedExtensions();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
|
|||||||
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
this.loader_ = opt_loader !== undefined ? opt_loader : null;
|
||||||
|
|
||||||
var state = opt_loader !== undefined ?
|
var state = opt_loader !== undefined ?
|
||||||
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||||
|
|
||||||
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);
|
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ goog.provide('ol.ImageTile');
|
|||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileState');
|
goog.require('ol.TileState');
|
||||||
|
goog.require('ol.dom');
|
||||||
goog.require('ol.events');
|
goog.require('ol.events');
|
||||||
goog.require('ol.events.EventType');
|
goog.require('ol.events.EventType');
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Image}
|
* @type {Image|HTMLCanvasElement}
|
||||||
*/
|
*/
|
||||||
this.image_ = new Image();
|
this.image_ = new Image();
|
||||||
if (crossOrigin !== null) {
|
if (crossOrigin !== null) {
|
||||||
@@ -59,6 +60,7 @@ ol.inherits(ol.ImageTile, ol.Tile);
|
|||||||
ol.ImageTile.prototype.disposeInternal = function() {
|
ol.ImageTile.prototype.disposeInternal = function() {
|
||||||
if (this.state == ol.TileState.LOADING) {
|
if (this.state == ol.TileState.LOADING) {
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
|
this.image_.src = ol.ImageTile.blankImage.toDataURL('image/png');
|
||||||
}
|
}
|
||||||
if (this.interimTile) {
|
if (this.interimTile) {
|
||||||
this.interimTile.dispose();
|
this.interimTile.dispose();
|
||||||
@@ -70,8 +72,8 @@ ol.ImageTile.prototype.disposeInternal = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the image element for this tile.
|
* Get the HTML image element for this tile (may be a Canvas, Image, or Video).
|
||||||
* @inheritDoc
|
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.ImageTile.prototype.getImage = function() {
|
ol.ImageTile.prototype.getImage = function() {
|
||||||
@@ -95,6 +97,7 @@ ol.ImageTile.prototype.getKey = function() {
|
|||||||
ol.ImageTile.prototype.handleImageError_ = function() {
|
ol.ImageTile.prototype.handleImageError_ = function() {
|
||||||
this.state = ol.TileState.ERROR;
|
this.state = ol.TileState.ERROR;
|
||||||
this.unlistenImage_();
|
this.unlistenImage_();
|
||||||
|
this.image_ = ol.ImageTile.blankImage;
|
||||||
this.changed();
|
this.changed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -143,3 +146,15 @@ ol.ImageTile.prototype.unlistenImage_ = function() {
|
|||||||
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||||
this.imageListenerKeys_ = null;
|
this.imageListenerKeys_ = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A blank image.
|
||||||
|
* @type {HTMLCanvasElement}
|
||||||
|
*/
|
||||||
|
ol.ImageTile.blankImage = (function() {
|
||||||
|
var ctx = ol.dom.createCanvasContext2D(1, 1);
|
||||||
|
ctx.fillStyle = 'rgba(0,0,0,0)';
|
||||||
|
ctx.fillRect(0, 0, 1, 1);
|
||||||
|
return ctx.canvas;
|
||||||
|
})();
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ ol.interaction.defaults = function(opt_options) {
|
|||||||
var kinetic = new ol.Kinetic(-0.005, 0.05, 100);
|
var kinetic = new ol.Kinetic(-0.005, 0.05, 100);
|
||||||
|
|
||||||
var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
|
var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
|
||||||
options.altShiftDragRotate : true;
|
options.altShiftDragRotate : true;
|
||||||
if (altShiftDragRotate) {
|
if (altShiftDragRotate) {
|
||||||
interactions.push(new ol.interaction.DragRotate());
|
interactions.push(new ol.interaction.DragRotate());
|
||||||
}
|
}
|
||||||
|
|
||||||
var doubleClickZoom = options.doubleClickZoom !== undefined ?
|
var doubleClickZoom = options.doubleClickZoom !== undefined ?
|
||||||
options.doubleClickZoom : true;
|
options.doubleClickZoom : true;
|
||||||
if (doubleClickZoom) {
|
if (doubleClickZoom) {
|
||||||
interactions.push(new ol.interaction.DoubleClickZoom({
|
interactions.push(new ol.interaction.DoubleClickZoom({
|
||||||
delta: options.zoomDelta,
|
delta: options.zoomDelta,
|
||||||
@@ -67,7 +67,7 @@ ol.interaction.defaults = function(opt_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
|
var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
|
||||||
true;
|
true;
|
||||||
if (pinchRotate) {
|
if (pinchRotate) {
|
||||||
interactions.push(new ol.interaction.PinchRotate());
|
interactions.push(new ol.interaction.PinchRotate());
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ ol.interaction.defaults = function(opt_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var mouseWheelZoom = options.mouseWheelZoom !== undefined ?
|
var mouseWheelZoom = options.mouseWheelZoom !== undefined ?
|
||||||
options.mouseWheelZoom : true;
|
options.mouseWheelZoom : true;
|
||||||
if (mouseWheelZoom) {
|
if (mouseWheelZoom) {
|
||||||
interactions.push(new ol.interaction.MouseWheelZoom({
|
interactions.push(new ol.interaction.MouseWheelZoom({
|
||||||
constrainResolution: options.constrainResolution,
|
constrainResolution: options.constrainResolution,
|
||||||
@@ -99,7 +99,7 @@ ol.interaction.defaults = function(opt_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var shiftDragZoom = options.shiftDragZoom !== undefined ?
|
var shiftDragZoom = options.shiftDragZoom !== undefined ?
|
||||||
options.shiftDragZoom : true;
|
options.shiftDragZoom : true;
|
||||||
if (shiftDragZoom) {
|
if (shiftDragZoom) {
|
||||||
interactions.push(new ol.interaction.DragZoom({
|
interactions.push(new ol.interaction.DragZoom({
|
||||||
duration: options.zoomDuration
|
duration: options.zoomDuration
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ ol.interaction.DragAndDrop = function(opt_options) {
|
|||||||
* @type {Array.<function(new: ol.format.Feature)>}
|
* @type {Array.<function(new: ol.format.Feature)>}
|
||||||
*/
|
*/
|
||||||
this.formatConstructors_ = options.formatConstructors ?
|
this.formatConstructors_ = options.formatConstructors ?
|
||||||
options.formatConstructors : [];
|
options.formatConstructors : [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.proj.Projection}
|
* @type {ol.proj.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = options.projection ?
|
this.projection_ = options.projection ?
|
||||||
ol.proj.get(options.projection) : null;
|
ol.proj.get(options.projection) : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -141,14 +141,10 @@ ol.interaction.DragAndDrop.handleEvent = ol.functions.TRUE;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
ol.interaction.DragAndDrop.prototype.registerListeners_ = function() {
|
||||||
if (this.dropListenKeys_) {
|
var map = this.getMap();
|
||||||
this.dropListenKeys_.forEach(ol.events.unlistenByKey);
|
|
||||||
this.dropListenKeys_ = null;
|
|
||||||
}
|
|
||||||
ol.interaction.Interaction.prototype.setMap.call(this, map);
|
|
||||||
if (map) {
|
if (map) {
|
||||||
var dropArea = this.target ? this.target : map.getViewport();
|
var dropArea = this.target ? this.target : map.getViewport();
|
||||||
this.dropListenKeys_ = [
|
this.dropListenKeys_ = [
|
||||||
@@ -165,6 +161,31 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.interaction.DragAndDrop.prototype.setActive = function(active) {
|
||||||
|
ol.interaction.Interaction.prototype.setActive.call(this, active);
|
||||||
|
if (active) {
|
||||||
|
this.registerListeners_();
|
||||||
|
} else {
|
||||||
|
this.unregisterListeners_();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
||||||
|
this.unregisterListeners_();
|
||||||
|
ol.interaction.Interaction.prototype.setMap.call(this, map);
|
||||||
|
if (this.getActive()) {
|
||||||
|
this.registerListeners_();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ol.format.Feature} format Format.
|
* @param {ol.format.Feature} format Format.
|
||||||
* @param {string} text Text.
|
* @param {string} text Text.
|
||||||
@@ -181,6 +202,17 @@ ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text, o
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.interaction.DragAndDrop.prototype.unregisterListeners_ = function() {
|
||||||
|
if (this.dropListenKeys_) {
|
||||||
|
this.dropListenKeys_.forEach(ol.events.unlistenByKey);
|
||||||
|
this.dropListenKeys_ = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ ol.interaction.DragBox = function(opt_options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ?
|
||||||
options.condition : ol.events.condition.always;
|
options.condition : ol.events.condition.always;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.DragBoxEndConditionType}
|
* @type {ol.DragBoxEndConditionType}
|
||||||
*/
|
*/
|
||||||
this.boxEndCondition_ = options.boxEndCondition ?
|
this.boxEndCondition_ = options.boxEndCondition ?
|
||||||
options.boxEndCondition : ol.interaction.DragBox.defaultBoxEndCondition;
|
options.boxEndCondition : ol.interaction.DragBox.defaultBoxEndCondition;
|
||||||
};
|
};
|
||||||
ol.inherits(ol.interaction.DragBox, ol.interaction.Pointer);
|
ol.inherits(ol.interaction.DragBox, ol.interaction.Pointer);
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
||||||
|
|
||||||
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType_.BOXDRAG,
|
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType_.BOXDRAG,
|
||||||
mapBrowserEvent.coordinate, mapBrowserEvent));
|
mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ ol.interaction.DragPan = function(opt_options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ?
|
||||||
options.condition : ol.events.condition.noModifierKeys;
|
options.condition : ol.events.condition.noModifierKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
goog.provide('ol.interaction.DragRotate');
|
goog.provide('ol.interaction.DragRotate');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
|
goog.require('ol.RotationConstraint');
|
||||||
goog.require('ol.ViewHint');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
goog.require('ol.functions');
|
goog.require('ol.functions');
|
||||||
@@ -36,7 +37,7 @@ ol.interaction.DragRotate = function(opt_options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ?
|
||||||
options.condition : ol.events.condition.altShiftKeysOnly;
|
options.condition : ol.events.condition.altShiftKeysOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -64,13 +65,16 @@ ol.interaction.DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
|
var view = map.getView();
|
||||||
|
if (view.getConstraints().rotation === ol.RotationConstraint.disable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var size = map.getSize();
|
var size = map.getSize();
|
||||||
var offset = mapBrowserEvent.pixel;
|
var offset = mapBrowserEvent.pixel;
|
||||||
var theta =
|
var theta =
|
||||||
Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
|
Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
|
||||||
if (this.lastAngle_ !== undefined) {
|
if (this.lastAngle_ !== undefined) {
|
||||||
var delta = theta - this.lastAngle_;
|
var delta = theta - this.lastAngle_;
|
||||||
var view = map.getView();
|
|
||||||
var rotation = view.getRotation();
|
var rotation = view.getRotation();
|
||||||
ol.interaction.Interaction.rotateWithoutConstraints(
|
ol.interaction.Interaction.rotateWithoutConstraints(
|
||||||
view, rotation - delta);
|
view, rotation - delta);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
goog.provide('ol.interaction.DragRotateAndZoom');
|
goog.provide('ol.interaction.DragRotateAndZoom');
|
||||||
|
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
|
goog.require('ol.RotationConstraint');
|
||||||
goog.require('ol.ViewHint');
|
goog.require('ol.ViewHint');
|
||||||
goog.require('ol.events.condition');
|
goog.require('ol.events.condition');
|
||||||
goog.require('ol.interaction.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
@@ -37,7 +38,7 @@ ol.interaction.DragRotateAndZoom = function(opt_options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ?
|
||||||
options.condition : ol.events.condition.shiftKeyOnly;
|
options.condition : ol.events.condition.shiftKeyOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -85,7 +86,7 @@ ol.interaction.DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
var theta = Math.atan2(deltaY, deltaX);
|
var theta = Math.atan2(deltaY, deltaX);
|
||||||
var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||||
var view = map.getView();
|
var view = map.getView();
|
||||||
if (this.lastAngle_ !== undefined) {
|
if (view.getConstraints().rotation !== ol.RotationConstraint.disable && this.lastAngle_ !== undefined) {
|
||||||
var angleDelta = theta - this.lastAngle_;
|
var angleDelta = theta - this.lastAngle_;
|
||||||
ol.interaction.Interaction.rotateWithoutConstraints(
|
ol.interaction.Interaction.rotateWithoutConstraints(
|
||||||
view, view.getRotation() - angleDelta);
|
view, view.getRotation() - angleDelta);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ ol.interaction.DragZoom = function(opt_options) {
|
|||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
var condition = options.condition ?
|
var condition = options.condition ?
|
||||||
options.condition : ol.events.condition.shiftKeyOnly;
|
options.condition : ol.events.condition.shiftKeyOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ ol.interaction.Draw = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.minPoints_ = options.minPoints ?
|
this.minPoints_ = options.minPoints ?
|
||||||
options.minPoints :
|
options.minPoints :
|
||||||
(this.mode_ === ol.interaction.Draw.Mode_.POLYGON ? 3 : 2);
|
(this.mode_ === ol.interaction.Draw.Mode_.POLYGON ? 3 : 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of points that can be drawn before a polygon ring or line string
|
* The number of points that can be drawn before a polygon ring or line string
|
||||||
@@ -127,14 +127,14 @@ ol.interaction.Draw = function(options) {
|
|||||||
if (!geometryFunction) {
|
if (!geometryFunction) {
|
||||||
if (this.type_ === ol.geom.GeometryType.CIRCLE) {
|
if (this.type_ === ol.geom.GeometryType.CIRCLE) {
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
|
* @param {!Array.<ol.Coordinate>} coordinates
|
||||||
* The coordinates.
|
* The coordinates.
|
||||||
* @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry.
|
* @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry.
|
||||||
* @return {ol.geom.SimpleGeometry} A geometry.
|
* @return {ol.geom.SimpleGeometry} A geometry.
|
||||||
*/
|
*/
|
||||||
geometryFunction = function(coordinates, opt_geometry) {
|
geometryFunction = function(coordinates, opt_geometry) {
|
||||||
var circle = opt_geometry ? /** @type {ol.geom.Circle} */ (opt_geometry) :
|
var circle = opt_geometry ? /** @type {ol.geom.Circle} */ (opt_geometry) :
|
||||||
new ol.geom.Circle([NaN, NaN]);
|
new ol.geom.Circle([NaN, NaN]);
|
||||||
var squaredLength = ol.coordinate.squaredDistance(
|
var squaredLength = ol.coordinate.squaredDistance(
|
||||||
coordinates[0], coordinates[1]);
|
coordinates[0], coordinates[1]);
|
||||||
circle.setCenterAndRadius(coordinates[0], Math.sqrt(squaredLength));
|
circle.setCenterAndRadius(coordinates[0], Math.sqrt(squaredLength));
|
||||||
@@ -151,7 +151,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
Constructor = ol.geom.Polygon;
|
Constructor = ol.geom.Polygon;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
|
* @param {!Array.<ol.Coordinate>} coordinates
|
||||||
* The coordinates.
|
* The coordinates.
|
||||||
* @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry.
|
* @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry.
|
||||||
* @return {ol.geom.SimpleGeometry} A geometry.
|
* @return {ol.geom.SimpleGeometry} A geometry.
|
||||||
@@ -229,7 +229,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.squaredClickTolerance_ = options.clickTolerance ?
|
this.squaredClickTolerance_ = options.clickTolerance ?
|
||||||
options.clickTolerance * options.clickTolerance : 36;
|
options.clickTolerance * options.clickTolerance : 36;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw overlay where our sketch features are drawn.
|
* Draw overlay where our sketch features are drawn.
|
||||||
@@ -242,7 +242,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
wrapX: options.wrapX ? options.wrapX : false
|
wrapX: options.wrapX ? options.wrapX : false
|
||||||
}),
|
}),
|
||||||
style: options.style ? options.style :
|
style: options.style ? options.style :
|
||||||
ol.interaction.Draw.getDefaultStyleFunction()
|
ol.interaction.Draw.getDefaultStyleFunction()
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,7 +257,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ?
|
||||||
options.condition : ol.events.condition.noModifierKeys;
|
options.condition : ol.events.condition.noModifierKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -268,7 +268,7 @@ ol.interaction.Draw = function(options) {
|
|||||||
this.freehandCondition_ = ol.events.condition.always;
|
this.freehandCondition_ = ol.events.condition.always;
|
||||||
} else {
|
} else {
|
||||||
this.freehandCondition_ = options.freehandCondition ?
|
this.freehandCondition_ = options.freehandCondition ?
|
||||||
options.freehandCondition : ol.events.condition.shiftKeyOnly;
|
options.freehandCondition : ol.events.condition.shiftKeyOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
ol.events.listen(this,
|
ol.events.listen(this,
|
||||||
@@ -401,8 +401,8 @@ ol.interaction.Draw.prototype.handlePointerMove_ = function(event) {
|
|||||||
var dy = downPx[1] - clickPx[1];
|
var dy = downPx[1] - clickPx[1];
|
||||||
var squaredDistance = dx * dx + dy * dy;
|
var squaredDistance = dx * dx + dy * dy;
|
||||||
this.shouldHandle_ = this.freehand_ ?
|
this.shouldHandle_ = this.freehand_ ?
|
||||||
squaredDistance > this.squaredClickTolerance_ :
|
squaredDistance > this.squaredClickTolerance_ :
|
||||||
squaredDistance <= this.squaredClickTolerance_;
|
squaredDistance <= this.squaredClickTolerance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.finishCoordinate_) {
|
if (this.finishCoordinate_) {
|
||||||
@@ -529,9 +529,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
|||||||
}
|
}
|
||||||
last[0] = coordinate[0];
|
last[0] = coordinate[0];
|
||||||
last[1] = coordinate[1];
|
last[1] = coordinate[1];
|
||||||
this.geometryFunction_(
|
this.geometryFunction_(/** @type {!Array.<ol.Coordinate>} */ (this.sketchCoords_), geometry);
|
||||||
/** @type {!ol.Coordinate|!Array.<ol.Coordinate>|!Array.<Array.<ol.Coordinate>>} */ (this.sketchCoords_),
|
|
||||||
geometry);
|
|
||||||
if (this.sketchPoint_) {
|
if (this.sketchPoint_) {
|
||||||
var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry());
|
var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry());
|
||||||
sketchPointGeom.setCoordinates(coordinate);
|
sketchPointGeom.setCoordinates(coordinate);
|
||||||
@@ -769,23 +767,23 @@ ol.interaction.Draw.prototype.updateState_ = function() {
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) {
|
ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) {
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
|
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
|
||||||
* @param {ol.geom.SimpleGeometry=} opt_geometry
|
* @param {ol.geom.SimpleGeometry=} opt_geometry
|
||||||
* @return {ol.geom.SimpleGeometry}
|
* @return {ol.geom.SimpleGeometry}
|
||||||
*/
|
*/
|
||||||
function(coordinates, opt_geometry) {
|
function(coordinates, opt_geometry) {
|
||||||
var center = coordinates[0];
|
var center = coordinates[0];
|
||||||
var end = coordinates[1];
|
var end = coordinates[1];
|
||||||
var radius = Math.sqrt(
|
var radius = Math.sqrt(
|
||||||
ol.coordinate.squaredDistance(center, end));
|
ol.coordinate.squaredDistance(center, end));
|
||||||
var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
|
var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
|
||||||
ol.geom.Polygon.fromCircle(new ol.geom.Circle(center), opt_sides);
|
ol.geom.Polygon.fromCircle(new ol.geom.Circle(center), opt_sides);
|
||||||
var angle = opt_angle ? opt_angle :
|
var angle = opt_angle ? opt_angle :
|
||||||
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
|
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
|
||||||
ol.geom.Polygon.makeRegular(geometry, center, radius, angle);
|
ol.geom.Polygon.makeRegular(geometry, center, radius, angle);
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -800,7 +798,7 @@ ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) {
|
|||||||
ol.interaction.Draw.createBox = function() {
|
ol.interaction.Draw.createBox = function() {
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
|
* @param {Array.<ol.Coordinate>} coordinates
|
||||||
* @param {ol.geom.SimpleGeometry=} opt_geometry
|
* @param {ol.geom.SimpleGeometry=} opt_geometry
|
||||||
* @return {ol.geom.SimpleGeometry}
|
* @return {ol.geom.SimpleGeometry}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -183,13 +183,13 @@ ol.interaction.Extent.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
//snap to edge
|
//snap to edge
|
||||||
} else if (x !== null) {
|
} else if (x !== null) {
|
||||||
this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_(
|
this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_(
|
||||||
getOpposingPoint([x, extent[1]]),
|
getOpposingPoint([x, extent[1]]),
|
||||||
getOpposingPoint([x, extent[3]])
|
getOpposingPoint([x, extent[3]])
|
||||||
);
|
);
|
||||||
} else if (y !== null) {
|
} else if (y !== null) {
|
||||||
this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_(
|
this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_(
|
||||||
getOpposingPoint([extent[0], y]),
|
getOpposingPoint([extent[0], y]),
|
||||||
getOpposingPoint([extent[2], y])
|
getOpposingPoint([extent[2], y])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//no snap - new bbox
|
//no snap - new bbox
|
||||||
@@ -337,7 +337,7 @@ ol.interaction.Extent.prototype.snapToVertex_ = function(pixel, map) {
|
|||||||
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
||||||
if (this.snappedToVertex_) {
|
if (this.snappedToVertex_) {
|
||||||
vertex = squaredDist1 > squaredDist2 ?
|
vertex = squaredDist1 > squaredDist2 ?
|
||||||
closestSegment[1] : closestSegment[0];
|
closestSegment[1] : closestSegment[0];
|
||||||
}
|
}
|
||||||
return vertex;
|
return vertex;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ ol.inherits(ol.interaction.Interaction, ol.Object);
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Interaction.prototype.getActive = function() {
|
ol.interaction.Interaction.prototype.getActive = function() {
|
||||||
return /** @type {boolean} */ (
|
return /** @type {boolean} */ (
|
||||||
this.get(ol.interaction.Property.ACTIVE));
|
this.get(ol.interaction.Property.ACTIVE));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ ol.interaction.KeyboardPan = function(opt_options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition !== undefined ?
|
this.condition_ = options.condition !== undefined ?
|
||||||
options.condition : this.defaultCondition_;
|
options.condition : this.defaultCondition_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -61,7 +61,7 @@ ol.interaction.KeyboardPan = function(opt_options) {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.pixelDelta_ = options.pixelDelta !== undefined ?
|
this.pixelDelta_ = options.pixelDelta !== undefined ?
|
||||||
options.pixelDelta : 128;
|
options.pixelDelta : 128;
|
||||||
|
|
||||||
};
|
};
|
||||||
ol.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
ol.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ ol.interaction.KeyboardZoom = function(opt_options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ? options.condition :
|
this.condition_ = options.condition ? options.condition :
|
||||||
ol.events.condition.targetNotEditable;
|
ol.events.condition.targetNotEditable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ ol.interaction.Modify = function(options) {
|
|||||||
* @type {ol.EventsConditionType}
|
* @type {ol.EventsConditionType}
|
||||||
*/
|
*/
|
||||||
this.condition_ = options.condition ?
|
this.condition_ = options.condition ?
|
||||||
options.condition : ol.events.condition.primaryAction;
|
options.condition : ol.events.condition.primaryAction;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +65,14 @@ ol.interaction.Modify = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.deleteCondition_ = options.deleteCondition ?
|
this.deleteCondition_ = options.deleteCondition ?
|
||||||
options.deleteCondition : this.defaultDeleteCondition_;
|
options.deleteCondition : this.defaultDeleteCondition_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {ol.EventsConditionType}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.insertVertexCondition_ = options.insertVertexCondition ?
|
||||||
|
options.insertVertexCondition : ol.events.condition.always;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editing vertex.
|
* Editing vertex.
|
||||||
@@ -113,7 +120,7 @@ ol.interaction.Modify = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.pixelTolerance_ = options.pixelTolerance !== undefined ?
|
this.pixelTolerance_ = options.pixelTolerance !== undefined ?
|
||||||
options.pixelTolerance : 10;
|
options.pixelTolerance : 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -146,7 +153,7 @@ ol.interaction.Modify = function(options) {
|
|||||||
wrapX: !!options.wrapX
|
wrapX: !!options.wrapX
|
||||||
}),
|
}),
|
||||||
style: options.style ? options.style :
|
style: options.style ? options.style :
|
||||||
ol.interaction.Modify.getDefaultStyleFunction(),
|
ol.interaction.Modify.getDefaultStyleFunction(),
|
||||||
updateWhileAnimating: true,
|
updateWhileAnimating: true,
|
||||||
updateWhileInteracting: true
|
updateWhileInteracting: true
|
||||||
});
|
});
|
||||||
@@ -600,7 +607,7 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
|
|||||||
|
|
||||||
this.dragSegments_.push([segmentDataMatch, 1]);
|
this.dragSegments_.push([segmentDataMatch, 1]);
|
||||||
componentSegments[uid][1] = segmentDataMatch;
|
componentSegments[uid][1] = segmentDataMatch;
|
||||||
} else if (ol.getUid(segment) in this.vertexSegments_ &&
|
} else if (this.insertVertexCondition_(evt) && ol.getUid(segment) in this.vertexSegments_ &&
|
||||||
(!componentSegments[uid][0] && !componentSegments[uid][1])) {
|
(!componentSegments[uid][0] && !componentSegments[uid][1])) {
|
||||||
insertVertices.push([segmentDataMatch, vertex]);
|
insertVertices.push([segmentDataMatch, vertex]);
|
||||||
}
|
}
|
||||||
@@ -818,7 +825,7 @@ ol.interaction.Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
|||||||
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
||||||
if (this.snappedToVertex_) {
|
if (this.snappedToVertex_) {
|
||||||
vertex = squaredDist1 > squaredDist2 ?
|
vertex = squaredDist1 > squaredDist2 ?
|
||||||
closestSegment[1] : closestSegment[0];
|
closestSegment[1] : closestSegment[0];
|
||||||
}
|
}
|
||||||
this.createOrUpdateVertexFeature_(vertex);
|
this.createOrUpdateVertexFeature_(vertex);
|
||||||
var segment;
|
var segment;
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
|
|||||||
|
|
||||||
if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
|
if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
|
||||||
this.mode_ = Math.abs(delta) < 4 ?
|
this.mode_ = Math.abs(delta) < 4 ?
|
||||||
ol.interaction.MouseWheelZoom.Mode_.TRACKPAD :
|
ol.interaction.MouseWheelZoom.Mode_.TRACKPAD :
|
||||||
ol.interaction.MouseWheelZoom.Mode_.WHEEL;
|
ol.interaction.MouseWheelZoom.Mode_.WHEEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mode_ === ol.interaction.MouseWheelZoom.Mode_.TRACKPAD) {
|
if (this.mode_ === ol.interaction.MouseWheelZoom.Mode_.TRACKPAD) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user