Compare commits

..

1 Commits

Author SHA1 Message Date
Tim Schaub
aa7aee5ab3 4.0.0-beta.1 2017-02-06 16:23:06 -07:00
376 changed files with 4166 additions and 9962 deletions

View File

@@ -1,3 +1,2 @@
examples/Jugl.js examples/Jugl.js
examples/resources/ examples/resources/
build/package/**/*webgl*

View File

@@ -3,10 +3,7 @@ sudo: false
language: node_js language: node_js
node_js: node_js:
- "6.1" - "6"
addons:
firefox: "52.0"
cache: cache:
directories: directories:
@@ -20,7 +17,7 @@ before_install:
before_script: before_script:
- "rm src/ol/renderer/webgl/*shader.js" - "rm src/ol/renderer/webgl/*shader.js"
- "sh -e /etc/init.d/xvfb start" - "sh -e /etc/init.d/xvfb start"
- "npm ls || true" - "npm ls"
script: "make ci" script: "make ci"

View File

@@ -4,7 +4,7 @@ Thanks for your interest in contributing to OpenLayers.
## Asking Questions ## Asking Questions
Please ask questions about using the library on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers). Please ask questions about using the library on [stackoverflow using the tag 'openlayers-3'](http://stackoverflow.com/questions/tagged/openlayers-3).
When you want to get involved and discuss new features or changes, please use [the mailing list](https://groups.google.com/forum/#!forum/openlayers-dev). When you want to get involved and discuss new features or changes, please use [the mailing list](https://groups.google.com/forum/#!forum/openlayers-dev).

View File

@@ -86,7 +86,7 @@ check-deps:
done ;\ done ;\
.PHONY: ci .PHONY: ci
ci: lint build test test-rendering package compile-examples check-examples apidoc ci: lint build test test-rendering compile-examples check-examples apidoc
.PHONY: compile-examples .PHONY: compile-examples
compile-examples: build/compiled-examples/all.combined.js compile-examples: build/compiled-examples/all.combined.js
@@ -253,7 +253,7 @@ build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
build/timestamps/node-modules-timestamp build/timestamps/node-modules-timestamp
@mkdir -p $(@D) @mkdir -p $(@D)
@echo "Running eslint..." @echo "Running eslint..."
@./node_modules/.bin/eslint tasks test test_rendering src examples @./node_modules/.bin/eslint --quiet tasks test test_rendering src examples
@touch $@ @touch $@
build/timestamps/node-modules-timestamp: package.json build/timestamps/node-modules-timestamp: package.json
@@ -308,6 +308,4 @@ package:
@cp -r package build @cp -r package build
@cd ./src && cp -r ol/* ../build/package @cd ./src && cp -r ol/* ../build/package
@rm build/package/typedefs.js @rm build/package/typedefs.js
@cp css/ol.css build/package
./node_modules/.bin/jscodeshift --transform transforms/module.js build/package ./node_modules/.bin/jscodeshift --transform transforms/module.js build/package
npm run lint-package

View File

@@ -31,6 +31,6 @@ Please see our guide on [contributing](CONTRIBUTING.md) if you're interested in
## Community ## Community
- Need help? Find it on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers) - Need help? Find it on [stackoverflow using the tag 'openlayers-3'](http://stackoverflow.com/questions/tagged/openlayers-3)
- Follow [@openlayers](https://twitter.com/openlayers) on Twitter - Follow [@openlayers](https://twitter.com/openlayers) on Twitter
- Discuss with openlayers users on IRC in `#openlayers` at `chat.freenode` - Discuss with openlayers users on IRC in `#openlayers` at `chat.freenode`

View File

@@ -2,86 +2,10 @@
### 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
#### Adding duplicate layers to a map throws
Previously, you could do this:
```js
map.addLayer(layer);
map.addLayer(layer);
```
However, after adding a duplicate layer, things failed if you tried to remove that layer.
Now, `map.addLayer()` throws if you try adding a layer that has already been added to the map.
#### Simpler `constrainResolution` configuration
The `constrainResolution` configuration for `ol.interaction.PinchZoom` and `ol.interaction.MouseWheelZoom`
can now be set directly with an option in `ol.interaction.defaults`:
```js
ol.interaction.defaults({
constrainResolution: true
});
```
### v4.0.0
#### Simpler `ol.source.Zoomify` `url` configuration
Instead specifying a base url, the `url` for the `ol.source.Zoomify` source can now be a template. The `{TileGroup}`, `{x}`, `{y}`, `{z}` and placeholders must be included in the `url` in this case. the `url` can now also include subdomain placeholders:
```js
new ol.source.Zoomify({
url: 'https://{a-f}.example.com/cgi-bin/iipsrv.fcgi?zoomify=/a/b/{TileGroup}/{z}-{x}-{y}.jpg'
});
```
#### Removal of deprecated methods #### Removal of deprecated methods
The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead. The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead.
The `unByKey()` method has been removed from `ol.Observable` instances. Use the `ol.Observable.unByKey()` static function instead.
```js
var key = map.on('moveend', function() { ...});
map.unByKey(key);
```
New code:
```js
var key = map.on('moveend', function() { ...});
ol.Observable.unByKey(key);
```
#### Simplified `ol.View#fit()` API #### Simplified `ol.View#fit()` API
In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd). In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd).

View File

@@ -1,183 +0,0 @@
# 4.0.0
Starting with this version, OpenLayers introduces [Semantic Versioning](http://semver.org). Unlike the switch from v2.x to v3.x, which marked a complete rewrite of the library with an entirely new API, major version increments now simply mean that users should pay attention to the *'Breaking changes'* section of the upgrade notes.
For users of mainstream bundlers and minifiers, OpenLayers is now also available as a set of ES2015 modules. See https://npmjs.com/package/ol/. With that package, bundling only the needed parts of the library with an application is now completely hassle free.
Version 4.0.0 includes enhancements and fixes from 107 pull requests since the previous release.
Among these changes, [#6381](https://github.com/openlayers/openlayers/pull/6381) adds an example which shows how to use [geojson-vt](https://www.npmjs.com/package/geojson-vt) for highly efficient rendering of GeoJSON data as vector tiles.
Several improvements were made to `ol.source.Zoomify`, including projection support ([#6387](https://github.com/openlayers/openlayers/pull/6387)) and support for URL templates ([#6475](https://github.com/openlayers/openlayers/pull/6475)).
Also the `ol.source.ImageArcGISRest` saw some enhancements, including HiDPI/Retina support and a fix that avoids non-integer DPI values ([#6300](https://github.com/openlayers/openlayers/pull/6300) and [#6467](https://github.com/openlayers/openlayers/pull/6467)).
On the topic of drawing tools, @tst-ppenev completed an effort to make the `ol.interaction.Modify` interaction support modification of `ol.geom.Circle` geometries ([#6457](https://github.com/openlayers/openlayers/pull/6457)).
## Breaking changes
### Simplified `ol.View#fit()` API
In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd).
Most common use case - old API:
```js
map.getView().fit(extent, map.getSize());
```
Most common use case - new API:
```js
map.getView().fit(extent);
```
Advanced use - old API:
```js
map.getView().fit(extent, [200, 100], {padding: 10});
```
Advanced use - new API:
```js
map.getView().fit(extent, {size: [200, 100], padding 10});
```
### Removal of deprecated methods
The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead.
The `unByKey()` method has been removed from `ol.Observable` instances. Use the `ol.Observable.unByKey()` static function instead.
```js
var key = map.on('moveend', function() { ...});
map.unByKey(key);
```
New code:
```js
var key = map.on('moveend', function() { ...});
ol.Observable.unByKey(key);
```
## Upgrade notes
### Simpler `ol.source.Zoomify` `url` configuration
Instead specifying a base url, the `url` for the `ol.source.Zoomify` source can now be a template. The `{TileGroup}`, `{x}`, `{y}`, `{z}` and placeholders must be included in the `url` in this case. the `url` can now also include subdomain placeholders:
```js
new ol.source.Zoomify({
url: 'https://{a-f}.example.com/cgi-bin/iipsrv.fcgi?zoomify=/a/b/{TileGroup}/{z}-{x}-{y}.jpg'
});
```
#### Removed build flags (`@define`)
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.
If you leave `ol.ENABLE_WEBGL` set to `true` in your build, you should set `ol.DEBUG_WEBGL` to `false` to avoid including debuggable shader sources.
## List of all changes
* [#6477](https://github.com/openlayers/openlayers/pull/6477) - Save and restore context when rotating ([@ahocevar](https://github.com/ahocevar))
* [#6475](https://github.com/openlayers/openlayers/pull/6475) - Use an url template for ol.source.Zoomify ([@fredj](https://github.com/fredj))
* [#6478](https://github.com/openlayers/openlayers/pull/6478) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6472](https://github.com/openlayers/openlayers/pull/6472) - Use fixed pixel ratio for hit tolerance tests ([@ahocevar](https://github.com/ahocevar))
* [#6468](https://github.com/openlayers/openlayers/pull/6468) - Remove console.assert in ol.structs.PriorityQueue tests ([@fredj](https://github.com/fredj))
* [#6467](https://github.com/openlayers/openlayers/pull/6467) - Round the DPI value in ol.source.ImageArcGISRest ([@fredj](https://github.com/fredj))
* [#6466](https://github.com/openlayers/openlayers/pull/6466) - Small XML error in KML test ([@tchandelle](https://github.com/tchandelle))
* [#6410](https://github.com/openlayers/openlayers/pull/6410) - fixed the degreesToStringHDMS_() function to promote a seconds value … ([@rjackson64840](https://github.com/rjackson64840))
* [#6461](https://github.com/openlayers/openlayers/pull/6461) - Add button to edit examples in CodePen ([@tchandelle](https://github.com/tchandelle))
* [#6320](https://github.com/openlayers/openlayers/pull/6320) - Use the 'openlayers' tag instead of 'openlayers-3' ([@ahocevar](https://github.com/ahocevar))
* [#6460](https://github.com/openlayers/openlayers/pull/6460) - Remove ol.Observable#unByKey ([@fredj](https://github.com/fredj))
* [#6463](https://github.com/openlayers/openlayers/pull/6463) - chore(package): update clean-css-cli to version 4.0.5 ([@openlayers](https://github.com/openlayers))
* [#6459](https://github.com/openlayers/openlayers/pull/6459) - Use ol.coordinate.distance ([@fredj](https://github.com/fredj))
* [#6457](https://github.com/openlayers/openlayers/pull/6457) - Add Circle Modification ([@tst-ppenev](https://github.com/tst-ppenev))
* [#6455](https://github.com/openlayers/openlayers/pull/6455) - Make all @api annotations imply stability ([@tschaub](https://github.com/tschaub))
* [#6452](https://github.com/openlayers/openlayers/pull/6452) - Remove deprecated methods ([@tschaub](https://github.com/tschaub))
* [#6361](https://github.com/openlayers/openlayers/pull/6361) - Remove "margin" at the bottom of the canvas ([@tchandelle](https://github.com/tchandelle))
* [#6450](https://github.com/openlayers/openlayers/pull/6450) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6302](https://github.com/openlayers/openlayers/pull/6302) - Publish a package for use with ES module bundlers ([@tschaub](https://github.com/tschaub))
* [#6446](https://github.com/openlayers/openlayers/pull/6446) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6445](https://github.com/openlayers/openlayers/pull/6445) - Fix pinch zooming ([@tschaub](https://github.com/tschaub))
* [#6444](https://github.com/openlayers/openlayers/pull/6444) - Disallow pinch zooming beyond min/max resolution ([@tschaub](https://github.com/tschaub))
* [#6443](https://github.com/openlayers/openlayers/pull/6443) - goog.require cleanup ([@openlayers](https://github.com/openlayers))
* [#6439](https://github.com/openlayers/openlayers/pull/6439) - Improve tile render performance ([@ahocevar](https://github.com/ahocevar))
* [#6442](https://github.com/openlayers/openlayers/pull/6442) - Fix missing goog.require ([@fredj](https://github.com/fredj))
* [#6441](https://github.com/openlayers/openlayers/pull/6441) - Update metalsmith-layouts to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6437](https://github.com/openlayers/openlayers/pull/6437) - Fit on circle ([@tchandelle](https://github.com/tchandelle))
* [#6427](https://github.com/openlayers/openlayers/pull/6427) - Ensure WMS width and height are always integers ([@ahocevar](https://github.com/ahocevar))
* [#6432](https://github.com/openlayers/openlayers/pull/6432) - Use ol.proj.EPSG3857.WORLD_EXTENT in ol.source.TileImage tests ([@fredj](https://github.com/fredj))
* [#6424](https://github.com/openlayers/openlayers/pull/6424) - Update dependencies to enable Greenkeeper 🌴 ([@openlayers](https://github.com/openlayers))
* [#6422](https://github.com/openlayers/openlayers/pull/6422) - Don't listen twice to move and end events in ol.control.ZoomSlider ([@fredj](https://github.com/fredj))
* [#6426](https://github.com/openlayers/openlayers/pull/6426) - Add rewrite_polyfills to custom builds tutorial ([@probins](https://github.com/probins))
* [#6365](https://github.com/openlayers/openlayers/pull/6365) - Make enums for draw and modify interactions public ([@gberaudo](https://github.com/gberaudo))
* [#6294](https://github.com/openlayers/openlayers/pull/6294) - Update code for closure-compiler v20170124 ([@fredj](https://github.com/fredj))
* [#6413](https://github.com/openlayers/openlayers/pull/6413) - Accept ol.StyleFunction in ol.Feature#setStyle() ([@ahocevar](https://github.com/ahocevar))
* [#6398](https://github.com/openlayers/openlayers/pull/6398) - Be more tolerant of map and position value ([@fredj](https://github.com/fredj))
* [#6399](https://github.com/openlayers/openlayers/pull/6399) - Small doc fix in VectorTileOptions renderMode ([@tchandelle](https://github.com/tchandelle))
* [#6396](https://github.com/openlayers/openlayers/pull/6396) - Show current year in attribution in "HERE Map Tile API" example ([@chrismayer](https://github.com/chrismayer))
* [#6390](https://github.com/openlayers/openlayers/pull/6390) - Tag deprecated functions with @deprecated ([@fredj](https://github.com/fredj))
* [#6370](https://github.com/openlayers/openlayers/pull/6370) - Feature apidoc, fix events and observable properties ([@tchandelle](https://github.com/tchandelle))
* [#6376](https://github.com/openlayers/openlayers/pull/6376) - Make ol.format.filter.or/and accept n filter conditions ([@tsauerwein](https://github.com/tsauerwein))
* [#6393](https://github.com/openlayers/openlayers/pull/6393) - Only stop animation when animating ([@ahocevar](https://github.com/ahocevar))
* [#6387](https://github.com/openlayers/openlayers/pull/6387) - Add projection option to ol.source.Zoomify ([@ahocevar](https://github.com/ahocevar))
* [#6386](https://github.com/openlayers/openlayers/pull/6386) - Snap : only listen to change event triggered by the feature ([@tchandelle](https://github.com/tchandelle))
* [#6383](https://github.com/openlayers/openlayers/pull/6383) - Modify interaction: check if interaction is active before drawing modifying vertex ([@tchandelle](https://github.com/tchandelle))
* [#6381](https://github.com/openlayers/openlayers/pull/6381) - geojson-vt integration example ([@drnextgis](https://github.com/drnextgis))
* [#6373](https://github.com/openlayers/openlayers/pull/6373) - Use the ol.DEBUG_WEBGL flag to debug shader sources ([@tschaub](https://github.com/tschaub))
* [#6379](https://github.com/openlayers/openlayers/pull/6379) - Set the overview map target in ol.control.OverviewMap.setMap ([@fredj](https://github.com/fredj))
* [#6375](https://github.com/openlayers/openlayers/pull/6375) - Use present in license text ([@bartvde](https://github.com/bartvde))
* [#6371](https://github.com/openlayers/openlayers/pull/6371) - Adjust copyright to include 2017 ([@kolosov-sergey](https://github.com/kolosov-sergey))
* [#6364](https://github.com/openlayers/openlayers/pull/6364) - Make sure moveTo is called after beginPath ([@ahocevar](https://github.com/ahocevar))
* [#6285](https://github.com/openlayers/openlayers/pull/6285) - Make size argument of ol.View#calculateExtent() optional ([@ahocevar](https://github.com/ahocevar))
* [#6357](https://github.com/openlayers/openlayers/pull/6357) - Fix GeoJSONCRSCode definition ([@fredj](https://github.com/fredj))
* [#6362](https://github.com/openlayers/openlayers/pull/6362) - Remove empty file ([@fredj](https://github.com/fredj))
* [#6358](https://github.com/openlayers/openlayers/pull/6358) - Ensure polygons without stroke are fully filled ([@ahocevar](https://github.com/ahocevar))
* [#6356](https://github.com/openlayers/openlayers/pull/6356) - Bring custom builds tutorial up to date ([@probins](https://github.com/probins))
* [#6359](https://github.com/openlayers/openlayers/pull/6359) - When applying a pending fill, also apply a pending stroke ([@ahocevar](https://github.com/ahocevar))
* [#6360](https://github.com/openlayers/openlayers/pull/6360) - Remove ol.array.flatten function ([@openlayers](https://github.com/openlayers))
* [#6353](https://github.com/openlayers/openlayers/pull/6353) - API doc : add highlight style to the active anchor ([@tchandelle](https://github.com/tchandelle))
* [#6355](https://github.com/openlayers/openlayers/pull/6355) - Remove test.geojson which was accidently committed in 57342a6 ([@ahocevar](https://github.com/ahocevar))
* [#6349](https://github.com/openlayers/openlayers/pull/6349) - Better documentation for icon-color example ([@ahocevar](https://github.com/ahocevar))
* [#6351](https://github.com/openlayers/openlayers/pull/6351) - Only consider pointerdown event if the last pointerup has been emitted ([@tchandelle](https://github.com/tchandelle))
* [#6345](https://github.com/openlayers/openlayers/pull/6345) - Mitigate rounding errors in GetMap width/height calculation ([@giohappy](https://github.com/giohappy))
* [#6344](https://github.com/openlayers/openlayers/pull/6344) - No special raster reprojection handling for Chrome ([@ahocevar](https://github.com/ahocevar))
* [#6339](https://github.com/openlayers/openlayers/pull/6339) - Code cleanup ([@fredj](https://github.com/fredj))
* [#6337](https://github.com/openlayers/openlayers/pull/6337) - Constrain center in DragZoom interaction ([@tchandelle](https://github.com/tchandelle))
* [#6336](https://github.com/openlayers/openlayers/pull/6336) - Remove unused ol.format.Feature.getExtensions function ([@fredj](https://github.com/fredj))
* [#6333](https://github.com/openlayers/openlayers/pull/6333) - Use API key for Thunderforest resources ([@ahocevar](https://github.com/ahocevar))
* [#6300](https://github.com/openlayers/openlayers/pull/6300) - Add missing hidpi option for ol.source.ImageArcGISRest ([@fredj](https://github.com/fredj))
* [#6109](https://github.com/openlayers/openlayers/pull/6109) - Export Map as PNG (IE issue) ([@NaveenKY](https://github.com/NaveenKY))
* [#6332](https://github.com/openlayers/openlayers/pull/6332) - Constrain the center in zoomByDelta ([@tchandelle](https://github.com/tchandelle))
* [#6331](https://github.com/openlayers/openlayers/pull/6331) - Remove unused map parameter from ol.interaction.Interaction ([@tchandelle](https://github.com/tchandelle))
* [#6326](https://github.com/openlayers/openlayers/pull/6326) - Add lineDashOffset to stroke style ([@tchandelle](https://github.com/tchandelle))
* [#6328](https://github.com/openlayers/openlayers/pull/6328) - ol.geom.polygon documentation update on the coordinates format ([@quentin-ol](https://github.com/quentin-ol))
* [#6324](https://github.com/openlayers/openlayers/pull/6324) - Ensure resolution stays in range when pinching ([@tschaub](https://github.com/tschaub))
* [#6329](https://github.com/openlayers/openlayers/pull/6329) - Fix WMTS theme location for sea-levels layer ([@thomasmoelhave](https://github.com/thomasmoelhave))
* [#6323](https://github.com/openlayers/openlayers/pull/6323) - Fix typo in Introduction ([@hdsnet](https://github.com/hdsnet))
* [#6305](https://github.com/openlayers/openlayers/pull/6305) - Moved hit Tolerance parameter to own example. ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6319](https://github.com/openlayers/openlayers/pull/6319) - Remove the '3' from OpenLayers ([@ahocevar](https://github.com/ahocevar))
* [#6314](https://github.com/openlayers/openlayers/pull/6314) - WebGL conditional compilation ([@ahocevar](https://github.com/ahocevar))
* [#6313](https://github.com/openlayers/openlayers/pull/6313) - Remove ol.DEBUG ([@tschaub](https://github.com/tschaub))
* [#6317](https://github.com/openlayers/openlayers/pull/6317) - Update sinon to version 1.17.7 🚀 ([@openlayers](https://github.com/openlayers))
* [#6312](https://github.com/openlayers/openlayers/pull/6312) - Make layers responsible for creating layer renderers ([@tschaub](https://github.com/tschaub))
* [#6308](https://github.com/openlayers/openlayers/pull/6308) - Dedicated modules for shared enums ([@tschaub](https://github.com/tschaub))
* [#6307](https://github.com/openlayers/openlayers/pull/6307) - Dedicated modules for enums ([@tschaub](https://github.com/tschaub))
* [#6297](https://github.com/openlayers/openlayers/pull/6297) - Update resemblejs to version 2.2.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#6296](https://github.com/openlayers/openlayers/pull/6296) - Fix #6295. Update reference link in sphere.js ([@jbelien](https://github.com/jbelien))
* [#6255](https://github.com/openlayers/openlayers/pull/6255) - Don't reset the css cursor if it's not needed ([@fredj](https://github.com/fredj))
* [#6290](https://github.com/openlayers/openlayers/pull/6290) - Use interim tiles ([@ahocevar](https://github.com/ahocevar))
* [#6291](https://github.com/openlayers/openlayers/pull/6291) - Document olx.AtPixelOptions#hitTolerance default value ([@fredj](https://github.com/fredj))
* [#6283](https://github.com/openlayers/openlayers/pull/6283) - Avoid modifying coordinate in forEachLayerAtCoordinate ([@tschaub](https://github.com/tschaub))
* [#6278](https://github.com/openlayers/openlayers/pull/6278) - Add missing require for ol.View ([@tschaub](https://github.com/tschaub))
* [#6280](https://github.com/openlayers/openlayers/pull/6280) - Continue loading tiles when image is not ready yet ([@ahocevar](https://github.com/ahocevar))
* [#6277](https://github.com/openlayers/openlayers/pull/6277) - Name modules more like their provide ([@tschaub](https://github.com/tschaub))
* [#6264](https://github.com/openlayers/openlayers/pull/6264) - Remove the requirement to provide a size to ol.View#fit() ([@ahocevar](https://github.com/ahocevar))
* [#6274](https://github.com/openlayers/openlayers/pull/6274) - Update clean-css to version 3.4.23 🚀 ([@openlayers](https://github.com/openlayers))
* [#6269](https://github.com/openlayers/openlayers/pull/6269) - Update derequire to version 2.0.6 🚀 ([@openlayers](https://github.com/openlayers))
* [#6270](https://github.com/openlayers/openlayers/pull/6270) - Add a magnify example ([@tschaub](https://github.com/tschaub))
* [#6261](https://github.com/openlayers/openlayers/pull/6261) - Fit Zoomify view to image extent ([@ahocevar](https://github.com/ahocevar))
* [#6259](https://github.com/openlayers/openlayers/pull/6259) - Simplify Zoomify example ([@ahocevar](https://github.com/ahocevar))
* [#6260](https://github.com/openlayers/openlayers/pull/6260) - Enhance documentation for ol.View#fit ([@marcjansen](https://github.com/marcjansen))
* [#6258](https://github.com/openlayers/openlayers/pull/6258) - Set geometry name properly ([@ahocevar](https://github.com/ahocevar))
* [#6251](https://github.com/openlayers/openlayers/pull/6251) - Take image pixel ratio into account for rendered resolution ([@ahocevar](https://github.com/ahocevar))
* [#6244](https://github.com/openlayers/openlayers/pull/6244) - Enforces spacing around commas ([@fredj](https://github.com/fredj))
* [#6246](https://github.com/openlayers/openlayers/pull/6246) - Re-render vector tiles when layer has changed ([@ahocevar](https://github.com/ahocevar))
* [#6243](https://github.com/openlayers/openlayers/pull/6243) - Consistent spacing between keys and values in object literal ([@fredj](https://github.com/fredj))
* [#6238](https://github.com/openlayers/openlayers/pull/6238) - Update eslint to version 3.12.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#6236](https://github.com/openlayers/openlayers/pull/6236) - Update clean-css to version 3.4.22 🚀 ([@openlayers](https://github.com/openlayers))

View File

@@ -1,11 +0,0 @@
# 4.0.1
## Summary
The v4.0.1 release is a patch release that addresses a regression in the v4.0.0 release. The fix makes pinch zooming work again properly when the two fingers are not placed on the screen at the same time.
See the [v4.0.0 release notes](https://github.com/openlayers/openlayers/releases/tag/v4.0.0) for details on upgrading from v3.20.x.
## Fix
* [#6486](https://github.com/openlayers/openlayers/pull/6486) - Do not set center when touches count has changed ([@ahocevar](https://github.com/ahocevar))

View File

@@ -1,127 +0,0 @@
# 4.1.0
## Summary
The v4.1.0 release includes features and fixes from 91 pull requests.
#### Interactive overview map
The extent rectangle on the overview map can now be dragged to control the view for the main map.
#### Setting min and max zoom for a view
You can now change the min or max zoom for a view after it has been created. This can be useful if you want to limit how far out users can zoom based on changes in viewport width (use `view.setMinZoom()` for this).
#### Adding duplicate layers to a map throws
Previously, you could do this:
```js
map.addLayer(layer);
map.addLayer(layer);
```
However, after adding a duplicate layer, things failed if you tried to remove that layer.
Now, `map.addLayer()` throws if you try adding a layer that has already been added to the map.
#### Simpler `constrainResolution` configuration
The `constrainResolution` configuration for `ol.interaction.PinchZoom` and `ol.interaction.MouseWheelZoom`
can now be set directly with an option in `ol.interaction.defaults`:
```js
ol.interaction.defaults({
constrainResolution: true
});
```
## Detailed changes
* [#6675](https://github.com/openlayers/openlayers/pull/6675) - Reset cursor when translate interaction is removed or deactivated ([@tchandelle](https://github.com/tchandelle))
* [#6707](https://github.com/openlayers/openlayers/pull/6707) - Set version when building ol package ([@tschaub](https://github.com/tschaub))
* [#6706](https://github.com/openlayers/openlayers/pull/6706) - Add ol.source.Cluster#getDistance function ([@fredj](https://github.com/fredj))
* [#6695](https://github.com/openlayers/openlayers/pull/6695) - Unique layers ([@tschaub](https://github.com/tschaub))
* [#6704](https://github.com/openlayers/openlayers/pull/6704) - Include typedefs.js in closure compiler tutorial build configurations ([@openlayers](https://github.com/openlayers))
* [#6702](https://github.com/openlayers/openlayers/pull/6702) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6693](https://github.com/openlayers/openlayers/pull/6693) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6691](https://github.com/openlayers/openlayers/pull/6691) - Move eslint globals to to test/.eslintrc ([@fredj](https://github.com/fredj))
* [#6689](https://github.com/openlayers/openlayers/pull/6689) - Add new constrainResolution option to olx.interaction.DefaultsOptions ([@fredj](https://github.com/fredj))
* [#6692](https://github.com/openlayers/openlayers/pull/6692) - Improve docs for MouseWheelZoom constrainResolution ([@ahocevar](https://github.com/ahocevar))
* [#6687](https://github.com/openlayers/openlayers/pull/6687) - Clip image only if the layer extent intersects the view extent ([@tchandelle](https://github.com/tchandelle))
* [#6686](https://github.com/openlayers/openlayers/pull/6686) - Update finishCoordinate in ol.interaction.Draw#removeLastPoint ([@fredj](https://github.com/fredj))
* [#6682](https://github.com/openlayers/openlayers/pull/6682) - Add example, docs and typedef for MouseWheelZoom's constrainResolution option ([@ahocevar](https://github.com/ahocevar))
* [#6683](https://github.com/openlayers/openlayers/pull/6683) - Add this jsdoc tag to ol.interaction.DragBox.defaultBoxEndCondition ([@fredj](https://github.com/fredj))
* [#6681](https://github.com/openlayers/openlayers/pull/6681) - Add constrainResolution in olx.interaction.PinchZoomOptions typedef ([@fredj](https://github.com/fredj))
* [#6671](https://github.com/openlayers/openlayers/pull/6671) - Add constraintResolution option to MouseWheelZoom for zoom with trackpad ([@kaiCu](https://github.com/kaiCu))
* [#6680](https://github.com/openlayers/openlayers/pull/6680) - Remove ol.DRAG_BOX_HYSTERESIS_PIXELS define and add option ([@fredj](https://github.com/fredj))
* [#6666](https://github.com/openlayers/openlayers/pull/6666) - Use the optional extent in ol.structs.RBush#getExtent ([@fredj](https://github.com/fredj))
* [#6670](https://github.com/openlayers/openlayers/pull/6670) - fix(package): update browserify to version 14.3.0 ([@openlayers](https://github.com/openlayers))
* [#6664](https://github.com/openlayers/openlayers/pull/6664) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6659](https://github.com/openlayers/openlayers/pull/6659) - Add crossOrigin to examples using ol.style.Icon ([@openlayers](https://github.com/openlayers))
* [#6658](https://github.com/openlayers/openlayers/pull/6658) - Fixes for raster source rendering ([@tschaub](https://github.com/tschaub))
* [#6620](https://github.com/openlayers/openlayers/pull/6620) - Fix the parsing of flat coordinates in GML2 for 3D geometies ([@Jenselme](https://github.com/Jenselme))
* [#6657](https://github.com/openlayers/openlayers/pull/6657) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6644](https://github.com/openlayers/openlayers/pull/6644) - Allow minZoom and maxZoom to be set on a view ([@tschaub](https://github.com/tschaub))
* [#6636](https://github.com/openlayers/openlayers/pull/6636) - Add test for the metric unit displayed in the scaleline ([@fredj](https://github.com/fredj))
* [#6598](https://github.com/openlayers/openlayers/pull/6598) - Add support of micrometers to scaleline ([@hajjimurad](https://github.com/hajjimurad))
* [#6643](https://github.com/openlayers/openlayers/pull/6643) - Add common transforms by default ([@tschaub](https://github.com/tschaub))
* [#6567](https://github.com/openlayers/openlayers/pull/6567) - Overlay visible before updating render position ([@nagytech](https://github.com/nagytech))
* [#6634](https://github.com/openlayers/openlayers/pull/6634) - Fix custom build when openlayers is installed from yarn package manager ([@Toilal](https://github.com/Toilal))
* [#6639](https://github.com/openlayers/openlayers/pull/6639) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6635](https://github.com/openlayers/openlayers/pull/6635) - Add missing externs to custom builds examples ([@Toilal](https://github.com/Toilal))
* [#6631](https://github.com/openlayers/openlayers/pull/6631) - Fix request image size caclulation ([@ahocevar](https://github.com/ahocevar))
* [#6627](https://github.com/openlayers/openlayers/pull/6627) - Change css selector for user-select none ([@bartvde](https://github.com/bartvde))
* [#6626](https://github.com/openlayers/openlayers/pull/6626) - Respect cacheSize for reprojected caches ([@ahocevar](https://github.com/ahocevar))
* [#6623](https://github.com/openlayers/openlayers/pull/6623) - Fix outerWidth and outerHeight calculation in IE ([@ahocevar](https://github.com/ahocevar))
* [#6625](https://github.com/openlayers/openlayers/pull/6625) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6622](https://github.com/openlayers/openlayers/pull/6622) - Fix proj4 type ([@gberaudo](https://github.com/gberaudo))
* [#6617](https://github.com/openlayers/openlayers/pull/6617) - Use GeoServer/GWC caching when possible ([@ahocevar](https://github.com/ahocevar))
* [#6614](https://github.com/openlayers/openlayers/pull/6614) - Filter write util method ([@adube](https://github.com/adube))
* [#6616](https://github.com/openlayers/openlayers/pull/6616) - Fix closing tag in gml tests ([@fredj](https://github.com/fredj))
* [#6612](https://github.com/openlayers/openlayers/pull/6612) - Add support for WFS 1.0.0 to ol.format.WFS#writeTransaction ([@Jenselme](https://github.com/Jenselme))
* [#5887](https://github.com/openlayers/openlayers/pull/5887) - Interactive overview map ([@felixveysseyre](https://github.com/felixveysseyre))
* [#6610](https://github.com/openlayers/openlayers/pull/6610) - Fix event type case of MSPointerDown ([@ahocevar](https://github.com/ahocevar))
* [#6611](https://github.com/openlayers/openlayers/pull/6611) - Update jquery to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6609](https://github.com/openlayers/openlayers/pull/6609) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6606](https://github.com/openlayers/openlayers/pull/6606) - Reset dragSegments after vertex deletion ([@ahocevar](https://github.com/ahocevar))
* [#6523](https://github.com/openlayers/openlayers/pull/6523) - Add Gml2 serializers to support WFS-T 1.0.0 ([@Jenselme](https://github.com/Jenselme))
* [#6579](https://github.com/openlayers/openlayers/pull/6579) - Update slimerjs to v0.10.3 ([@fredj](https://github.com/fredj))
* [#6577](https://github.com/openlayers/openlayers/pull/6577) - Adding crossOrigin to optionsFromCapabilities ([@fredj](https://github.com/fredj))
* [#6604](https://github.com/openlayers/openlayers/pull/6604) - Fix RegularShape documentation ([@ahocevar](https://github.com/ahocevar))
* [#6603](https://github.com/openlayers/openlayers/pull/6603) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6601](https://github.com/openlayers/openlayers/pull/6601) - Update jquery to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6600](https://github.com/openlayers/openlayers/pull/6600) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6578](https://github.com/openlayers/openlayers/pull/6578) - Add ol.RenderOrderFunction typedef ([@icholy](https://github.com/icholy))
* [#6589](https://github.com/openlayers/openlayers/pull/6589) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6592](https://github.com/openlayers/openlayers/pull/6592) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6594](https://github.com/openlayers/openlayers/pull/6594) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6580](https://github.com/openlayers/openlayers/pull/6580) - Remove unused esprima package ([@fredj](https://github.com/fredj))
* [#6570](https://github.com/openlayers/openlayers/pull/6570) - Don't use deprecated sinon.stub(obj, 'meth', fn) ([@openlayers](https://github.com/openlayers))
* [#6569](https://github.com/openlayers/openlayers/pull/6569) - Return null if the layer was not found in the WMTS capabilities ([@fredj](https://github.com/fredj))
* [#6551](https://github.com/openlayers/openlayers/pull/6551) - Use the default fill and stroke color ([@fredj](https://github.com/fredj))
* [#6560](https://github.com/openlayers/openlayers/pull/6560) - Dont crash if feature loader xhr response returns 500 ([@geosense](https://github.com/geosense))
* [#6559](https://github.com/openlayers/openlayers/pull/6559) - Remove unneeded type cast ([@fredj](https://github.com/fredj))
* [#6558](https://github.com/openlayers/openlayers/pull/6558) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6553](https://github.com/openlayers/openlayers/pull/6553) - Update proj4 to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6554](https://github.com/openlayers/openlayers/pull/6554) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6549](https://github.com/openlayers/openlayers/pull/6549) - Make getAnimating and cancelAnimations @api ([@bartvde](https://github.com/bartvde))
* [#6547](https://github.com/openlayers/openlayers/pull/6547) - Clean up left-over code from animation changes ([@bartvde](https://github.com/bartvde))
* [#6540](https://github.com/openlayers/openlayers/pull/6540) - More precise ol.Geolocation#getAccuracyGeometry return type ([@openlayers](https://github.com/openlayers))
* [#6539](https://github.com/openlayers/openlayers/pull/6539) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6535](https://github.com/openlayers/openlayers/pull/6535) - Update closure-util to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6529](https://github.com/openlayers/openlayers/pull/6529) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6530](https://github.com/openlayers/openlayers/pull/6530) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6515](https://github.com/openlayers/openlayers/pull/6515) - Add view methods for getting max zoom, min zoom, and any zoom for a resolution ([@tschaub](https://github.com/tschaub))
* [#6520](https://github.com/openlayers/openlayers/pull/6520) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6518](https://github.com/openlayers/openlayers/pull/6518) - Fix olx.style.IconOptions.prototype.src type ([@fredj](https://github.com/fredj))
* [#6513](https://github.com/openlayers/openlayers/pull/6513) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6512](https://github.com/openlayers/openlayers/pull/6512) - Complete animations at target values ([@tschaub](https://github.com/tschaub))
* [#6511](https://github.com/openlayers/openlayers/pull/6511) - Revert accidently committed example change ([@ahocevar](https://github.com/ahocevar))
* [#6507](https://github.com/openlayers/openlayers/pull/6507) - ol.DEBUG no longer needed in transforms/module.js ([@probins](https://github.com/probins))
* [#6505](https://github.com/openlayers/openlayers/pull/6505) - Update ol package to include Browserify config ([@tschaub](https://github.com/tschaub))
* [#6504](https://github.com/openlayers/openlayers/pull/6504) - Determine if we should handle the drawing while the pointer is moving ([@tchandelle](https://github.com/tchandelle))
* [#6499](https://github.com/openlayers/openlayers/pull/6499) - Be more tolerant when comparing vertices when modifying a circle ([@tchandelle](https://github.com/tchandelle))
* [#6498](https://github.com/openlayers/openlayers/pull/6498) - Travis failing on master - use Node v6.1.x ([@ahocevar](https://github.com/ahocevar))
* [#6493](https://github.com/openlayers/openlayers/pull/6493) - Vector tile cleanup ([@ahocevar](https://github.com/ahocevar))
* [#6483](https://github.com/openlayers/openlayers/pull/6483) - Fix renderer.canvas.TileLayer to calculate correct canvas height for drawing. ([@nearmap](https://github.com/nearmap))
* [#6488](https://github.com/openlayers/openlayers/pull/6488) - Do not draw circle when pointer not moved and freehand is on ([@tchandelle](https://github.com/tchandelle))
* [#6491](https://github.com/openlayers/openlayers/pull/6491) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))

View File

@@ -1,13 +0,0 @@
# 4.1.1
## Summary
This is a patch release to fix several minor issues and two regressions in the [4.1.0 release](https://github.com/openlayers/openlayers/releases/tag/v4.1.0).
## Changes
* [#6711](https://github.com/openlayers/openlayers/pull/6711) - Correct path to cleancss ([@tschaub](https://github.com/tschaub))
* [#6728](https://github.com/openlayers/openlayers/pull/6728) - Fix tissot examples docs ([@fredj](https://github.com/fredj))
* [#6732](https://github.com/openlayers/openlayers/pull/6732) - Use firefox < 53 in travis ([@fredj](https://github.com/fredj))
* [#6741](https://github.com/openlayers/openlayers/pull/6741) - Allow user selection in overlay container ([@fredj](https://github.com/fredj))
* [#6755](https://github.com/openlayers/openlayers/pull/6755) - Add missing goog.require ([@fredj](https://github.com/fredj))

View File

@@ -1,151 +0,0 @@
# 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))

View File

@@ -59,16 +59,14 @@
<div class="row-fluid"> <div class="row-fluid">
<div id="source-controls"> <div id="source-controls">
<a id="copy-button"><i class="fa fa-clipboard"></i> Copy</a> <a id="copy-button"><i class="fa fa-clipboard"></i> Copy</a>
<a id="codepen-button"><i class="fa fa-codepen"></i> Edit</a> <a id="jsfiddle-button"><i class="fa fa-jsfiddle"></i> Edit</a>
</div> </div>
<form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/"> <form method="POST" id="jsfiddle-form" target="_blank" action="https://jsfiddle.net/api/post/library/pure/">
<textarea class="hidden" name="title">{{ title }}</textarea>
<textarea class="hidden" name="description">{{ shortdesc }}</textarea>
<textarea class="hidden" name="js">{{ js.source }}</textarea> <textarea class="hidden" name="js">{{ js.source }}</textarea>
<textarea class="hidden" name="css">{{ css.source }}</textarea> <textarea class="hidden" name="css">{{ css.source }}</textarea>
<textarea class="hidden" name="html">{{ contents }}</textarea> <textarea class="hidden" name="html">{{ contents }}</textarea>
<input type="hidden" name="wrap" value="l">
<input type="hidden" name="resources" value="https://openlayers.org/en/v{{ olVersion }}/css/ol.css,https://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}"> <input type="hidden" name="resources" value="https://openlayers.org/en/v{{ olVersion }}/css/ol.css,https://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}">
<input type="hidden" name="data">
</form> </form>
<pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt; <pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html&gt; &lt;html&gt;

View File

@@ -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": [
"plugins/markdown", "node_modules/jsdoc/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"

View File

@@ -41,7 +41,7 @@ exports.handlers = {
cls.observables = []; cls.observables = [];
} }
observable = observables[doclet.observable]; observable = observables[doclet.observable];
if (observable.type && cls.observables.indexOf(observable) == -1) { if (cls.observables.indexOf(observable) == -1) {
cls.observables.push(observable); cls.observables.push(observable);
} }
if (!cls.fires) { if (!cls.fires) {

View File

@@ -16,10 +16,8 @@
<tbody> <tbody>
<?js <?js
var self = this; var self = this;
var propsByName = {};
props.forEach(function(prop) { props.forEach(function(prop) {
if (!prop || propsByName[prop.name]) { return; } if (!prop) { return; }
propsByName[prop.name] = prop;
var setter = prop.readonly ? 'no' : 'yes'; var setter = prop.readonly ? 'no' : 'yes';
?> ?>

View File

@@ -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"
] ]
} }

View File

@@ -3,6 +3,7 @@
* 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');
@@ -88,6 +89,7 @@ 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,
@@ -167,7 +169,6 @@ exports.publish = function(data, opts) {
return (symbol.name in augments || symbol.virtual); return (symbol.name in augments || symbol.virtual);
}); });
return new Promise(function(resolve, reject) {
process.stdout.write( process.stdout.write(
JSON.stringify({ JSON.stringify({
symbols: symbols, symbols: symbols,
@@ -176,6 +177,5 @@ exports.publish = function(data, opts) {
externs: externs, externs: externs,
base: base base: base
}, null, 2)); }, null, 2));
});
}; };

View File

@@ -34,32 +34,16 @@
.ol-unsupported { .ol-unsupported {
display: none; display: none;
} }
.ol-viewport, .ol-unselectable { .ol-viewport .ol-unselectable {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-tap-highlight-color: rgba(0,0,0,0);
} }
.ol-selectable {
-webkit-touch-callout: default;
-webkit-user-select: auto;
-moz-user-select: auto;
-ms-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);
@@ -255,7 +239,3 @@
.ol-overviewmap-box { .ol-overviewmap-box {
border: 2px dotted rgba(0,60,136,0.7); border: 2px dotted rgba(0,60,136,0.7);
} }
.ol-overviewmap .ol-overviewmap-box:hover {
cursor: move;
}

View File

@@ -220,7 +220,3 @@ The `{-y}` placeholder requires a tile grid with extent.
### 57 ### 57
At least 2 conditions are required. At least 2 conditions are required.
### 58
Duplicate item added to a unique collection. For example, it may be that you tried to add the same layer to a map twice. Check for calls to `map.addLayer()` or other places where the map's layer collection is modified.

View File

@@ -7,7 +7,7 @@ layout: doc.hbs
Certain questions arise more often than others when users ask for help. This Certain questions arise more often than others when users ask for help. This
document tries to list some of the common questions that frequently get asked, document tries to list some of the common questions that frequently get asked,
e.g. on [Stack Overflow](http://stackoverflow.com/questions/tagged/openlayers). e.g. on [Stack Overflow](http://stackoverflow.com/questions/tagged/openlayers-3).
If you think a question (and naturally its answer) should be added here, feel If you think a question (and naturally its answer) should be added here, feel
free to ping us or to send a pull request enhancing this document. free to ping us or to send a pull request enhancing this document.

View File

@@ -19,4 +19,4 @@ We have put together a document that lists [Frequently Asked Questions (FAQ)](fa
# More questions? # More questions?
If you cannot find an answer in the documentation or the FAQ, you can ask your question on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers). If you cannot find an answer in the documentation or the FAQ, you can ask your question on [stackoverflow using the tag 'openlayers-3'](http://stackoverflow.com/questions/tagged/openlayers-3).

View File

@@ -172,7 +172,6 @@ The minimum config file looks like this:
"ol.ENABLE_WEBGL=false" "ol.ENABLE_WEBGL=false"
], ],
"js": [ "js": [
"node_modules/openlayers/src/ol/typedefs.js",
"node_modules/openlayers/externs/olx.js", "node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/oli.js" "node_modules/openlayers/externs/oli.js"
], ],
@@ -224,7 +223,6 @@ Here is a version of `config.json` with more compilation checks enabled:
"ol.ENABLE_WEBGL=false" "ol.ENABLE_WEBGL=false"
], ],
"js": [ "js": [
"node_modules/openlayers/src/ol/typedefs.js",
"node_modules/openlayers/externs/olx.js", "node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/oli.js" "node_modules/openlayers/externs/oli.js"
], ],

View File

@@ -51,9 +51,7 @@ Creating a custom build requires writing a build configuration file. The format
"compile": { "compile": {
"externs": [ "externs": [
"externs/bingmaps.js", "externs/bingmaps.js",
"externs/cartodb.js",
"externs/closure-compiler.js", "externs/closure-compiler.js",
"externs/esrijson.js",
"externs/geojson.js", "externs/geojson.js",
"externs/oli.js", "externs/oli.js",
"externs/olx.js", "externs/olx.js",
@@ -203,16 +201,9 @@ Now let's try a more complicated example: [`heatmaps-earthquakes`](https://openl
], ],
"compile": { "compile": {
"externs": [ "externs": [
"externs/bingmaps.js",
"externs/cartodb.js",
"externs/closure-compiler.js", "externs/closure-compiler.js",
"externs/esrijson.js",
"externs/geojson.js",
"externs/olx.js", "externs/olx.js",
"externs/oli.js", "externs/oli.js"
"externs/proj4js.js",
"externs/tilejson.js",
"externs/topojson.js"
], ],
"define": [ "define": [
"ol.ENABLE_WEBGL=false", "ol.ENABLE_WEBGL=false",

View File

@@ -45,7 +45,7 @@ The easiest way to use a custom projection is to add the [Proj4js](http://proj4j
Following example shows definition of a [British National Grid](https://epsg.io/27700): Following example shows definition of a [British National Grid](https://epsg.io/27700):
``` html ``` html
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js"></script>
``` ```
``` javascript ``` javascript

View File

@@ -1,6 +1,5 @@
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');
@@ -74,16 +73,9 @@ 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: rotation + Math.PI, rotation: view.getRotation() + 2 * Math.PI,
anchor: rome, anchor: rome
easing: ol.easing.easeIn
}, {
rotation: rotation + 2 * Math.PI,
anchor: rome,
easing: ol.easing.easeOut
}); });
}); });
@@ -111,19 +103,10 @@ 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,
easing: ol.easing.easeOut duration: 2000
}); });
}); });

View File

@@ -12,8 +12,7 @@ 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 (static)</option> <option value="Road">Road</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>

View File

@@ -6,7 +6,6 @@ goog.require('ol.source.BingMaps');
var styles = [ var styles = [
'Road', 'Road',
'RoadOnDemand',
'Aerial', 'Aerial',
'AerialWithLabels', 'AerialWithLabels',
'collinsBart', 'collinsBart',

View File

@@ -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 // selected features, and their names are displayed in the "info"
// 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 = '&nbsp;';
}); });
map.on('click', function() {
var infoBox = document.getElementById('info'); selectedFeatures.clear();
infoBox.innerHTML = '&nbsp;';
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';
}
}); });

View File

@@ -1,7 +1,7 @@
--- ---
layout: example.html layout: example.html
title: Clustered Features title: Clustered Features
shortdesc: Example of using ol.source.Cluster. shortdesc: Example of using <code>ol.source.Cluster</code>.
docs: > docs: >
This example shows how to do clustering on point features. This example shows how to do clustering on point features.
tags: "cluster, vector" tags: "cluster, vector"

View File

@@ -11,8 +11,7 @@ var layers = [
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'TILED': true
} }
}) })
}) })

View File

@@ -17,30 +17,18 @@ var replacer = function(key, value) {
var geometry = value.geometry; var geometry = value.geometry;
if (rawType === 1) { if (rawType === 1) {
type = 'MultiPoint'; type = geometry.length === 1 ? 'Point' : 'MultiPoint';
if (geometry.length == 1) {
type = 'Point';
geometry = geometry[0];
}
} else if (rawType === 2) { } else if (rawType === 2) {
type = 'MultiLineString'; type = geometry.length === 1 ? 'LineString' : 'MultiLineString';
if (geometry.length == 1) {
type = 'LineString';
geometry = geometry[0];
}
} else if (rawType === 3) { } else if (rawType === 3) {
type = 'Polygon'; type = geometry.length === 1 ? 'Polygon' : 'MultiPolygon';
if (geometry.length > 1) {
type = 'MultiPolygon';
geometry = [geometry];
}
} }
return { return {
'type': 'Feature', 'type': 'Feature',
'geometry': { 'geometry': {
'type': type, 'type': type,
'coordinates': geometry 'coordinates': geometry.length == 1 ? geometry : [geometry]
}, },
'properties': value.tags 'properties': value.tags
}; };

View File

@@ -6,7 +6,7 @@ goog.require('ol.source.TileWMS');
var wmsSource = new ol.source.TileWMS({ var wmsSource = new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'ne:ne', 'TILED': true}, params: {'LAYERS': 'ne:ne'},
serverType: 'geoserver', serverType: 'geoserver',
crossOrigin: 'anonymous' crossOrigin: 'anonymous'
}); });

View File

@@ -27,8 +27,6 @@ var graticule = new ol.Graticule({
color: 'rgba(255,120,0,0.9)', color: 'rgba(255,120,0,0.9)',
width: 2, width: 2,
lineDash: [0.5, 4] lineDash: [0.5, 4]
}), })
showLabels: true
}); });
graticule.setMap(map); graticule.setMap(map);

View File

@@ -26,7 +26,6 @@ var madrid = new ol.Feature({
rome.setStyle(new ol.style.Style({ rome.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#8959A8', color: '#8959A8',
crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
})) }))
})); }));
@@ -34,7 +33,6 @@ rome.setStyle(new ol.style.Style({
london.setStyle(new ol.style.Style({ london.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#4271AE', color: '#4271AE',
crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
})) }))
})); }));
@@ -42,7 +40,6 @@ london.setStyle(new ol.style.Style({
madrid.setStyle(new ol.style.Style({ madrid.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: [113, 140, 0], color: [113, 140, 0],
crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
})) }))
})); }));

View File

@@ -15,7 +15,6 @@ function createStyle(src, img) {
return new ol.style.Style({ return new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 0.96], anchor: [0.5, 0.96],
crossOrigin: 'anonymous',
src: src, src: src,
img: img, img: img,
imgSize: img ? [img.width, img.height] : undefined imgSize: img ? [img.width, img.height] : undefined

View File

@@ -51,7 +51,6 @@ for (i = 0; i < iconCount; ++i) {
rotation: info.rotation, rotation: info.rotation,
scale: info.scale, scale: info.scale,
size: info.size, size: info.size,
crossOrigin: 'anonymous',
src: 'data/Butterfly.png' src: 'data/Butterfly.png'
}); });
} }

View File

@@ -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 source 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 tiles for subsequent zoom levels to save bandwith 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

View File

@@ -15,16 +15,25 @@ goog.require('ol.tilegrid.TileGrid');
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
// Calculation of resolutions that match zoom levels 1, 3, 5, 7, 9, 11, 13, 15. // For how many zoom levels do we want to use the same vector tiles?
// 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 i = 0; i <= 7; ++i) { for (var z = zoomOffset / reuseZoomLevels; z <= 22 / reuseZoomLevels; ++z) {
resolutions.push(156543.03392804097 / Math.pow(2, i * 2)); resolutions.push(156543.03392804097 / Math.pow(2, z * reuseZoomLevels));
} }
// 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] * 2 - 1)) .replace('{z}', String(tileCoord[0] * reuseZoomLevels + zoomOffset))
.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(
@@ -34,6 +43,8 @@ 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">' +
@@ -41,10 +52,9 @@ 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: 8, tilePixelRatio: 16,
tileUrlFunction: tileUrlFunction tileUrlFunction: tileUrlFunction
}), }),
style: createMapboxStreetsV6Style() style: createMapboxStreetsV6Style()

View File

@@ -1,12 +0,0 @@
---
layout: example.html
title: View Min-Zoom
shortdesc: Demonstrates how the view's minimum zoom level can be changed.
docs: >
The <code>minZoom</code> option for a view limits how far out you can
zoom. This property can be updated by calling <code>view.setMinZoom(newMinZoom)</code>.
In this example, the minimum zoom level is set so that you only see one
world at a time. Resize your browser window to change the threshold.
tags: "min, zoom"
---
<div id="map" class="map"></div>

View File

@@ -1,36 +0,0 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var viewport = document.getElementById('map');
function getMinZoom() {
var width = viewport.clientWidth;
return Math.ceil(Math.LOG2E * Math.log(width / 256));
}
var initialZoom = getMinZoom();
var view = new ol.View({
center: [0, 0],
minZoom: initialZoom,
zoom: initialZoom
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: view
});
window.addEventListener('resize', function() {
var minZoom = getMinZoom();
if (minZoom !== view.getMinZoom()) {
view.setMinZoom(minZoom);
}
});

View File

@@ -222,13 +222,7 @@ 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({

View File

@@ -4,6 +4,7 @@ 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({
@@ -36,7 +37,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(event.target.value); mousePositionControl.setProjection(ol.proj.get(event.target.value));
}); });
var precisionInput = document.getElementById('precision'); var precisionInput = document.getElementById('precision');

View File

@@ -1,12 +0,0 @@
---
layout: example.html
title: Mousewheel/Trackpad Zoom
shortdesc: Restrict wheel/trackpad zooming to integer zoom levels.
docs: >
By default, the `ol.interaction.MouseWheelZoom` can leave the map at
fractional zoom levels. If instead you want to constrain wheel/trackpad
zooming to integer zoom levels, set <code>constrainResolution: true</code>
when constructing the interaction.
tags: "trackpad, mousewheel, zoom, interaction"
---
<div id="map" class="map"></div>

View File

@@ -1,25 +0,0 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.interaction');
goog.require('ol.interaction.MouseWheelZoom');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
interactions: ol.interaction.defaults({mouseWheelZoom: false}).extend([
new ol.interaction.MouseWheelZoom({
constrainResolution: true // force zooming to a integer zoom
})
]),
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -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. 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. 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.
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

View File

@@ -1,3 +1,4 @@
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');
@@ -12,6 +13,11 @@ goog.require('ol.tilegrid');
var key = 'vector-tiles-5eJz6JX'; var key = 'vector-tiles-5eJz6JX';
var attribution = [new ol.Attribution({
html: '&copy; OpenStreetMap contributors, Whos 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',
@@ -28,12 +34,30 @@ var buildingStyle = new ol.style.Style({
width: 1 width: 1
}) })
}); });
var waterStyle = new ol.style.Style({
var map = new ol.Map({
layers: [
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/water/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: '#9db9e8' color: '#9db9e8'
}) })
}); })
var roadStyle = function(feature) { }),
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 kind = feature.get('kind');
var railway = feature.get('railway'); var railway = feature.get('railway');
var sort_key = feature.get('sort_key'); var sort_key = feature.get('sort_key');
@@ -58,28 +82,17 @@ var roadStyle = function(feature) {
roadStyleCache[styleKey] = style; roadStyleCache[styleKey] = style;
} }
return style; return style;
}; }
}),
var map = new ol.Map({
layers: [
new ol.layer.VectorTile({ new ol.layer.VectorTile({
source: new ol.source.VectorTile({ source: new ol.source.VectorTile({
attributions: '&copy; OpenStreetMap contributors, Whos On First, ' + attributions: attribution,
'Natural Earth, and openstreetmapdata.com', format: format,
format: new ol.format.TopoJSON({ tileGrid: tileGrid,
layerName: 'layer', url: 'https://tile.mapzen.com/mapzen/vector/v1/buildings/{z}/{x}/{y}.topojson?api_key=' + key
layers: ['water', 'roads', 'buildings']
}), }),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}), style: function(f, resolution) {
url: 'https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson?api_key=' + key return (resolution < 10) ? buildingStyle : null;
}),
style: function(feature, resolution) {
switch (feature.get('layer')) {
case 'water': return waterStyle;
case 'roads': return roadStyle(feature);
case 'buildings': return (resolution < 10) ? buildingStyle : null;
default: return null;
}
} }
}) })
], ],

View File

@@ -8,7 +8,7 @@ docs: >
in <a href="https://epsg.io/">EPSG.io</a> database. in <a href="https://epsg.io/">EPSG.io</a> database.
tags: "reprojection, projection, proj4js, epsg.io" tags: "reprojection, projection, proj4js, epsg.io"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js - https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
<form class="form-inline"> <form class="form-inline">

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of single image source. This example shows client-side reprojection of single image source.
tags: "reprojection, projection, proj4js, image, imagestatic" tags: "reprojection, projection, proj4js, image, imagestatic"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js - https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -6,7 +6,7 @@ docs: >
This example shows client-side raster reprojection between various projections. This example shows client-side raster reprojection between various projections.
tags: "reprojection, projection, proj4js, osm, wms, wmts, hidpi" tags: "reprojection, projection, proj4js, osm, wms, wmts, hidpi"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js - https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
<form class="form-inline"> <form class="form-inline">

View File

@@ -72,8 +72,7 @@ layers['wms4326'] = new ol.layer.Tile({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
crossOrigin: '', crossOrigin: '',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'TILED': true
}, },
projection: 'EPSG:4326' projection: 'EPSG:4326'
}) })
@@ -100,15 +99,13 @@ fetch(url).then(function(response) {
return response.text(); return response.text();
}).then(function(text) { }).then(function(text) {
var result = parser.read(text); var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result, { var options = ol.source.WMTS.optionsFromCapabilities(result,
layer: 'OSM_Land_Mask', {layer: 'OSM_Land_Mask', matrixSet: 'EPSG3413_250m'});
matrixSet: 'EPSG3413_250m'
});
options.crossOrigin = ''; options.crossOrigin = '';
options.projection = 'EPSG:3413'; options.projection = 'EPSG:3413';
options.wrapX = false; options.wrapX = false;
layers['wmts3413'] = new ol.layer.Tile({ layers['wmts3413'] = new ol.layer.Tile({
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options)) source: new ol.source.WMTS(options)
}); });
}); });
@@ -134,7 +131,7 @@ layers['states'] = new ol.layer.Tile({
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
crossOrigin: '', crossOrigin: '',
params: {'LAYERS': 'topp:states'}, params: {'LAYERS': 'topp:states', 'TILED': true},
serverType: 'geoserver', serverType: 'geoserver',
tileGrid: new ol.tilegrid.TileGrid({ tileGrid: new ol.tilegrid.TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219], extent: [-13884991, 2870341, -7455066, 6338219],
@@ -177,7 +174,7 @@ function updateViewProjection() {
}); });
map.setView(newView); map.setView(newView);
// Example how to prevent double occurrence of map by limiting layer extent // Example how to prevent double occurence of map by limiting layer extent
if (newProj == ol.proj.get('EPSG:3857')) { if (newProj == ol.proj.get('EPSG:3857')) {
layers['bng'].setExtent([-1057216, 6405988, 404315, 8759696]); layers['bng'].setExtent([-1057216, 6405988, 404315, 8759696]);
} else { } else {

View File

@@ -10,40 +10,11 @@
}); });
} }
var codepenButton = document.getElementById('codepen-button'); var fiddleButton = document.getElementById('jsfiddle-button');
if (codepenButton) { if (fiddleButton) {
codepenButton.onclick = function(event) { fiddleButton.onclick = function(event) {
event.preventDefault(); event.preventDefault();
var form = document.getElementById('codepen-form'); document.getElementById('jsfiddle-form').submit();
// Doc : https://blog.codepen.io/documentation/api/prefill/
var resources = form.resources.value.split(',');
var data = {
title: form.title.value,
description: form.description.value,
layout: 'left',
html: form.html.value,
css: form.css.value,
js: form.js.value,
css_external: resources.filter(function(resource) {
return resource.lastIndexOf('.css') === resource.length - 4;
}).join(';'),
js_external: resources.filter(function(resource) {
return resource.lastIndexOf('.js') === resource.length - 3;
}).join(';')
};
// binary flags to display html, css, js and/or console tabs
data.editors = '' + Number(data.html.length > 0) +
Number(data.css.length > 0) +
Number(data.js.length > 0) +
Number(data.js.indexOf('console') > 0);
form.data.value = JSON.stringify(data);
form.submit();
}; };
} }

View File

@@ -106,7 +106,7 @@ pre[class*="language-"] {
cursor: pointer; cursor: pointer;
} }
#codepen-button { #jsfiddle-button {
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
} }

View File

@@ -18,7 +18,7 @@ var map = new ol.Map({
}) })
}), }),
view: new ol.View({ view: new ol.View({
center: [14200000, 4130000], center: [-25860000, 4130000],
rotation: Math.PI / 6, rotation: Math.PI / 6,
zoom: 10 zoom: 10
}) })

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units. This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.
tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline" tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js - https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -29,7 +29,6 @@ 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>

View File

@@ -81,8 +81,6 @@ 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(),
@@ -96,10 +94,6 @@ 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;
}, },

View File

@@ -6,6 +6,6 @@ docs: >
Example of a Sphere Mollweide map with a Graticule component. Example of a Sphere Mollweide map with a Graticule component.
tags: "graticule, Mollweide, projection, proj4js" tags: "graticule, Mollweide, projection, proj4js"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js - https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -3,7 +3,7 @@ layout: example.html
title: Tissot Indicatrix title: Tissot Indicatrix
shortdesc: Draw Tissot's indicatrices on maps. shortdesc: Draw Tissot's indicatrices on maps.
docs: > docs: >
Example of [Tissot indicatrix](http://en.wikipedia.org/wiki/Tissot's_indicatrix) maps. The map on the top is an `EPSG:4326` map. The one on the bottom is `EPSG:3857`. Example of [Tissot indicatrix](http://en.wikipedia.org/wiki/Tissot's_indicatrix)</a> maps. The map on the left is an EPSG:4326 map. The one on the right is EPSG:3857.
tags: "tissot, circle" tags: "tissot, circle"
--- ---
<h4>EPSG:4326</h4> <h4>EPSG:4326</h4>

View File

@@ -22,8 +22,7 @@ var map4326 = new ol.Map({
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'TILED': true
} }
}) })
}), }),
@@ -43,8 +42,7 @@ var map3857 = new ol.Map({
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR', 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'TILED': true
} }
}) })
}), }),

View File

@@ -29,14 +29,13 @@ 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: style style: function(feature) {
// 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({

View File

@@ -6,7 +6,7 @@ docs: >
With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections. With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections.
tags: "wms, single image, proj4js, projection" tags: "wms, single image, proj4js, projection"
resources: resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js - https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://epsg.io/21781-1753.js - https://epsg.io/21781-1753.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -15,7 +15,6 @@ var layers = [
source: new ol.source.ImageWMS({ source: new ol.source.ImageWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'topp:states'}, params: {'LAYERS': 'topp:states'},
ratio: 1,
serverType: 'geoserver' serverType: 'geoserver'
}) })
}) })

View File

@@ -3,7 +3,7 @@ layout: example.html
title: WMS Time title: WMS Time
shortdesc: Example of smooth tile transitions when changing the time dimension of a tiled WMS layer. shortdesc: Example of smooth tile transitions when changing the time dimension of a tiled WMS layer.
docs: > docs: >
Demonstrates smooth reloading of layers when changing the time dimension continuously. Data shown: IEM generated CONUS composite of NWS NEXRAD WSR-88D level III base reflectivity. Demonstrates smooth reloading of layers when changing the time dimension continously. Data shown: IEM generated CONUS composite of NWS NEXRAD WSR-88D level III base reflectivity.
tags: "wms, time, dimensions, transition, nexrad" tags: "wms, time, dimensions, transition, nexrad"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -3,7 +3,7 @@ layout: example.html
title: WMTS Tile Transitions title: WMTS Tile Transitions
shortdesc: Example of smooth tile transitions when changing the dimension of a WMTS layer. shortdesc: Example of smooth tile transitions when changing the dimension of a WMTS layer.
docs: > docs: >
Demonstrates smooth reloading of layers when changing a dimension continuously. The demonstration layer is a global sea-level computation (flooding computation from <a href="http://scalgo.com">SCALGO</a>, underlying data from <a href="http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-database-v4-1">CGIAR-CSI SRTM</a>) where cells that are flooded if the sea-level rises to more than <em>x</em> m are colored blue. The user selects the sea-level dimension using a slider. Demonstrates smooth reloading of layers when changing a dimension continously. The demonstration layer is a global sea-level computation (flooding computation from <a href="http://scalgo.com">SCALGO</a>, underlying data from <a href="http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-database-v4-1">CGIAR-CSI SRTM</a>) where cells that are flooded if the sea-level rises to more than <em>x</em> m are colored blue. The user selects the sea-level dimension using a slider.
tags: "wmts, parameter, transition" tags: "wmts, parameter, transition"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -34,6 +34,6 @@ fetch(capabilitiesUrl).then(function(response) {
}); });
options.tilePixelRatio = tilePixelRatio; options.tilePixelRatio = tilePixelRatio;
map.addLayer(new ol.layer.Tile({ map.addLayer(new ol.layer.Tile({
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options)) source: new ol.source.WMTS(options)
})); }));
}); });

View File

@@ -5,10 +5,10 @@ shortdesc: Demonstrates displaying IGN (France) WMTS layers.
docs: > docs: >
In this example an IGN WMTS layer is displayed. In this example an IGN WMTS layer is displayed.
For more information on IGN's WMTS service see the For more information on IGN's WMTS service see the
[IGN Géoportail API web page](http://api.ign.fr/accueil) <a href="http://professionnels.ign.fr/api-sig">IGN Géoportail API web page
and </a> and
[Descriptif technique des web services du Géoportail](http://www.geoportail.gouv.fr/depot/api/cgu/DT_APIGeoportail.pdf) <a href="http://www.geoportail.gouv.fr/depot/api/cgu/DT_APIGeoportail.pdf">
(french). Descriptif technique des web services du Géoportail</a> (french).
tags: "french, ign, geoportail, wmts" tags: "french, ign, geoportail, wmts"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>

View File

@@ -12,10 +12,8 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
return response.text(); return response.text();
}).then(function(text) { }).then(function(text) {
var result = parser.read(text); var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result, { var options = ol.source.WMTS.optionsFromCapabilities(result,
layer: 'layer-7328', {layer: 'layer-7328', matrixSet: 'EPSG:3857'});
matrixSet: 'EPSG:3857'
});
map = new ol.Map({ map = new ol.Map({
layers: [ layers: [
@@ -25,7 +23,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
}), }),
new ol.layer.Tile({ new ol.layer.Tile({
opacity: 1, opacity: 1,
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options)) source: new ol.source.WMTS(options)
}) })
], ],
target: 'map', target: 'map',

View File

@@ -8,21 +8,6 @@ var olx;
/* typedefs for object literals provided by applications */ /* typedefs for object literals provided by applications */
/**
* @typedef {{unique: (boolean|undefined)}}
*/
olx.CollectionOptions;
/**
* Disallow the same item from being added to the collection twice. Default is
* false.
* @type {boolean|undefined}
* @api
*/
olx.CollectionOptions.prototype.unique;
/** /**
* @typedef {{html: string, * @typedef {{html: string,
* tileRanges: (Object.<string, Array.<ol.TileRange>>|undefined)}} * tileRanges: (Object.<string, Array.<ol.TileRange>>|undefined)}}
@@ -112,14 +97,7 @@ olx.LogoOptions.prototype.src;
* @typedef {{map: (ol.Map|undefined), * @typedef {{map: (ol.Map|undefined),
* maxLines: (number|undefined), * maxLines: (number|undefined),
* strokeStyle: (ol.style.Stroke|undefined), * strokeStyle: (ol.style.Stroke|undefined),
* targetSize: (number|undefined), * targetSize: (number|undefined)}}
* showLabels: (boolean|undefined),
* lonLabelFormatter: (undefined|function(number):string),
* latLabelFormatter: (undefined|function(number):string),
* lonLabelPosition: (number|undefined),
* latLabelPosition: (number|undefined),
* lonLabelStyle: (ol.style.Text|undefined),
* latLabelStyle: (ol.style.Text|undefined)}}
*/ */
olx.GraticuleOptions; olx.GraticuleOptions;
@@ -164,106 +142,6 @@ olx.GraticuleOptions.prototype.strokeStyle;
olx.GraticuleOptions.prototype.targetSize; olx.GraticuleOptions.prototype.targetSize;
/**
* Render a label with the respective latitude/longitude for each graticule
* line. Default is false.
*
* @type {boolean|undefined}
* @api
*/
olx.GraticuleOptions.prototype.showLabels;
/**
* Label formatter for longitudes. This function is called with the longitude as
* argument, and should return a formatted string representing the longitude.
* By default, labels are formatted as degrees, minutes, seconds and hemisphere.
*
* @type {undefined|function(number):string}
* @api
*/
olx.GraticuleOptions.prototype.lonLabelFormatter;
/**
* Label formatter for latitudes. This function is called with the latitude as
* argument, and should return a formatted string representing the latitude.
* By default, labels are formatted as degrees, minutes, seconds and hemisphere.
*
* @type {undefined|function(number):string}
* @api
*/
olx.GraticuleOptions.prototype.latLabelFormatter;
/**
* Longitude label position in fractions (0..1) of view extent. 0 means at the
* bottom of the viewport, 1 means at the top. Default is 0.
* @type {number|undefined}
* @api
*/
olx.GraticuleOptions.prototype.lonLabelPosition;
/**
* Latitude label position in fractions (0..1) of view extent. 0 means at the
* left of the viewport, 1 means at the right. Default is 1.
* @type {number|undefined}
* @api
*/
olx.GraticuleOptions.prototype.latLabelPosition;
/**
* Longitude label text style. The default is
* ```js
* new ol.style.Text({
* font: '12px Calibri,sans-serif',
* textBaseline: 'bottom',
* fill: new ol.style.Fill({
* color: 'rgba(0,0,0,1)'
* }),
* stroke: new ol.style.Stroke({
* color: 'rgba(255,255,255,1)',
* width: 3
* })
* });
* ```
* Note that the default's `textBaseline` configuration will not work well for
* `lonLabelPosition` configurations that position labels close to the top of
* the viewport.
*
* @type {ol.style.Text|undefined}
* @api
*/
olx.GraticuleOptions.prototype.lonLabelStyle;
/**
* Latitude label text style. The default is
* ```js
* new ol.style.Text({
* font: '12px Calibri,sans-serif',
* textAlign: 'end',
* fill: new ol.style.Fill({
* color: 'rgba(0,0,0,1)'
* }),
* stroke: new ol.style.Stroke({
* color: 'rgba(255,255,255,1)',
* width: 3
* })
* });
* ```
* Note that the default's `textAlign` configuration will not work well for
* `latLabelPosition` configurations that position labels close to the left of
* the viewport.
*
* @type {ol.style.Text|undefined}
* @api
*/
olx.GraticuleOptions.prototype.latLabelStyle;
/** /**
* Object literal with config options for interactions. * Object literal with config options for interactions.
* @typedef {{handleEvent: function(ol.MapBrowserEvent):boolean}} * @typedef {{handleEvent: function(ol.MapBrowserEvent):boolean}}
@@ -292,7 +170,6 @@ 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),
@@ -386,17 +263,6 @@ 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}
@@ -680,8 +546,7 @@ 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. If this is `undefined`, * the `{number}` resolution at the passed coordinate.
* 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
*/ */
@@ -1994,9 +1859,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,*>,number)} * (Array.<number>|Array.<Array.<number>>),Object.<string, *>)}
* @api * @api
*/ */
olx.format.MVTOptions.prototype.featureClass; olx.format.MVTOptions.prototype.featureClass;
@@ -2053,11 +1918,7 @@ olx.format.PolylineOptions.prototype.geometryLayout;
/** /**
* @typedef {{ * @typedef {{defaultDataProjection: ol.ProjectionLike}}
* defaultDataProjection: ol.ProjectionLike,
* layerName: (string|undefined),
* layers: (Array.<string>|undefined)
* }}
*/ */
olx.format.TopoJSONOptions; olx.format.TopoJSONOptions;
@@ -2070,38 +1931,6 @@ 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)}}
*/ */
@@ -2455,10 +2284,8 @@ olx.format.WFSWriteGetFeatureOptions.prototype.resultType;
* featureType: string, * featureType: string,
* srsName: (string|undefined), * srsName: (string|undefined),
* handle: (string|undefined), * handle: (string|undefined),
* hasZ: (boolean|undefined),
* nativeElements: Array.<Object>, * nativeElements: Array.<Object>,
* gmlOptions: (olx.format.GMLOptions|undefined), * gmlOptions: (olx.format.GMLOptions|undefined)}}
* version: (string|undefined)}}
*/ */
olx.format.WFSWriteTransactionOptions; olx.format.WFSWriteTransactionOptions;
@@ -2504,15 +2331,6 @@ olx.format.WFSWriteTransactionOptions.prototype.srsName;
olx.format.WFSWriteTransactionOptions.prototype.handle; olx.format.WFSWriteTransactionOptions.prototype.handle;
/**
* Must be set to true if the transaction is for a 3D layer. This will allow
* the Z coordinate to be included in the transaction.
* @type {boolean|undefined}
* @api
*/
olx.format.WFSWriteTransactionOptions.prototype.hasZ;
/** /**
* Native elements. Currently not supported. * Native elements. Currently not supported.
* @type {Array.<Object>} * @type {Array.<Object>}
@@ -2529,15 +2347,6 @@ olx.format.WFSWriteTransactionOptions.prototype.nativeElements;
olx.format.WFSWriteTransactionOptions.prototype.gmlOptions; olx.format.WFSWriteTransactionOptions.prototype.gmlOptions;
/**
* WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`.
* Default is `1.1.0`.
* @type {string|undefined}
* @api
*/
olx.format.WFSWriteTransactionOptions.prototype.version;
/** /**
* @typedef {{splitCollection: (boolean|undefined)}} * @typedef {{splitCollection: (boolean|undefined)}}
*/ */
@@ -2579,9 +2388,7 @@ olx.interaction;
/** /**
* Interactions for the map. Default is `true` for all options. * Interactions for the map. Default is `true` for all options.
* @typedef {{ * @typedef {{altShiftDragRotate: (boolean|undefined),
* altShiftDragRotate: (boolean|undefined),
* constrainResolution: (boolean|undefined),
* doubleClickZoom: (boolean|undefined), * doubleClickZoom: (boolean|undefined),
* keyboard: (boolean|undefined), * keyboard: (boolean|undefined),
* mouseWheelZoom: (boolean|undefined), * mouseWheelZoom: (boolean|undefined),
@@ -2590,8 +2397,7 @@ olx.interaction;
* pinchRotate: (boolean|undefined), * pinchRotate: (boolean|undefined),
* pinchZoom: (boolean|undefined), * pinchZoom: (boolean|undefined),
* zoomDelta: (number|undefined), * zoomDelta: (number|undefined),
* zoomDuration: (number|undefined) * zoomDuration: (number|undefined)}}
* }}
*/ */
olx.interaction.DefaultsOptions; olx.interaction.DefaultsOptions;
@@ -2604,15 +2410,6 @@ olx.interaction.DefaultsOptions;
olx.interaction.DefaultsOptions.prototype.altShiftDragRotate; olx.interaction.DefaultsOptions.prototype.altShiftDragRotate;
/**
* Zoom to the closest integer zoom level after the wheel/trackpad or
* pinch gesture ends. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.interaction.DefaultsOptions.prototype.constrainResolution;
/** /**
* Whether double click zoom is desired. Default is `true`. * Whether double click zoom is desired. Default is `true`.
* @type {boolean|undefined} * @type {boolean|undefined}
@@ -2743,7 +2540,6 @@ olx.interaction.DragAndDropOptions.prototype.target;
/** /**
* @typedef {{className: (string|undefined), * @typedef {{className: (string|undefined),
* condition: (ol.EventsConditionType|undefined), * condition: (ol.EventsConditionType|undefined),
* minArea: (number|undefined),
* boxEndCondition: (ol.DragBoxEndConditionType|undefined)}} * boxEndCondition: (ol.DragBoxEndConditionType|undefined)}}
*/ */
olx.interaction.DragBoxOptions; olx.interaction.DragBoxOptions;
@@ -2767,19 +2563,19 @@ olx.interaction.DragBoxOptions.prototype.className;
olx.interaction.DragBoxOptions.prototype.condition; olx.interaction.DragBoxOptions.prototype.condition;
/**
* The minimum area of the box in pixel, this value is used by the default
* `boxEndCondition` function. Default is `64`.
* @type {number|undefined}
* @api
*/
olx.interaction.DragBoxOptions.prototype.minArea;
/** /**
* A function that takes a {@link ol.MapBrowserEvent} and two * A function that takes a {@link ol.MapBrowserEvent} and two
* {@link ol.Pixel}s to indicate whether a `boxend` event should be fired. * {@link ol.Pixel}s to indicate whether a boxend event should be fired.
* Default is `true` if the area of the box is bigger than the `minArea` option. * Default is:
* ```js
* function(mapBrowserEvent,
* startPixel, endPixel) {
* var width = endPixel[0] - startPixel[0];
* var height = endPixel[1] - startPixel[1];
* return width * width + height * height >=
* ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED;
* }
* ```
* @type {ol.DragBoxEndConditionType|undefined} * @type {ol.DragBoxEndConditionType|undefined}
* @api * @api
*/ */
@@ -3071,7 +2867,7 @@ olx.interaction.DrawOptions.prototype.wrapX;
olx.interaction.ExtentOptions; olx.interaction.ExtentOptions;
/** /**
* Initial extent. Defaults to no initial extent * Initial extent. Defaults to no inital extent
* @type {ol.Extent|undefined} * @type {ol.Extent|undefined}
* @api * @api
*/ */
@@ -3136,7 +2932,7 @@ olx.interaction.TranslateOptions.prototype.layers;
/** /**
* Hit-detection tolerance. Pixels inside the radius around the given position * Hit-detection tolerance. Pixels inside the radius around the given position
* will be checked for features. This only works for the canvas renderer and * will be checked for features. This only works for the canvas renderer and
* not for WebGL. Default is `0`. * not for WebGL.
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */
@@ -3213,15 +3009,12 @@ olx.interaction.KeyboardZoomOptions.prototype.delta;
/** /**
* @typedef {{ * @typedef {{condition: (ol.EventsConditionType|undefined),
* 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;
@@ -3248,16 +3041,6 @@ 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`.
@@ -3293,8 +3076,7 @@ olx.interaction.ModifyOptions.prototype.wrapX;
/** /**
* @typedef {{constrainResolution: (boolean|undefined), * @typedef {{duration: (number|undefined),
* duration: (number|undefined),
* timeout: (number|undefined), * timeout: (number|undefined),
* useAnchor: (boolean|undefined)}} * useAnchor: (boolean|undefined)}}
*/ */
@@ -3317,16 +3099,6 @@ olx.interaction.MouseWheelZoomOptions.prototype.duration;
olx.interaction.MouseWheelZoomOptions.prototype.timeout; olx.interaction.MouseWheelZoomOptions.prototype.timeout;
/**
* When using a trackpad or magic mouse, zoom to the closest integer zoom level
* after the scroll gesture ends.
* Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.interaction.MouseWheelZoomOptions.prototype.constrainResolution;
/** /**
* Enable zooming using the mouse's location as the anchor. Default is `true`. * Enable zooming using the mouse's location as the anchor. Default is `true`.
* When set to false, zooming in and out will zoom to the center of the screen * When set to false, zooming in and out will zoom to the center of the screen
@@ -3361,10 +3133,7 @@ olx.interaction.PinchRotateOptions.prototype.threshold;
/** /**
* @typedef {{ * @typedef {{duration: (number|undefined)}}
* duration: (number|undefined),
* constrainResolution: (boolean|undefined)
* }}
*/ */
olx.interaction.PinchZoomOptions; olx.interaction.PinchZoomOptions;
@@ -3570,7 +3339,7 @@ olx.interaction.SelectOptions.prototype.wrapX;
/** /**
* Hit-detection tolerance. Pixels inside the radius around the given position * Hit-detection tolerance. Pixels inside the radius around the given position
* will be checked for features. This only works for the canvas renderer and * will be checked for features. This only works for the canvas renderer and
* not for WebGL. Default is `0`. * not for WebGL.
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */
@@ -4112,7 +3881,7 @@ olx.layer.TileOptions.prototype.useInterimTilesOnError;
/** /**
* @typedef {{renderOrder: (ol.RenderOrderFunction|null|undefined), * @typedef {{renderOrder: (function(ol.Feature, ol.Feature):number|null|undefined),
* minResolution: (number|undefined), * minResolution: (number|undefined),
* maxResolution: (number|undefined), * maxResolution: (number|undefined),
* opacity: (number|undefined), * opacity: (number|undefined),
@@ -4131,7 +3900,7 @@ olx.layer.VectorOptions;
* Render order. Function to be used when sorting features before rendering. By * Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created. Use `null` to * default features are drawn in the order that they are created. Use `null` to
* avoid the sort, but get an undefined draw order. * avoid the sort, but get an undefined draw order.
* @type {ol.RenderOrderFunction|null|undefined} * @type {function(ol.Feature, ol.Feature):number|null|undefined}
* @api * @api
*/ */
olx.layer.VectorOptions.prototype.renderOrder; olx.layer.VectorOptions.prototype.renderOrder;
@@ -4246,7 +4015,7 @@ olx.layer.VectorOptions.prototype.visible;
* preload: (number|undefined), * preload: (number|undefined),
* renderBuffer: (number|undefined), * renderBuffer: (number|undefined),
* renderMode: (ol.layer.VectorTileRenderType|string|undefined), * renderMode: (ol.layer.VectorTileRenderType|string|undefined),
* renderOrder: (ol.RenderOrderFunction|undefined), * renderOrder: (function(ol.Feature, ol.Feature):number|undefined),
* source: (ol.source.VectorTile|undefined), * source: (ol.source.VectorTile|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined), * style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* updateWhileAnimating: (boolean|undefined), * updateWhileAnimating: (boolean|undefined),
@@ -4289,7 +4058,7 @@ olx.layer.VectorTileOptions.prototype.renderMode;
/** /**
* Render order. Function to be used when sorting features before rendering. By * Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created. * default features are drawn in the order that they are created.
* @type {ol.RenderOrderFunction|undefined} * @type {function(ol.Feature, ol.Feature):number|undefined}
* @api * @api
*/ */
olx.layer.VectorTileOptions.prototype.renderOrder; olx.layer.VectorTileOptions.prototype.renderOrder;
@@ -4926,7 +4695,7 @@ olx.source.VectorTileOptions.prototype.state;
/** /**
* Class used to instantiate vector tiles. Default is {@link ol.VectorTile}. * Class used to instantiate image 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}
@@ -5737,17 +5506,14 @@ olx.source.ImageWMSOptions.prototype.url;
/** /**
* @typedef {{ * @typedef {{cacheSize: (number|undefined),
* cacheSize: (number|undefined),
* layer: string, * layer: string,
* minZoom: (number|undefined), * minZoom: (number|undefined),
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* opaque: (boolean|undefined), * opaque: (boolean|undefined),
* reprojectionErrorThreshold: (number|undefined), * reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined), * url: (string|undefined)}}
* wrapX: (boolean|undefined)
* }}
*/ */
olx.source.StamenOptions; olx.source.StamenOptions;
@@ -5821,14 +5587,6 @@ olx.source.StamenOptions.prototype.tileLoadFunction;
olx.source.StamenOptions.prototype.url; olx.source.StamenOptions.prototype.url;
/**
* Whether to wrap the world horizontally. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.source.StamenOptions.prototype.wrapX;
/** /**
* @typedef {{attributions: (ol.AttributionLike|undefined), * @typedef {{attributions: (ol.AttributionLike|undefined),
* crossOrigin: (null|string|undefined), * crossOrigin: (null|string|undefined),
@@ -6053,9 +5811,8 @@ 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|undefined), * url: string,
* wrapX: (boolean|undefined)}} * wrapX: (boolean|undefined)}}
*/ */
olx.source.TileJSONOptions; olx.source.TileJSONOptions;
@@ -6109,15 +5866,6 @@ 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
@@ -6132,8 +5880,8 @@ olx.source.TileJSONOptions.prototype.tileLoadFunction;
/** /**
* URL to the TileJSON file. If not provided, `tileJSON` must be configured. * URL to the TileJSON file.
* @type {string|undefined} * @type {string}
* @api * @api
*/ */
olx.source.TileJSONOptions.prototype.url; olx.source.TileJSONOptions.prototype.url;
@@ -7011,13 +6759,7 @@ olx.source.ZoomifyOptions.prototype.reprojectionErrorThreshold;
/** /**
* URL template or base URL of the Zoomify service. A base URL is the fixed part * Prefix of URL template.
* of the URL, excluding the tile group, z, x, and y folder structure, e.g.
* `http://my.zoomify.info/IMAGE.TIF/`. A URL template must include
* `{TileGroup}`, `{x}`, `{y}`, and `{z}` placeholders, e.g.
* `http://my.zoomify.info/IMAGE.TIF/{TileGroup}/{z}-{x}-{y}.jpg`.
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
* used instead of defining each one separately in the `urls` option.
* @type {!string} * @type {!string}
* @api * @api
*/ */
@@ -7238,7 +6980,7 @@ olx.style.IconOptions.prototype.opacity;
/** /**
* Scale. Default is `1`. * Scale.
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */
@@ -7296,7 +7038,7 @@ olx.style.IconOptions.prototype.imgSize;
/** /**
* Image source URI. * Image source URI.
* @type {string|undefined} * @type {string}
* @api * @api
*/ */
olx.style.IconOptions.prototype.src; olx.style.IconOptions.prototype.src;
@@ -7345,7 +7087,7 @@ olx.style.RegularShapeOptions.prototype.radius;
/** /**
* Outer radius of a star. * Inner radius of a star.
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */
@@ -7353,7 +7095,7 @@ olx.style.RegularShapeOptions.prototype.radius1;
/** /**
* Inner radius of a star. * Outer radius of a star.
* @type {number|undefined} * @type {number|undefined}
* @api * @api
*/ */
@@ -7921,8 +7663,7 @@ olx.view;
* maxZoom: (number|undefined), * maxZoom: (number|undefined),
* minResolution: (number|undefined), * minResolution: (number|undefined),
* duration: (number|undefined), * duration: (number|undefined),
* easing: (undefined|function(number):number), * easing: (undefined|function(number):number)
* callback: (undefined|function(boolean))
* }} * }}
*/ */
olx.view.FitOptions; olx.view.FitOptions;
@@ -8000,16 +7741,6 @@ olx.view.FitOptions.prototype.duration;
olx.view.FitOptions.prototype.easing; olx.view.FitOptions.prototype.easing;
/**
* Optional function called when the view is in it's final position. The callback will be
* called with `true` if the animation series completed on its own or `false`
* if it was cancelled.
* @type {undefined|function(boolean)}
* @api
*/
olx.view.FitOptions.prototype.callback;
/* typedefs for object literals exposed by the library */ /* typedefs for object literals exposed by the library */

