Compare commits

..

1 Commits

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

View File

@@ -4,7 +4,7 @@ Thanks for your interest in contributing to OpenLayers.
## 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).

View File

@@ -31,6 +31,6 @@ Please see our guide on [contributing](CONTRIBUTING.md) if you're interested in
## 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
- Discuss with openlayers users on IRC in `#openlayers` at `chat.freenode`

View File

@@ -2,32 +2,10 @@
### Next release
### 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
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
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

@@ -59,16 +59,14 @@
<div class="row-fluid">
<div id="source-controls">
<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>
<form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
<textarea class="hidden" name="title">{{ title }}</textarea>
<textarea class="hidden" name="description">{{ shortdesc }}</textarea>
<form method="POST" id="jsfiddle-form" target="_blank" action="https://jsfiddle.net/api/post/library/pure/">
<textarea class="hidden" name="js">{{ js.source }}</textarea>
<textarea class="hidden" name="css">{{ css.source }}</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="data">
</form>
<pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html&gt;

View File

@@ -7,7 +7,7 @@ layout: doc.hbs
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,
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
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?
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

@@ -10,40 +10,11 @@
});
}
var codepenButton = document.getElementById('codepen-button');
if (codepenButton) {
codepenButton.onclick = function(event) {
var fiddleButton = document.getElementById('jsfiddle-button');
if (fiddleButton) {
fiddleButton.onclick = function(event) {
event.preventDefault();
var form = document.getElementById('codepen-form');
// 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();
document.getElementById('jsfiddle-form').submit();
};
}

View File

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

View File

@@ -6759,13 +6759,7 @@ olx.source.ZoomifyOptions.prototype.reprojectionErrorThreshold;
/**
* URL template or base URL of the Zoomify service. A base URL is the fixed part
* 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.
* Prefix of URL template.
* @type {!string}
* @api
*/

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "4.0.1",
"version": "4.0.0-beta.1",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
@@ -50,7 +50,7 @@
"walk": "2.3.9"
},
"devDependencies": {
"clean-css-cli": "4.0.6",
"clean-css-cli": "4.0.0",
"coveralls": "2.11.16",
"debounce": "^1.0.0",
"eslint": "3.15.0",
@@ -89,6 +89,15 @@
"openlayers-internal"
],
"rules": {
"no-console": [
2,
{
"allow": [
"assert",
"warn"
]
}
],
"no-constant-condition": 0,
"openlayers-internal/enum": 2,
"openlayers-internal/no-duplicate-requires": 2,

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "4.0.1-beta.1",
"version": "3.21.0-beta.17",
"description": "OpenLayers as ES2015 modules",
"main": "index.js",
"module": "index.js",

View File

@@ -112,26 +112,10 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fraction
var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180;
var x = Math.abs(3600 * normalizedDegrees);
var dflPrecision = opt_fractionDigits || 0;
var precision = Math.pow(10, dflPrecision);
var deg = Math.floor(x / 3600);
var min = Math.floor((x - deg * 3600) / 60);
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 ' +
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
return Math.floor(x / 3600) + '\u00b0 ' +
ol.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
ol.string.padNumber((x % 60), 2, dflPrecision) + '\u2033 ' +
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
};

View File

@@ -39,11 +39,6 @@ ol.interaction.DragPan = function(opt_options) {
*/
this.lastCentroid = null;
/**
* @type {number}
*/
this.lastPointersCount_;
/**
* @private
* @type {ol.EventsConditionType}
@@ -67,33 +62,25 @@ ol.inherits(ol.interaction.DragPan, ol.interaction.Pointer);
* @private
*/
ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
var targetPointers = this.targetPointers;
var centroid =
ol.interaction.Pointer.centroid(targetPointers);
if (targetPointers.length == this.lastPointersCount_) {
if (this.kinetic_) {
this.kinetic_.update(centroid[0], centroid[1]);
}
if (this.lastCentroid) {
var deltaX = this.lastCentroid[0] - centroid[0];
var deltaY = centroid[1] - this.lastCentroid[1];
var map = mapBrowserEvent.map;
var view = map.getView();
var viewState = view.getState();
var center = [deltaX, deltaY];
ol.coordinate.scale(center, viewState.resolution);
ol.coordinate.rotate(center, viewState.rotation);
ol.coordinate.add(center, viewState.center);
center = view.constrainCenter(center);
view.setCenter(center);
}
} else if (this.kinetic_) {
// reset so we don't overestimate the kinetic energy after
// after one finger down, tiny drag, second finger down
this.kinetic_.begin();
ol.interaction.Pointer.centroid(this.targetPointers);
if (this.kinetic_) {
this.kinetic_.update(centroid[0], centroid[1]);
}
if (this.lastCentroid) {
var deltaX = this.lastCentroid[0] - centroid[0];
var deltaY = centroid[1] - this.lastCentroid[1];
var map = mapBrowserEvent.map;
var view = map.getView();
var viewState = view.getState();
var center = [deltaX, deltaY];
ol.coordinate.scale(center, viewState.resolution);
ol.coordinate.rotate(center, viewState.rotation);
ol.coordinate.add(center, viewState.center);
center = view.constrainCenter(center);
view.setCenter(center);
}
this.lastCentroid = centroid;
this.lastPointersCount_ = targetPointers.length;
};

View File

@@ -327,7 +327,9 @@ ol.interaction.Extent.prototype.snapToVertex_ = function(pixel, map) {
var vertexPixel = map.getPixelFromCoordinate(vertex);
//if the distance is within tolerance, snap to the segment
if (ol.coordinate.distance(pixel, vertexPixel) <= this.pixelTolerance_) {
if (Math.sqrt(ol.coordinate.squaredDistance(pixel, vertexPixel)) <=
this.pixelTolerance_) {
//test if we should further snap to a vertex
var pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
var pixel2 = map.getPixelFromCoordinate(closestSegment[1]);

View File

@@ -371,7 +371,8 @@ ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
vertex = (ol.coordinate.closestOnSegment(pixelCoordinate,
closestSegment));
vertexPixel = map.getPixelFromCoordinate(vertex);
if (ol.coordinate.distance(pixel, vertexPixel) <= this.pixelTolerance_) {
if (Math.sqrt(ol.coordinate.squaredDistance(pixel, vertexPixel)) <=
this.pixelTolerance_) {
snapped = true;
if (this.vertex_) {
pixel1 = map.getPixelFromCoordinate(closestSegment[0]);

View File

@@ -154,3 +154,15 @@ ol.Observable.prototype.un = function(type, listener, opt_this) {
ol.events.unlisten(this, /** @type {string} */ (type), listener, opt_this);
}
};
/**
* Removes an event listener using the key returned by `on()` or `once()`.
* Note that using the {@link ol.Observable.unByKey} static function is to
* be preferred.
* @param {ol.EventsKey|Array.<ol.EventsKey>} key The key returned by `on()`
* or `once()` (or an array of keys).
* @function
* @api
*/
ol.Observable.prototype.unByKey = ol.Observable.unByKey;

View File

@@ -145,10 +145,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
var layerStatesArray = frameState.layerStatesArray;
ol.array.stableSort(layerStatesArray, ol.renderer.Map.sortByZIndex);
if (rotation) {
context.save();
ol.render.canvas.rotateAtOffset(context, rotation, width / 2, height / 2);
}
ol.render.canvas.rotateAtOffset(context, rotation, width / 2, height / 2);
var viewResolution = frameState.viewState.resolution;
var i, ii, layer, layerRenderer, layerState;
@@ -165,9 +162,7 @@ ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
}
}
if (rotation) {
context.restore();
}
ol.render.canvas.rotateAtOffset(context, -rotation, width / 2, height / 2);
this.dispatchComposeEvent_(
ol.render.EventType.POSTCOMPOSE, frameState);

View File

@@ -208,7 +208,7 @@ ol.source.ImageArcGISRest.prototype.getRequestUrl_ = function(extent, size, pixe
params['BBOX'] = extent.join(',');
params['BBOXSR'] = srid;
params['IMAGESR'] = srid;
params['DPI'] = Math.round(90 * pixelRatio);
params['DPI'] = 90 * pixelRatio;
var url = this.url_;

View File

@@ -3,7 +3,6 @@ goog.provide('ol.source.Zoomify');
goog.require('ol');
goog.require('ol.ImageTile');
goog.require('ol.TileState');
goog.require('ol.TileUrlFunction');
goog.require('ol.asserts');
goog.require('ol.dom');
goog.require('ol.extent');
@@ -84,51 +83,31 @@ ol.source.Zoomify = function(opt_options) {
});
var url = options.url;
if (url && url.indexOf('{TileGroup}') == -1) {
url += '{TileGroup}/{z}-{x}-{y}.jpg';
}
var urls = ol.TileUrlFunction.expandUrl(url);
/**
* @param {string} template Template.
* @return {ol.TileUrlFunctionType} Tile URL function.
* @this {ol.source.TileImage}
* @param {ol.TileCoord} tileCoord Tile Coordinate.
* @param {number} pixelRatio Pixel ratio.
* @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL.
*/
function createFromTemplate(template) {
return (
/**
* @param {ol.TileCoord} tileCoord Tile Coordinate.
* @param {number} pixelRatio Pixel ratio.
* @param {ol.proj.Projection} projection Projection.
* @return {string|undefined} Tile URL.
*/
function(tileCoord, pixelRatio, projection) {
if (!tileCoord) {
return undefined;
} else {
var tileCoordZ = tileCoord[0];
var tileCoordX = tileCoord[1];
var tileCoordY = -tileCoord[2] - 1;
var tileIndex =
tileCoordX +
tileCoordY * tierSizeInTiles[tileCoordZ][0] +
tileCountUpToTier[tileCoordZ];
var tileGroup = (tileIndex / ol.DEFAULT_TILE_SIZE) | 0;
var localContext = {
'z': tileCoordZ,
'x': tileCoordX,
'y': tileCoordY,
'TileGroup': 'TileGroup' + tileGroup
};
return template.replace(/\{(\w+?)\}/g, function(m, p) {
return localContext[p];
});
}
});
function tileUrlFunction(tileCoord, pixelRatio, projection) {
if (!tileCoord) {
return undefined;
} else {
var tileCoordZ = tileCoord[0];
var tileCoordX = tileCoord[1];
var tileCoordY = -tileCoord[2] - 1;
var tileIndex =
tileCoordX +
tileCoordY * tierSizeInTiles[tileCoordZ][0] +
tileCountUpToTier[tileCoordZ];
var tileGroup = (tileIndex / ol.DEFAULT_TILE_SIZE) | 0;
return url + 'TileGroup' + tileGroup + '/' +
tileCoordZ + '-' + tileCoordX + '-' + tileCoordY + '.jpg';
}
}
var tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(urls.map(createFromTemplate));
ol.source.TileImage.call(this, {
attributions: options.attributions,
cacheSize: options.cacheSize,

View File

@@ -56,7 +56,7 @@ function getLinkToApiHtml(requires) {
* example HTML file, this adds metadata for related js and css resources. When
* these files are run through the example template, the extra metadata is used
* to show the complete example source in the textarea and submit the parts to
* CodePen.
* jsFiddle.
*
* @param {Object} files The file lookup provided by Metalsmith. Property names
* are file paths relative to the source directory. The file objects
@@ -111,13 +111,13 @@ function augmentExamples(files, metalsmith, done) {
if (file.resources) {
var resources = [];
var remoteResources = [];
var codePenResources = [];
var fiddleResources = [];
for (var i = 0, ii = file.resources.length; i < ii; ++i) {
var resource = file.resources[i];
var remoteResource = resource.indexOf('//') === -1 ?
'https://openlayers.org/en/v' + pkg.version + '/examples/' +
resource : resource;
codePenResources[i] = remoteResource;
fiddleResources[i] = remoteResource;
if (isJsRegEx.test(resource)) {
resources[i] = '<script src="' + resource + '"></script>';
remoteResources[i] = '<script src="' + remoteResource +
@@ -138,7 +138,7 @@ function augmentExamples(files, metalsmith, done) {
remote: remoteResources.join('\n')
};
file.extraResources = file.resources.length ?
',' + codePenResources.join(',') : '';
',' + fiddleResources.join(',') : '';
}
}
}

View File

@@ -206,13 +206,13 @@ describe('ol.coordinate', function() {
it('formats with zero fractional digits as default', function() {
var coord = [7.85, 47.983333];
var got = ol.coordinate.toStringHDMS(coord);
var expected = '47° 59 00″ N 7° 51 00″ E';
var expected = '47° 58 60″ N 7° 50 60″ E';
expect(got).to.be(expected);
});
it('formats with given fractional digits, if passed', function() {
var coord = [7.85, 47.983333];
var got = ol.coordinate.toStringHDMS(coord, 3);
var expected = '47° 58 59.999″ N 7° 51 00.000″ E';
var expected = '47° 58 59.999″ N 7° 50 60.000″ E';
expect(got).to.be(expected);
});
});

View File

@@ -1634,7 +1634,7 @@ describe('ol.format.KML', function() {
' <Data name="country">' +
' <displayName>Country</displayName>' +
' <value>United-Kingdom</value>' +
' </Data>' +
' /Data>' +
' </ExtendedData>' +
' </Placemark>' +
'</kml>';

View File

@@ -36,7 +36,6 @@ describe('ol.renderer.canvas.Map', function() {
target.style.height = '100px';
document.body.appendChild(target);
map = new ol.Map({
pixelRatio: 1,
target: target,
view: new ol.View({
center: [0, 0],

View File

@@ -38,10 +38,10 @@ describe('ol.source.ImageArcGISRest', function() {
it('returns a non floating point DPI value', function() {
var source = new ol.source.ImageArcGISRest(options);
var image = source.getImage([3, 2, -7, 1.12], resolution, 1.01, proj3857);
var image = source.getImage([3, 2, -7, 1.12], resolution, pixelRatio, proj3857);
var uri = new URL(image.src_);
var queryData = uri.searchParams;
expect(queryData.get('DPI')).to.be('91');
expect(queryData.get('DPI')).to.be('90');
});
it('returns a image with the expected URL for ImageServer', function() {

View File

@@ -11,7 +11,7 @@ describe('ol.source.Zoomify', function() {
var w = 1024;
var h = 512;
var size = [w, h];
var url = 'zoomify-url/{TileGroup}/{z}-{x}-{y}.jpg';
var url = 'zoomify-url/';
var proj = new ol.proj.Projection({
code: 'ZOOMIFY',
units: 'pixels',
@@ -167,7 +167,7 @@ describe('ol.source.Zoomify', function() {
describe('generated tileUrlFunction', function() {
it('creates an expected tileUrlFunction with template', function() {
it('creates an expected tileUrlFunction', function() {
var source = getZoomifySource();
var tileUrlFunction = source.getTileUrlFunction();
// zoomlevel 0
@@ -179,20 +179,6 @@ describe('ol.source.Zoomify', function() {
expect(tileUrlFunction([1, 1, -2])).to.eql('zoomify-url/TileGroup0/1-1-1.jpg');
});
it('creates an expected tileUrlFunction without template', function() {
var source = new ol.source.Zoomify({
url: 'zoomify-url/',
size: size
});
var tileUrlFunction = source.getTileUrlFunction();
// zoomlevel 0
expect(tileUrlFunction([0, 0, -1])).to.eql('zoomify-url/TileGroup0/0-0-0.jpg');
// zoomlevel 1
expect(tileUrlFunction([1, 0, -1])).to.eql('zoomify-url/TileGroup0/1-0-0.jpg');
expect(tileUrlFunction([1, 1, -1])).to.eql('zoomify-url/TileGroup0/1-1-0.jpg');
expect(tileUrlFunction([1, 0, -2])).to.eql('zoomify-url/TileGroup0/1-0-1.jpg');
expect(tileUrlFunction([1, 1, -2])).to.eql('zoomify-url/TileGroup0/1-1-1.jpg');
});
it('returns undefined if no tileCoord passed', function() {
var source = getZoomifySource();
var tileUrlFunction = source.getTileUrlFunction();

View File

@@ -11,9 +11,19 @@ describe('ol.structs.PriorityQueue', function() {
describe('when empty', function() {
var pq;
var pq, origAssert;
beforeEach(function() {
pq = new ol.structs.PriorityQueue(identity, identity);
origAssert = console.assert;
console.assert = function(assertion, message) {
if (!assertion) {
throw new Error(message);
}
};
pq = new ol.structs.PriorityQueue(
identity, identity);
});
afterEach(function() {
console.assert = origAssert;
});
it('is empty', function() {