View File

@@ -7,31 +7,25 @@
/** /**
* @constructor * @constructor
*/ */
var Proj4 = function() {}; var proj4 = function() {};
/** /**
* @param {ol.Coordinate} coordinates * @type {function(Array.<number>): Array.<number>}
* @return {ol.Coordinate}
*/ */
Proj4.prototype.forward = function(coordinates) {}; proj4.prototype.forward;
/** /**
* @param {ol.Coordinate} coordinates * @type {function(Array.<number>): Array.<number>}
* @return {ol.Coordinate}
*/ */
Proj4.prototype.inverse = function(coordinates) {}; proj4.prototype.inverse;
/** /**
* @param {string} name * @param {string} name
* @param {(string|Object)=} opt_def * @param {(string|Object)=} opt_def
* @return {undefined|Object.<string, Object.<{axis: string, units: string, to_meter: number}>>} * @return {undefined|Object.<string, Object.<{axis: string, units: string,
* to_meter: number}>>}
*/ */
Proj4.prototype.defs = function(name, opt_def) {}; proj4.defs = function(name, opt_def) {};
/**
* @type {Proj4}
*/
var proj4;

View File

@@ -5,6 +5,7 @@
*/ */
/** /**
* @constructor * @constructor
*/ */

View File

@@ -1,6 +1,6 @@
{ {
"name": "openlayers", "name": "openlayers",
"version": "4.3.0-beta.2", "version": "4.0.0-beta.1",
"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",
@@ -13,7 +13,6 @@
"postinstall": "closure-util update", "postinstall": "closure-util update",
"start": "node tasks/serve.js", "start": "node tasks/serve.js",
"pretest": "eslint tasks test test_rendering src examples", "pretest": "eslint tasks test test_rendering src examples",
"lint-package": "eslint --fix build/package",
"test": "node tasks/test.js", "test": "node tasks/test.js",
"debug-server": "node tasks/serve-lib.js" "debug-server": "node tasks/serve-lib.js"
}, },
@@ -31,49 +30,47 @@
"css/ol.css" "css/ol.css"
], ],
"dependencies": { "dependencies": {
"async": "2.5.0", "async": "2.1.4",
"closure-util": "1.22.0", "browserify": "14.0.0",
"closure-util": "1.17.0",
"derequire": "2.0.6", "derequire": "2.0.6",
"fs-extra": "4.0.0", "fs-extra": "2.0.0",
"glob": "7.1.1", "glob": "7.1.1",
"handlebars": "4.0.10", "handlebars": "4.0.6",
"jsdoc": "3.5.3", "jsdoc": "3.4.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.0",
"nomnom": "1.8.1", "nomnom": "1.8.1",
"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.45.0",
"rollup-plugin-cleanup": "^1.0.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"temp": "0.8.3", "temp": "0.8.3",
"@mapbox/vector-tile": "1.3.0", "vector-tile": "1.3.0",
"walk": "2.3.9" "walk": "2.3.9"
}, },
"devDependencies": { "devDependencies": {
"clean-css-cli": "4.1.6", "clean-css-cli": "4.0.0",
"coveralls": "2.13.1", "coveralls": "2.11.16",
"debounce": "^1.0.0", "debounce": "^1.0.0",
"eslint": "4.2.0", "eslint": "3.15.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",
"esprima": "2.x",
"expect.js": "0.3.1", "expect.js": "0.3.1",
"gaze": "^1.0.0", "gaze": "^1.0.0",
"istanbul": "0.4.5", "istanbul": "0.4.5",
"jquery": "3.2.1", "jquery": "3.1.1",
"jscodeshift": "^0.3.30", "jscodeshift": "^0.3.30",
"mocha": "3.4.2", "mocha": "3.2.0",
"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.3.17",
"resemblejs": "2.2.4", "resemblejs": "2.2.3",
"serve-files": "1.0.1", "serve-files": "1.0.1",
"sinon": "2.3.8", "sinon": "1.17.7",
"slimerjs": "0.10.3" "slimerjs": "0.906.2"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "openlayers", "extends": "openlayers",
@@ -92,53 +89,43 @@
"openlayers-internal" "openlayers-internal"
], ],
"rules": { "rules": {
"no-console": [
2,
{
"allow": [
"assert",
"warn"
]
}
],
"no-constant-condition": 0, "no-constant-condition": 0,
"openlayers-internal/enum": 2, "openlayers-internal/enum": 2,
"openlayers-internal/no-duplicate-requires": 2, "openlayers-internal/no-duplicate-requires": 2,
"openlayers-internal/no-missing-requires": 2, "openlayers-internal/no-missing-requires": 1,
"openlayers-internal/no-unused-requires": 2, "openlayers-internal/no-unused-requires": 2,
"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": [
{ {
"module": "rbush" "module": "rbush",
"browserify": true
}, },
{ {
"module": "pbf", "module": "pbf",
"name": "PBF" "browserify": true
}, },
{ {
"module": "pixelworks", "module": "pixelworks",
"import": "Processor" "browserify": true
}, },
{ {
"module": "@mapbox/vector-tile", "module": "vector-tile",
"name": "vectortile", "name": "vectortile",
"import": "VectorTile" "browserify": true
} }
] ]
} }

View File

@@ -1,5 +0,0 @@
{
"parserOptions": {
"sourceType": "module"
}
}

View File

@@ -1,6 +1,6 @@
{ {
"name": "ol", "name": "ol",
"version": "4.3.0-beta.2", "version": "3.21.0-beta.17",
"description": "OpenLayers as ES2015 modules", "description": "OpenLayers as ES2015 modules",
"main": "index.js", "main": "index.js",
"module": "index.js", "module": "index.js",
@@ -9,16 +9,6 @@
"pbf": "3.0.5", "pbf": "3.0.5",
"pixelworks": "1.1.0", "pixelworks": "1.1.0",
"rbush": "2.0.1", "rbush": "2.0.1",
"@mapbox/vector-tile": "1.3.0" "vector-tile": "1.3.0"
},
"browserify": {
"transform": [
[
"babelify",
{
"plugins": ["transform-es2015-modules-commonjs"]
}
]
]
} }
} }

View File

@@ -2,6 +2,8 @@
OpenLayers as ES2015 modules. OpenLayers as ES2015 modules.
**Note: This package is in beta and the API is subject to change before a final stable release.**
## Usage ## Usage
Add the `ol` package as a dependency to your project. Add the `ol` package as a dependency to your project.
@@ -49,4 +51,5 @@ Utility functions are available as properties of the default export from utility
## Caveats ## Caveats
* Module identifiers and the structure of the exports are subject to change while this package is in beta.
* The WebGL renderer is not available in this package. * The WebGL renderer is not available in this package.

View File

@@ -13,12 +13,11 @@ goog.require('ol');
*/ */
ol.AssertionError = function(code) { ol.AssertionError = function(code) {
var path = ol.VERSION ? ol.VERSION.split('-')[0] : 'latest';
/** /**
* @type {string} * @type {string}
*/ */
this.message = 'Assertion failed. See https://openlayers.org/en/' + path + this.message = 'Assertion failed. See ' +
(ol.VERSION ? 'https://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') +
'/doc/errors/#' + code + ' for details.'; '/doc/errors/#' + code + ' for details.';
/** /**

View File

@@ -6,7 +6,6 @@
goog.provide('ol.Collection'); goog.provide('ol.Collection');
goog.require('ol'); goog.require('ol');
goog.require('ol.AssertionError');
goog.require('ol.CollectionEventType'); goog.require('ol.CollectionEventType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
@@ -24,34 +23,19 @@ goog.require('ol.events.Event');
* @extends {ol.Object} * @extends {ol.Object}
* @fires ol.Collection.Event * @fires ol.Collection.Event
* @param {!Array.<T>=} opt_array Array. * @param {!Array.<T>=} opt_array Array.
* @param {olx.CollectionOptions=} opt_options Collection options.
* @template T * @template T
* @api * @api
*/ */
ol.Collection = function(opt_array, opt_options) { ol.Collection = function(opt_array) {
ol.Object.call(this); ol.Object.call(this);
var options = opt_options || {};
/**
* @private
* @type {boolean}
*/
this.unique_ = !!options.unique;
/** /**
* @private * @private
* @type {!Array.<T>} * @type {!Array.<T>}
*/ */
this.array_ = opt_array ? opt_array : []; this.array_ = opt_array ? opt_array : [];
if (this.unique_) {
for (var i = 0, ii = this.array_.length; i < ii; ++i) {
this.assertUnique_(this.array_[i], i);
}
}
this.updateLength_(); this.updateLength_();
}; };
@@ -141,9 +125,6 @@ ol.Collection.prototype.getLength = function() {
* @api * @api
*/ */
ol.Collection.prototype.insertAt = function(index, elem) { ol.Collection.prototype.insertAt = function(index, elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
this.array_.splice(index, 0, elem); this.array_.splice(index, 0, elem);
this.updateLength_(); this.updateLength_();
this.dispatchEvent( this.dispatchEvent(
@@ -169,9 +150,6 @@ ol.Collection.prototype.pop = function() {
* @api * @api
*/ */
ol.Collection.prototype.push = function(elem) { ol.Collection.prototype.push = function(elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
var n = this.getLength(); var n = this.getLength();
this.insertAt(n, elem); this.insertAt(n, elem);
return this.getLength(); return this.getLength();
@@ -222,9 +200,6 @@ ol.Collection.prototype.removeAt = function(index) {
ol.Collection.prototype.setAt = function(index, elem) { ol.Collection.prototype.setAt = function(index, elem) {
var n = this.getLength(); var n = this.getLength();
if (index < n) { if (index < n) {
if (this.unique_) {
this.assertUnique_(elem, index);
}
var prev = this.array_[index]; var prev = this.array_[index];
this.array_[index] = elem; this.array_[index] = elem;
this.dispatchEvent( this.dispatchEvent(
@@ -249,20 +224,6 @@ ol.Collection.prototype.updateLength_ = function() {
}; };
/**
* @private
* @param {T} elem Element.
* @param {number=} opt_except Optional index to ignore.
*/
ol.Collection.prototype.assertUnique_ = function(elem, opt_except) {
for (var i = 0, ii = this.array_.length; i < ii; ++i) {
if (this.array_[i] === elem && i !== opt_except) {
throw new ol.AssertionError(58);
}
}
};
/** /**
* @enum {string} * @enum {string}
* @private * @private

29
src/ol/constraints.js Normal file
View File

@@ -0,0 +1,29 @@
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;
};

View File

@@ -12,7 +12,7 @@ goog.require('ol.events.EventType');
* @classdesc * @classdesc
* Provides a button that when clicked fills up the full screen with the map. * Provides a button that when clicked fills up the full screen with the map.
* The full screen source element is by default the element containing the map viewport unless * The full screen source element is by default the element containing the map viewport unless
* overridden by providing the `source` option. In which case, the dom * overriden by providing the `source` option. In which case, the dom
* element introduced using this parameter will be displayed in full screen. * element introduced using this parameter will be displayed in full screen.
* *
* When in full screen mode, a close button is shown to exit full screen mode. * When in full screen mode, a close button is shown to exit full screen mode.

View File

@@ -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(options.projection); this.setProjection(ol.proj.get(options.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.ProjectionLike} projection The projection to report mouse * @param {ol.proj.Projection} 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, ol.proj.get(projection)); this.set(ol.control.MousePosition.Property_.PROJECTION, projection);
}; };

View File

@@ -148,44 +148,6 @@ ol.control.OverviewMap = function(opt_options) {
render: render, render: render,
target: options.target target: options.target
}); });
/* Interactive map */
var scope = this;
var overlay = this.boxOverlay_;
var overlayBox = this.boxOverlay_.getElement();
/* Functions definition */
var computeDesiredMousePosition = function(mousePosition) {
return {
clientX: mousePosition.clientX - (overlayBox.offsetWidth / 2),
clientY: mousePosition.clientY + (overlayBox.offsetHeight / 2)
};
};
var move = function(event) {
var coordinates = ovmap.getEventCoordinate(computeDesiredMousePosition(event));
overlay.setPosition(coordinates);
};
var endMoving = function(event) {
var coordinates = ovmap.getEventCoordinate(event);
scope.getMap().getView().setCenter(coordinates);
window.removeEventListener('mousemove', move);
window.removeEventListener('mouseup', endMoving);
};
/* Binding */
overlayBox.addEventListener('mousedown', function() {
window.addEventListener('mousemove', move);
window.addEventListener('mouseup', endMoving);
});
}; };
ol.inherits(ol.control.OverviewMap, ol.control.Control); ol.inherits(ol.control.OverviewMap, ol.control.Control);

View File

@@ -120,8 +120,16 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
// upon it // upon it
return; return;
} }
if (view.getRotation() !== undefined) { var currentRotation = view.getRotation();
if (currentRotation !== undefined) {
if (this.duration_ > 0) { if (this.duration_ > 0) {
currentRotation = currentRotation % (2 * Math.PI);
if (currentRotation < -Math.PI) {
currentRotation += 2 * Math.PI;
}
if (currentRotation > Math.PI) {
currentRotation -= 2 * Math.PI;
}
view.animate({ view.animate({
rotation: 0, rotation: 0,
duration: this.duration_, duration: this.duration_,

View File

@@ -203,10 +203,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
pointResolution /= 1852; pointResolution /= 1852;
suffix = 'nm'; suffix = 'nm';
} else if (units == ol.control.ScaleLineUnits.METRIC) { } else if (units == ol.control.ScaleLineUnits.METRIC) {
if (nominalCount < 0.001) { if (nominalCount < 1) {
suffix = 'μm';
pointResolution *= 1000000;
} else if (nominalCount < 1) {
suffix = 'mm'; suffix = 'mm';
pointResolution *= 1000; pointResolution *= 1000;
} else if (nominalCount < 1000) { } else if (nominalCount < 1000) {

View File

@@ -26,37 +26,6 @@ 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
@@ -132,36 +101,21 @@ ol.coordinate.createStringXY = function(opt_fractionDigits) {
/** /**
* @param {string} hemispheres Hemispheres. * @private
* @param {number} degrees Degrees. * @param {number} degrees Degrees.
* @param {string} hemispheres Hemispheres.
* @param {number=} opt_fractionDigits The number of digits to include * @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`. * after the decimal point. Default is `0`.
* @return {string} String. * @return {string} String.
*/ */
ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionDigits) { ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fractionDigits) {
var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180; var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180;
var x = Math.abs(3600 * normalizedDegrees); var x = Math.abs(3600 * normalizedDegrees);
var dflPrecision = opt_fractionDigits || 0; var dflPrecision = opt_fractionDigits || 0;
var precision = Math.pow(10, dflPrecision); return Math.floor(x / 3600) + '\u00b0 ' +
ol.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
var deg = Math.floor(x / 3600); ol.string.padNumber((x % 60), 2, dflPrecision) + '\u2033 ' +
var min = Math.floor((x - deg * 3600) / 60); hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
var sec = x - (deg * 3600) - (min * 60);
sec = Math.ceil(sec * precision) / precision;
if (sec >= 60) {
sec = 0;
min += 1;
}
if (min >= 60) {
min = 0;
deg += 1;
}
return deg + '\u00b0 ' + ol.string.padNumber(min, 2) + '\u2032 ' +
ol.string.padNumber(sec, 2, dflPrecision) + '\u2033' +
(normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));
}; };
@@ -343,8 +297,8 @@ ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) {
*/ */
ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) { ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
if (coordinate) { if (coordinate) {
return ol.coordinate.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' + return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS', opt_fractionDigits) + ' ' +
ol.coordinate.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits); ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW', opt_fractionDigits);
} else { } else {
return ''; return '';
} }

View File

@@ -10,14 +10,6 @@ goog.provide('ol.css');
ol.css.CLASS_HIDDEN = 'ol-hidden'; ol.css.CLASS_HIDDEN = 'ol-hidden';
/**
* The CSS class that we'll give the DOM elements to have them selectable.
*
* @const
* @type {string}
*/
ol.css.CLASS_SELECTABLE = 'ol-selectable';
/** /**
* The CSS class that we'll give the DOM elements to have them unselectable. * The CSS class that we'll give the DOM elements to have them unselectable.
* *

View File

@@ -28,7 +28,7 @@ ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
*/ */
ol.dom.outerWidth = function(element) { ol.dom.outerWidth = function(element) {
var width = element.offsetWidth; var width = element.offsetWidth;
var style = getComputedStyle(element); var style = element.currentStyle || getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10); width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
return width; return width;
@@ -44,7 +44,7 @@ ol.dom.outerWidth = function(element) {
*/ */
ol.dom.outerHeight = function(element) { ol.dom.outerHeight = function(element) {
var height = element.offsetHeight; var height = element.offsetHeight;
var style = getComputedStyle(element); var style = element.currentStyle || getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
return height; return height;

View File

@@ -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;
}; };
/** /**

View File

@@ -26,7 +26,7 @@ ol.events.EventType = {
MOUSEOUT: 'mouseout', MOUSEOUT: 'mouseout',
MOUSEUP: 'mouseup', MOUSEUP: 'mouseup',
MOUSEWHEEL: 'mousewheel', MOUSEWHEEL: 'mousewheel',
MSPOINTERDOWN: 'MSPointerDown', MSPOINTERDOWN: 'mspointerdown',
RESIZE: 'resize', RESIZE: 'resize',
TOUCHSTART: 'touchstart', TOUCHSTART: 'touchstart',
TOUCHMOVE: 'touchmove', TOUCHMOVE: 'touchmove',

View File

@@ -426,10 +426,8 @@ 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;

View File

@@ -64,12 +64,6 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
failure.call(this); failure.call(this);
} }
}.bind(this); }.bind(this);
/**
* @private
*/
xhr.onerror = function() {
failure.call(this);
}.bind(this);
xhr.send(); xhr.send();
}); });
}; };

View File

@@ -121,11 +121,9 @@ 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];
var containsHole = ol.extent.containsExtent( if (ol.extent.containsExtent(new ol.geom.LinearRing(
new ol.geom.LinearRing(outerRing).getExtent(), 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;

View File

@@ -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(
geometry, write ? geometry.slice() : geometry,
dataProjection, write ? featureProjection : dataProjection,
featureProjection); write ? dataProjection : featureProjection);
} }
} else { } else {
transformed = geometry; transformed = geometry;
} }
if (write && opt_options && opt_options.decimals !== undefined) { if (write && opt_options && opt_options.decimals) {
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,10 +203,11 @@ ol.format.Feature.transformWithOptions = function(
} }
return coordinates; return coordinates;
}; };
if (transformed === geometry) { if (Array.isArray(transformed)) {
transformed = transformed.clone(); transform(transformed);
} } else {
transformed.applyTransform(transform); transformed.applyTransform(transform);
} }
}
return transformed; return transformed;
}; };

View File

@@ -2,7 +2,6 @@ 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');
@@ -231,17 +230,3 @@ ol.format.filter.like = function(propertyName, pattern,
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);
};

View File

@@ -1,33 +0,0 @@
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);

View File

@@ -329,8 +329,7 @@ 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. If feature at source has an id, it will be used * FeatureCollection source.
* 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.

View File

@@ -2,11 +2,8 @@ goog.provide('ol.format.GML2');
goog.require('ol'); goog.require('ol');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.GMLBase'); goog.require('ol.format.GMLBase');
goog.require('ol.format.XSD'); goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.xml'); goog.require('ol.xml');
@@ -60,6 +57,7 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]); var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName']; var containerSrs = context['srsName'];
var containerDimension = node.parentNode.getAttribute('srsDimension');
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (containerSrs) { if (containerSrs) {
var proj = ol.proj.get(containerSrs); var proj = ol.proj.get(containerSrs);
@@ -67,14 +65,24 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
axisOrientation = proj.getAxisOrientation(); axisOrientation = proj.getAxisOrientation();
} }
} }
var coordsGroups = s.trim().split(/\s+/); var coords = s.split(/[\s,]+/);
// The "dimension" attribute is from the GML 3.0.1 spec.
var dim = 2;
if (node.getAttribute('srsDimension')) {
dim = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('srsDimension'));
} else if (node.getAttribute('dimension')) {
dim = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('dimension'));
} else if (containerDimension) {
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
}
var x, y, z; var x, y, z;
var flatCoordinates = []; var flatCoordinates = [];
for (var i = 0, ii = coordsGroups.length; i < ii; i++) { for (var i = 0, ii = coords.length; i < ii; i += dim) {
var coords = coordsGroups[i].split(/,+/); x = parseFloat(coords[i]);
x = parseFloat(coords[0]); y = parseFloat(coords[i + 1]);
y = parseFloat(coords[1]); z = (dim === 3) ? parseFloat(coords[i + 2]) : 0;
z = (coords.length === 3) ? parseFloat(coords[2]) : 0;
if (axisOrientation.substr(0, 2) === 'en') { if (axisOrientation.substr(0, 2) === 'en') {
flatCoordinates.push(x, y, z); flatCoordinates.push(x, y, z);
} else { } else {
@@ -196,583 +204,3 @@ ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_) 'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_)
} }
}; };
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface'];
var surface = context['surface'];
var multiCurve = context['multiCurve'];
var nodeName;
if (!Array.isArray(value)) {
nodeName = /** @type {ol.geom.Geometry} */ (value).getType();
if (nodeName === 'MultiPolygon' && multiSurface === true) {
nodeName = 'MultiSurface';
} else if (nodeName === 'Polygon' && surface === true) {
nodeName = 'Surface';
} else if (nodeName === 'MultiLineString' && multiCurve === true) {
nodeName = 'MultiCurve';
}
} else {
nodeName = 'Envelope';
}
return ol.xml.createElementNS('http://www.opengis.net/gml',
nodeName);
};
/**
* @param {Node} node Node.
* @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
var fid = feature.getId();
if (fid) {
node.setAttribute('fid', fid);
}
var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var featureNS = context['featureNS'];
var geometryName = feature.getGeometryName();
if (!context.serializers) {
context.serializers = {};
context.serializers[featureNS] = {};
}
var properties = feature.getProperties();
var keys = [], values = [];
for (var key in properties) {
var value = properties[key];
if (value !== null) {
keys.push(key);
values.push(value);
if (key == geometryName || value instanceof ol.geom.Geometry) {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
this.writeGeometryElement, this);
}
} else {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
ol.format.XSD.writeStringTextNode);
}
}
}
}
var item = ol.obj.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), context.serializers,
ol.xml.makeSimpleNodeFactory(undefined, featureNS),
values,
objectStack, keys);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = ol.obj.assign({}, context);
item.node = node;
var value;
if (Array.isArray(geometry)) {
if (context.dataProjection) {
value = ol.proj.transformExtent(
geometry, context.featureProjection, context.dataProjection);
} else {
value = geometry;
}
} else {
value =
ol.format.Feature.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
}
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), ol.format.GML2.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString} geometry LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) {
node.setAttribute('srsName', srsName);
}
if (node.nodeName === 'LineString' ||
node.nodeName === 'LineStringSegment') {
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
this.writeCoordinates_(coordinates, geometry, objectStack);
} else if (node.nodeName === 'Curve') {
var segments = ol.xml.createElementNS(node.namespaceURI, 'segments');
node.appendChild(segments);
this.writeCurveSegments_(segments,
geometry, objectStack);
}
};
/**
* @param {string} namespaceURI XML namespace.
* @returns {Node} coordinates node.
* @private
*/
ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = ol.xml.createElementNS(namespaceURI, 'coordinates');
coordinates.setAttribute('decimal', '.');
coordinates.setAttribute('cs', ',');
coordinates.setAttribute('ts', ' ');
return coordinates;
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString|ol.geom.LinearRing} value Geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
// only 2d for simple features profile
var points = value.getCoordinates();
var len = points.length;
var parts = new Array(len);
var point;
for (var i = 0; i < len; ++i) {
point = points[i];
parts[i] = this.getCoords_(point, srsName, hasZ);
}
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI,
'LineStringSegment');
node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Polygon} geometry Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
if (node.nodeName !== 'PolygonPatch' && srsName) {
node.setAttribute('srsName', srsName);
}
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') {
var patches = ol.xml.createElementNS(node.namespaceURI, 'patches');
node.appendChild(patches);
this.writeSurfacePatches_(
patches, geometry, objectStack);
}
};
/**
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node} Node.
* @private
*/
ol.format.GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var parentNode = context.node;
var exteriorWritten = context['exteriorWritten'];
if (exteriorWritten === undefined) {
context['exteriorWritten'] = true;
}
return ol.xml.createElementNS(parentNode.namespaceURI,
exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs');
};
/**
* @param {Node} node Node.
* @param {ol.geom.Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.LinearRing} ring LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = ol.xml.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack);
};
/**
* @param {Array.<number>} point Point geometry.
* @param {string=} opt_srsName Optional srsName
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string.
* @private
*/
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
}
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] :
point[1] + ',' + point[0]);
if (opt_hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ',' + z;
}
return coords;
};
/**
* @param {Node} node Node.
* @param {ol.geom.MultiLineString} geometry MultiLineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
var curve = context['curve'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Point} geometry Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
var point = geometry.getCoordinates();
var coord = this.getCoords_(point, srsName, hasZ);
ol.format.XSD.writeStringTextNode(coordinates, coord);
};
/**
* @param {Node} node Node.
* @param {ol.geom.MultiPoint} geometry MultiPoint geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Point} point Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePointMember_ = function(node, point, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child);
this.writePoint_(child, point, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) {
node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack);
}
};
/**
* @param {Node} node Node.
* @param {ol.geom.LinearRing} geometry LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
this.writeCoordinates_(coordinates, geometry, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.MultiPolygon} geometry MultiPolygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
var surface = context['surface'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack);
if (child) {
node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
}
};
/**
* @param {Node} node Node.
* @param {ol.Extent} extent Extent.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), ol.format.GML2.ENVELOPE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
values,
objectStack, keys, this);
};
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'Curve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiCurve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'Point': ol.xml.makeChildAppender(ol.format.GML2.prototype.writePoint_),
'MultiPoint': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiPoint_),
'LineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiLineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'LinearRing': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLinearRing_),
'Polygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Surface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiSurface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeEnvelope)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'outerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_),
'innerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'pointMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writePointMember_)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_),
'curveMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_)
}
};
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var parentNode = objectStack[objectStack.length - 1].node;
return ol.xml.createElementNS('http://www.opengis.net/gml',
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
};
/**
* @const
* @type {Object.<string, string>}
* @private
*/
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember',
'MultiSurface': 'surfaceMember'
};
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'surfaceMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lowerCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'upperCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode)
}
};

View File

@@ -565,7 +565,6 @@ ol.format.GML3.prototype.SEGMENTS_PARSERS_ = {
*/ */
ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) { ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (srsName) { if (srsName) {
@@ -579,11 +578,6 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
} else { } else {
coords = (point[1] + ' ' + point[0]); coords = (point[1] + ' ' + point[0]);
} }
if (hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
ol.format.XSD.writeStringTextNode(node, coords); ol.format.XSD.writeStringTextNode(node, coords);
}; };
@@ -591,25 +585,17 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
/** /**
* @param {Array.<number>} point Point geometry. * @param {Array.<number>} point Point geometry.
* @param {string=} opt_srsName Optional srsName * @param {string=} opt_srsName Optional srsName
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string. * @return {string} The coords string.
* @private * @private
*/ */
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (opt_srsName) { if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation(); axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
} }
var coords = ((axisOrientation.substr(0, 2) === 'en') ? return ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ' ' + point[1] : point[0] + ' ' + point[1] :
point[1] + ' ' + point[0]); point[1] + ' ' + point[0]);
if (opt_hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
return coords;
}; };
@@ -621,7 +607,6 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
*/ */
ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) { ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
// only 2d for simple features profile // only 2d for simple features profile
var points = value.getCoordinates(); var points = value.getCoordinates();
@@ -630,7 +615,7 @@ ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
var point; var point;
for (var i = 0; i < len; ++i) { for (var i = 0; i < len; ++i) {
point = points[i]; point = points[i];
parts[i] = this.getCoords_(point, srsName, hasZ); parts[i] = this.getCoords_(point, srsName);
} }
ol.format.XSD.writeStringTextNode(node, parts.join(' ')); ol.format.XSD.writeStringTextNode(node, parts.join(' '));
}; };
@@ -732,7 +717,6 @@ ol.format.GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_n
*/ */
ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
if (node.nodeName !== 'PolygonPatch' && srsName) { if (node.nodeName !== 'PolygonPatch' && srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
@@ -740,7 +724,7 @@ ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') { if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings(); var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop( ol.xml.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, srsName: srsName},
ol.format.GML3.RING_SERIALIZERS_, ol.format.GML3.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this); rings, objectStack, undefined, this);
@@ -787,14 +771,13 @@ ol.format.GML3.prototype.writeCurveOrLineString_ = function(node, geometry, obje
*/ */
ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
var surface = context['surface']; var surface = context['surface'];
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
var polygons = geometry.getPolygons(); var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface}, ol.xml.pushSerializeAndPop({node: node, srsName: srsName, surface: surface},
ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_, ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this); objectStack, undefined, this);
@@ -811,12 +794,11 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) { objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
var hasZ = context['hasZ'];
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
var points = geometry.getPoints(); var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName}, ol.xml.pushSerializeAndPop({node: node, srsName: srsName},
ol.format.GML3.POINTMEMBER_SERIALIZERS_, ol.format.GML3.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points, ol.xml.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this); objectStack, undefined, this);
@@ -831,14 +813,13 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
*/ */
ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
var curve = context['curve']; var curve = context['curve'];
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
var lines = geometry.getLineStrings(); var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve}, ol.xml.pushSerializeAndPop({node: node, srsName: srsName, curve: curve},
ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_, ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this); objectStack, undefined, this);
@@ -1187,7 +1168,7 @@ ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) { ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom'); var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom');
var context = {node: geom, hasZ: this.hasZ, srsName: this.srsName, var context = {node: geom, srsName: this.srsName,
curve: this.curve_, surface: this.surface_, curve: this.curve_, surface: this.surface_,
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_}; multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
if (opt_options) { if (opt_options) {
@@ -1227,7 +1208,6 @@ ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) {
'xsi:schemaLocation', this.schemaLocation); 'xsi:schemaLocation', this.schemaLocation);
var context = { var context = {
srsName: this.srsName, srsName: this.srsName,
hasZ: this.hasZ,
curve: this.curve_, curve: this.curve_,
surface: this.surface_, surface: this.surface_,
multiSurface: this.multiSurface_, multiSurface: this.multiSurface_,

View File

@@ -285,8 +285,7 @@ ol.format.KML.createStyleDefaults_ = function() {
*/ */
ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = { ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
'fraction': ol.style.IconAnchorUnits.FRACTION, 'fraction': ol.style.IconAnchorUnits.FRACTION,
'pixels': ol.style.IconAnchorUnits.PIXELS, 'pixels': ol.style.IconAnchorUnits.PIXELS
'insetPixels': ol.style.IconAnchorUnits.PIXELS
}; };
@@ -488,7 +487,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 && node.baseURI !== 'about:blank') { if (node.baseURI) {
var url = new URL(s, node.baseURI); var url = new URL(s, node.baseURI);
return url.href; return url.href;
} else { } else {
@@ -505,26 +504,11 @@ ol.format.KML.readURI_ = function(node) {
ol.format.KML.readVec2_ = function(node) { ol.format.KML.readVec2_ = function(node) {
var xunits = node.getAttribute('xunits'); var xunits = node.getAttribute('xunits');
var yunits = node.getAttribute('yunits'); var yunits = node.getAttribute('yunits');
var origin;
if (xunits !== 'insetPixels') {
if (yunits !== 'insetPixels') {
origin = ol.style.IconOrigin.BOTTOM_LEFT;
} else {
origin = ol.style.IconOrigin.TOP_LEFT;
}
} else {
if (yunits !== 'insetPixels') {
origin = ol.style.IconOrigin.BOTTOM_RIGHT;
} else {
origin = ol.style.IconOrigin.TOP_RIGHT;
}
}
return { return {
x: parseFloat(node.getAttribute('x')), x: parseFloat(node.getAttribute('x')),
xunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[xunits], xunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[xunits],
y: parseFloat(node.getAttribute('y')), y: parseFloat(node.getAttribute('y')),
yunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[yunits], yunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[yunits]
origin: origin
}; };
}; };
@@ -549,7 +533,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
@@ -578,14 +562,12 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_; src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_;
} }
var anchor, anchorXUnits, anchorYUnits; var anchor, anchorXUnits, anchorYUnits;
var anchorOrigin = ol.style.IconOrigin.BOTTOM_LEFT;
var hotSpot = /** @type {ol.KMLVec2_|undefined} */ var hotSpot = /** @type {ol.KMLVec2_|undefined} */
(object['hotSpot']); (object['hotSpot']);
if (hotSpot) { if (hotSpot) {
anchor = [hotSpot.x, hotSpot.y]; anchor = [hotSpot.x, hotSpot.y];
anchorXUnits = hotSpot.xunits; anchorXUnits = hotSpot.xunits;
anchorYUnits = hotSpot.yunits; anchorYUnits = hotSpot.yunits;
anchorOrigin = hotSpot.origin;
} else if (src === ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) { } else if (src === ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
anchor = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_; anchor = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_;
anchorXUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_; anchorXUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_;
@@ -634,7 +616,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
var imageStyle = new ol.style.Icon({ var imageStyle = new ol.style.Icon({
anchor: anchor, anchor: anchor,
anchorOrigin: anchorOrigin, anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
anchorXUnits: anchorXUnits, anchorXUnits: anchorXUnits,
anchorYUnits: anchorYUnits, anchorYUnits: anchorYUnits,
crossOrigin: 'anonymous', // FIXME should this be configurable? crossOrigin: 'anonymous', // FIXME should this be configurable?
@@ -1092,13 +1074,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 = /** @type {Object} */ (objectStack[objectStack.length - 1]); var featureObject =
/** @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 +1719,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 && node.baseURI !== 'about:blank') { if (node.baseURI) {
var url = new URL('#' + id, node.baseURI); var url = new URL('#' + id, node.baseURI);
styleUri = url.href; styleUri = url.href;
} else { } else {
@@ -1764,7 +1746,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
return; return;
} }
var styleUri; var styleUri;
if (node.baseURI && node.baseURI !== 'about:blank') { if (node.baseURI) {
var url = new URL('#' + id, node.baseURI); var url = new URL('#' + id, node.baseURI);
styleUri = url.href; styleUri = url.href;
} else { } else {

View File

@@ -3,8 +3,8 @@
goog.provide('ol.format.MVT'); goog.provide('ol.format.MVT');
goog.require('ol'); goog.require('ol');
goog.require('ol.ext.PBF'); goog.require('ol.ext.pbf');
goog.require('ol.ext.vectortile.VectorTile'); goog.require('ol.ext.vectortile');
goog.require('ol.format.Feature'); goog.require('ol.format.Feature');
goog.require('ol.format.FormatType'); goog.require('ol.format.FormatType');
goog.require('ol.geom.GeometryLayout'); goog.require('ol.geom.GeometryLayout');
@@ -44,9 +44,9 @@ 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,*>,number)} * (Array.<number>|Array.<Array.<number>>),Object.<string, *>)}
*/ */
this.featureClass_ = options.featureClass ? this.featureClass_ = options.featureClass ?
options.featureClass : ol.render.Feature; options.featureClass : ol.render.Feature;
@@ -137,9 +137,8 @@ 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, id); return new this.featureClass_(geometryType, flatCoordinates, ends, values);
}; };
@@ -150,7 +149,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
ol.format.MVT.prototype.readFeatures = function(source, opt_options) { ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
var layers = this.layers_; var layers = this.layers_;
var pbf = new ol.ext.PBF(/** @type {ArrayBuffer} */ (source)); var pbf = new ol.ext.pbf(/** @type {ArrayBuffer} */ (source));
var tile = new ol.ext.vectortile.VectorTile(pbf); var tile = new ol.ext.vectortile.VectorTile(pbf);
var features = []; var features = [];
var featureClass = this.featureClass_; var featureClass = this.featureClass_;

View File

@@ -10,6 +10,7 @@ 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');
@@ -28,18 +29,6 @@ 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
*/ */
@@ -213,21 +202,18 @@ 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, property, name, opt_options) { collection, arcs, scale, translate, 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, property, name, opt_options); geometries[i], arcs, scale, translate, opt_options);
} }
return features; return features;
}; };
@@ -240,15 +226,12 @@ 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, property, name, opt_options) { scale, translate, 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];
@@ -263,15 +246,8 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
if (object.id !== undefined) { if (object.id !== undefined) {
feature.setId(object.id); feature.setId(object.id);
} }
var properties = object.properties; if (object.properties) {
if (property) { feature.setProperties(object.properties);
if (!properties) {
properties = {};
}
properties[property] = name;
}
if (properties) {
feature.setProperties(properties);
} }
return feature; return feature;
}; };
@@ -307,24 +283,21 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
} }
/** @type {Array.<ol.Feature>} */ /** @type {Array.<ol.Feature>} */
var features = []; var features = [];
var topoJSONFeatures = topoJSONTopology.objects; var topoJSONFeatures = ol.obj.getValues(topoJSONTopology.objects);
var property = this.layerName_; var i, ii;
var objectName, feature; var feature;
for (objectName in topoJSONFeatures) { for (i = 0, ii = topoJSONFeatures.length; i < ii; ++i) {
if (this.layers_ && this.layers_.indexOf(objectName) == -1) { if (topoJSONFeatures[i].type === 'GeometryCollection') {
continue;
}
if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
feature = /** @type {TopoJSONGeometryCollection} */ feature = /** @type {TopoJSONGeometryCollection} */
(topoJSONFeatures[objectName]); (topoJSONFeatures[i]);
features.push.apply(features, features.push.apply(features,
ol.format.TopoJSON.readFeaturesFromGeometryCollection_( ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
feature, arcs, scale, translate, property, objectName, opt_options)); feature, arcs, scale, translate, opt_options));
} else { } else {
feature = /** @type {TopoJSONGeometry} */ feature = /** @type {TopoJSONGeometry} */
(topoJSONFeatures[objectName]); (topoJSONFeatures[i]);
features.push(ol.format.TopoJSON.readFeatureFromGeometry_( features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
feature, arcs, scale, translate, property, objectName, opt_options)); feature, arcs, scale, translate, opt_options));
} }
} }
return features; return features;

View File

@@ -2,7 +2,6 @@ goog.provide('ol.format.WFS');
goog.require('ol'); goog.require('ol');
goog.require('ol.asserts'); goog.require('ol.asserts');
goog.require('ol.format.GML2');
goog.require('ol.format.GML3'); goog.require('ol.format.GML3');
goog.require('ol.format.GMLBase'); goog.require('ol.format.GMLBase');
goog.require('ol.format.filter'); goog.require('ol.format.filter');
@@ -54,8 +53,7 @@ ol.format.WFS = function(opt_options) {
* @type {string} * @type {string}
*/ */
this.schemaLocation_ = options.schemaLocation ? this.schemaLocation_ = options.schemaLocation ?
options.schemaLocation : options.schemaLocation : ol.format.WFS.SCHEMA_LOCATION;
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
ol.format.XMLFeature.call(this); ol.format.XMLFeature.call(this);
}; };
@@ -94,26 +92,8 @@ ol.format.WFS.WFSNS = 'http://www.opengis.net/wfs';
* @const * @const
* @type {string} * @type {string}
*/ */
ol.format.WFS.FESNS = 'http://www.opengis.net/fes'; ol.format.WFS.SCHEMA_LOCATION = 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd';
/**
* @const
* @type {Object.<string, string>}
*/
ol.format.WFS.SCHEMA_LOCATIONS = {
'1.1.0': 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
'1.0.0': 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.0.0/wfs.xsd'
};
/**
* @const
* @type {string}
*/
ol.format.WFS.DEFAULT_VERSION = '1.1.0';
/** /**
@@ -380,14 +360,9 @@ ol.format.WFS.writeFeature_ = function(node, feature, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var featureType = context['featureType']; var featureType = context['featureType'];
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
var gmlVersion = context['gmlVersion'];
var child = ol.xml.createElementNS(featureNS, featureType); var child = ol.xml.createElementNS(featureNS, featureType);
node.appendChild(child); node.appendChild(child);
if (gmlVersion === 2) {
ol.format.GML2.prototype.writeFeatureElement(child, feature, objectStack);
} else {
ol.format.GML3.prototype.writeFeatureElement(child, feature, objectStack); ol.format.GML3.prototype.writeFeatureElement(child, feature, objectStack);
}
}; };
@@ -406,25 +381,6 @@ ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
}; };
/**
* @param {string|undefined} featurePrefix The prefix of the feature.
* @param {string} featureType The type of the feature.
* @returns {string} The value of the typeName property.
* @private
*/
ol.format.WFS.getTypeName_ = function(featurePrefix, featureType) {
featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX;
var prefix = featurePrefix + ':';
// The featureType already contains the prefix.
if (featureType.indexOf(prefix) === 0) {
return featureType;
} else {
return prefix + featureType;
}
};
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
@@ -436,9 +392,10 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
ol.asserts.assert(feature.getId() !== undefined, 26); // Features must have an id set ol.asserts.assert(feature.getId() !== undefined, 26); // Features must have an id set
var featureType = context['featureType']; var featureType = context['featureType'];
var featurePrefix = context['featurePrefix']; var featurePrefix = context['featurePrefix'];
featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX;
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
var typeName = ol.format.WFS.getTypeName_(featurePrefix, featureType); node.setAttribute('typeName', featurePrefix + ':' + featureType);
node.setAttribute('typeName', typeName);
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix, ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
var fid = feature.getId(); var fid = feature.getId();
@@ -459,9 +416,10 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
ol.asserts.assert(feature.getId() !== undefined, 27); // Features must have an id set ol.asserts.assert(feature.getId() !== undefined, 27); // Features must have an id set
var featureType = context['featureType']; var featureType = context['featureType'];
var featurePrefix = context['featurePrefix']; var featurePrefix = context['featurePrefix'];
featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX;
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
var typeName = ol.format.WFS.getTypeName_(featurePrefix, featureType); node.setAttribute('typeName', featurePrefix + ':' + featureType);
node.setAttribute('typeName', typeName);
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix, ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS); featureNS);
var fid = feature.getId(); var fid = feature.getId();
@@ -475,8 +433,7 @@ 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, {node: node, '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);
@@ -493,21 +450,14 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
*/ */
ol.format.WFS.writeProperty_ = function(node, pair, objectStack) { ol.format.WFS.writeProperty_ = function(node, pair, objectStack) {
var name = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Name'); var name = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Name');
var context = objectStack[objectStack.length - 1];
var gmlVersion = context['gmlVersion'];
node.appendChild(name); node.appendChild(name);
ol.format.XSD.writeStringTextNode(name, pair.name); ol.format.XSD.writeStringTextNode(name, pair.name);
if (pair.value !== undefined && pair.value !== null) { if (pair.value !== undefined && pair.value !== null) {
var value = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Value'); var value = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Value');
node.appendChild(value); node.appendChild(value);
if (pair.value instanceof ol.geom.Geometry) { if (pair.value instanceof ol.geom.Geometry) {
if (gmlVersion === 2) {
ol.format.GML2.prototype.writeGeometryElement(value,
pair.value, objectStack);
} else {
ol.format.GML3.prototype.writeGeometryElement(value, ol.format.GML3.prototype.writeGeometryElement(value,
pair.value, objectStack); pair.value, objectStack);
}
} else { } else {
ol.format.XSD.writeStringTextNode(value, pair.value); ol.format.XSD.writeStringTextNode(value, pair.value);
} }
@@ -562,14 +512,8 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
var featureNS = context['featureNS']; var featureNS = context['featureNS'];
var propertyNames = context['propertyNames']; var propertyNames = context['propertyNames'];
var srsName = context['srsName']; var srsName = context['srsName'];
var typeName; var prefix = featurePrefix ? featurePrefix + ':' : '';
// If feature prefix is not defined, we must not use the default prefix. node.setAttribute('typeName', prefix + featureType);
if (featurePrefix) {
typeName = ol.format.WFS.getTypeName_(featurePrefix, featureType);
} else {
typeName = featureType;
}
node.setAttribute('typeName', typeName);
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
@@ -653,32 +597,6 @@ 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.
@@ -810,21 +728,6 @@ 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
@@ -834,7 +737,6 @@ 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_),
@@ -854,20 +756,6 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
}; };
/**
* Encode filter as WFS `Filter` and return the Node.
*
* @param {ol.format.filter.Filter} filter Filter.
* @return {Node} Result.
* @api
*/
ol.format.WFS.writeFilter = function(filter) {
var child = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'Filter');
ol.format.WFS.writeFilterCondition_(child, filter, []);
return child;
};
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {Array.<string>} featureTypes Feature types. * @param {Array.<string>} featureTypes Feature types.
@@ -963,11 +851,8 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
options) { options) {
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 ?
options.version : ol.format.WFS.DEFAULT_VERSION;
var gmlVersion = version === '1.0.0' ? 2 : 3;
node.setAttribute('service', 'WFS'); node.setAttribute('service', 'WFS');
node.setAttribute('version', version); node.setAttribute('version', '1.1.0');
var baseObj; var baseObj;
/** @type {ol.XmlNodeStackItem} */ /** @type {ol.XmlNodeStackItem} */
var obj; var obj;
@@ -977,14 +862,12 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
node.setAttribute('handle', options.handle); node.setAttribute('handle', options.handle);
} }
} }
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', this.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': featurePrefix, 'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; 'srsName': options.srsName};
ol.obj.assign(obj, baseObj); ol.obj.assign(obj, baseObj);
ol.xml.pushSerializeAndPop(obj, ol.xml.pushSerializeAndPop(obj,
ol.format.WFS.TRANSACTION_SERIALIZERS_, ol.format.WFS.TRANSACTION_SERIALIZERS_,
@@ -993,8 +876,8 @@ 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': featurePrefix, 'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; 'srsName': options.srsName};
ol.obj.assign(obj, baseObj); ol.obj.assign(obj, baseObj);
ol.xml.pushSerializeAndPop(obj, ol.xml.pushSerializeAndPop(obj,
ol.format.WFS.TRANSACTION_SERIALIZERS_, ol.format.WFS.TRANSACTION_SERIALIZERS_,
@@ -1003,16 +886,16 @@ 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': featurePrefix, 'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName}, 'srsName': options.srsName},
ol.format.WFS.TRANSACTION_SERIALIZERS_, ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Delete'), deletes, ol.xml.makeSimpleNodeFactory('Delete'), deletes,
objectStack); objectStack);
} }
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': featurePrefix, 'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName}, '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,
objectStack); objectStack);

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