Compare commits

..

3 Commits

Author SHA1 Message Date
Tim Schaub
68b19e90e3 3.11.0-beta.2 2015-11-01 10:38:39 -07:00
Tim Schaub
8e1e58be68 Merge branch 'master' of github.com:openlayers/ol3 into v3.11.0-beta 2015-11-01 10:35:33 -07:00
Tim Schaub
28792a6dbc 3.11.0-beta.1 2015-10-31 13:57:53 -06:00
674 changed files with 8285 additions and 18203 deletions

View File

@@ -1,2 +0,0 @@
examples/Jugl.js
examples/resources/

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.pyc
/build/ /build/
/node_modules/ /node_modules/
/dist/ /dist/

5
.jshintrc Normal file
View File

@@ -0,0 +1,5 @@
{
"-W030": true,
"-W083": true,
"-W069": true
}

View File

@@ -1 +1,2 @@
*.pyc
/build/ /build/

View File

@@ -1,4 +1,5 @@
sudo: false sudo: required
dist: trusty
language: node_js language: node_js
@@ -13,11 +14,11 @@ env:
before_install: before_install:
- "npm prune" - "npm prune"
- "sudo pip install -r requirements.txt"
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"
script: "make ci" script: "make ci"

View File

@@ -81,7 +81,8 @@ include:
OpenLayers 3 follows [Google's JavaScript Style OpenLayers 3 follows [Google's JavaScript Style
Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml). Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml).
This is checked using [ESLint](http://eslint.org/), you This is checked using the [Closure
Linter](https://developers.google.com/closure/utilities/) in strict mode. You
can run the linter locally on your machine before committing using the `lint` can run the linter locally on your machine before committing using the `lint`
target: target:
@@ -101,6 +102,13 @@ style of the existing OpenLayers 3 code, which includes:
* Do not use assignments inside expressions. * Do not use assignments inside expressions.
* Avoid the use of `goog.array.clone` with arrays (use slice instead).
* Use `array.length = 0` instead of `goog.array.clear`.
* Use bracket notation instead of `goog.object.set` and `goog.object.get` (with
two arguments).
* Use uppercase for `@const` variables. * Use uppercase for `@const` variables.
### Configure your editor ### Configure your editor

View File

@@ -25,11 +25,11 @@ The minimum requirements are:
* GNU Make * GNU Make
* Git * Git
* [Node.js](http://nodejs.org/) (higher than 0.12.x) * [Node.js](http://nodejs.org/) (0.10.x or higher)
* Python 2.6 or 2.7 * Python 2.6 or 2.7 with a couple of extra modules (see below)
* Java 7 (JRE and JDK) * Java 7 (JRE and JDK)
The executables `git`, `node`, and `java` should be in your `PATH`. The executables `git`, `node`, `python` and `java` should be in your `PATH`.
You can check your configuration by running: You can check your configuration by running:
@@ -39,6 +39,17 @@ To install the Node.js dependencies run
$ npm install $ npm install
To install the extra Python modules, run:
$ sudo pip install -r requirements.txt
or
$ cat requirements.txt | sudo xargs easy_install
depending on your OS and Python installation.
(You can also install the Python modules in a Python virtual environment if you want to.)
## Working with the build tool ## Working with the build tool
As an ol3 developer you will use `make` to run build targets defined in the As an ol3 developer you will use `make` to run build targets defined in the

View File

@@ -1,4 +1,4 @@
Copyright 2005-2016 OpenLayers Contributors. All rights reserved. Copyright 2005-2015 OpenLayers Contributors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:

View File

@@ -93,7 +93,8 @@ compile-examples: build/compiled-examples/all.combined.js
.PHONY: clean .PHONY: clean
clean: clean:
rm -f build/timestamps/eslint-timestamp rm -f build/timestamps/gjslint-timestamp
rm -f build/timestamps/jshint-timestamp
rm -f build/timestamps/check-*-timestamp rm -f build/timestamps/check-*-timestamp
rm -f build/ol.css rm -f build/ol.css
rm -f build/ol.js rm -f build/ol.js
@@ -119,8 +120,9 @@ examples: $(BUILD_EXAMPLES)
install: build/timestamps/node-modules-timestamp install: build/timestamps/node-modules-timestamp
.PHONY: lint .PHONY: lint
lint: build/timestamps/eslint-timestamp \ lint: build/timestamps/gjslint-timestamp build/timestamps/jshint-timestamp \
build/timestamps/check-requires-timestamp build/timestamps/check-requires-timestamp \
build/timestamps/check-whitespace-timestamp
.PHONY: npm-install .PHONY: npm-install
npm-install: build/timestamps/node-modules-timestamp npm-install: build/timestamps/node-modules-timestamp
@@ -181,7 +183,7 @@ build/timestamps/check-%-timestamp: $(BUILD_HOSTED)/examples/%.html \
$(BUILD_HOSTED)/build/ol.js \ $(BUILD_HOSTED)/build/ol.js \
$(BUILD_HOSTED)/css/ol.css $(BUILD_HOSTED)/css/ol.css
@mkdir -p $(@D) @mkdir -p $(@D)
./node_modules/.bin/phantomjs --local-to-remote-url-access=true --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $< ./node_modules/.bin/phantomjs --ssl-protocol=any --ignore-ssl-errors=true bin/check-example.js $(addsuffix ?mode=advanced, $<)
@touch $@ @touch $@
build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \ build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
@@ -191,6 +193,13 @@ build/timestamps/check-requires-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
@python bin/check-requires.py $(CLOSURE_LIB) $^ @python bin/check-requires.py $(CLOSURE_LIB) $^
@touch $@ @touch $@
build/timestamps/check-whitespace-timestamp: $(SRC_JS) $(EXAMPLES_JS) \
$(SPEC_JS) $(SPEC_RENDERING_JS) \
$(SRC_JSDOC)
@mkdir -p $(@D)
@python bin/check-whitespace.py $^
@touch $@
build/compiled-examples/all.js: $(EXAMPLES_JS) build/compiled-examples/all.js: $(EXAMPLES_JS)
@mkdir -p $(@D) @mkdir -p $(@D)
@python bin/combine-examples.py $^ > $@ @python bin/combine-examples.py $^ > $@
@@ -222,6 +231,13 @@ build/timestamps/jsdoc-$(BRANCH)-timestamp: config/jsdoc/api/index.md \
./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d $(BUILD_HOSTED)/apidoc ./node_modules/.bin/jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d $(BUILD_HOSTED)/apidoc
@touch $@ @touch $@
build/timestamps/gjslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
$(EXAMPLES_JS)
@mkdir -p $(@D)
@echo "Running gjslint..."
@gjslint --jslint_error=all --custom_jsdoc_tags=event,fires,function,classdesc,api,observable --strict $?
@touch $@
$(BUILD_HOSTED_EXAMPLES_JS): $(BUILD_HOSTED)/examples/%.js: build/examples/%.js $(BUILD_HOSTED_EXAMPLES_JS): $(BUILD_HOSTED)/examples/%.js: build/examples/%.js
@mkdir -p $(@D) @mkdir -p $(@D)
@python bin/split-example.py $< $(@D) @python bin/split-example.py $< $(@D)
@@ -255,12 +271,13 @@ $(BUILD_HOSTED)/build/ol-deps.js: host-libraries
--root_with_prefix "$(BUILD_HOSTED)/closure-library/third_party ../../third_party" \ --root_with_prefix "$(BUILD_HOSTED)/closure-library/third_party ../../third_party" \
--output_file $@ --output_file $@
build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \ build/timestamps/jshint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
$(TASKS_JS) $(EXAMPLES_JS) \ $(TASKS_JS) $(EXAMPLES_JS) \
examples/resources/common.js \
build/timestamps/node-modules-timestamp build/timestamps/node-modules-timestamp
@mkdir -p $(@D) @mkdir -p $(@D)
@echo "Running eslint..." @echo "Running jshint..."
@./node_modules/.bin/eslint $? @./node_modules/.bin/jshint --verbose $?
@touch $@ @touch $@
build/timestamps/node-modules-timestamp: package.json build/timestamps/node-modules-timestamp: package.json

View File

@@ -2,7 +2,6 @@
[![Travis CI Status](https://secure.travis-ci.org/openlayers/ol3.svg)](http://travis-ci.org/#!/openlayers/ol3) [![Travis CI Status](https://secure.travis-ci.org/openlayers/ol3.svg)](http://travis-ci.org/#!/openlayers/ol3)
[![Coverage Status](https://coveralls.io/repos/openlayers/ol3/badge.svg?branch=master)](https://coveralls.io/r/openlayers/ol3?branch=master) [![Coverage Status](https://coveralls.io/repos/openlayers/ol3/badge.svg?branch=master)](https://coveralls.io/r/openlayers/ol3?branch=master)
[![OSGeo Project](https://img.shields.io/badge/OSGeo-Project-brightgreen.svg)](http://osgeo.org/)
[OpenLayers 3](http://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web. [OpenLayers 3](http://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web.

46
bin/check-whitespace.py Normal file
View File

@@ -0,0 +1,46 @@
import logging
import re
import sys
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger('check-whitespace')
CR_RE = re.compile(r'\r')
LEADING_WHITESPACE_RE = re.compile(r'\s+')
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
NO_NEWLINE_RE = re.compile(r'[^\n]\Z')
ALL_WHITESPACE_RE = re.compile(r'\s+\Z')
def check_whitespace(*filenames):
errors = 0
for filename in sorted(filenames):
whitespace = False
for lineno, line in enumerate(open(filename, 'rU')):
if lineno == 0 and LEADING_WHITESPACE_RE.match(line):
logger.info('%s:%d: leading whitespace', filename, lineno + 1)
errors += 1
if CR_RE.search(line):
logger.info('%s:%d: carriage return character in line',
filename, lineno + 1)
errors += 1
if TRAILING_WHITESPACE_RE.search(line):
logger.info('%s:%d: trailing whitespace', filename, lineno + 1)
errors += 1
if NO_NEWLINE_RE.search(line):
logger.info('%s:%d: no newline at end of file', filename,
lineno + 1)
errors += 1
whitespace = ALL_WHITESPACE_RE.match(line)
if whitespace:
logger.info('%s: trailing whitespace at end of file', filename)
errors += 1
return errors
if __name__ == "__main__":
errors = check_whitespace(*sys.argv[1:])
if errors > 0:
logger.error('%d whitespace errors' % (errors,))
sys.exit(1)

View File

@@ -1,86 +1,5 @@
## Upgrade notes ## Upgrade notes
### v3.14.0
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
#### Layer pre-/postcompose event changes
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
Old code:
```js
layer.on('precompose', function(e) {
// rely on canvas dimensions to move coordinate origin to center
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
e.context.scale(3, 3);
// draw an x in the center of the viewport
e.context.moveTo(-20, -20);
e.context.lineTo(20, 20);
e.context.moveTo(-20, 20);
e.context.lineTo(20, -20);
// rely on the canvas having a null transform
e.context.setTransform(1, 0, 0, 1, 0, 0);
});
```
New code:
```js
layer.on('precompose', function(e) {
// use map size and pixel ratio to move coordinate origin to center
var size = map.getSize();
var pixelRatio = e.frameState.pixelRatio;
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
e.context.scale(3, 3);
// draw an x in the center of the viewport
e.context.moveTo(-20, -20);
e.context.lineTo(20, 20);
e.context.moveTo(-20, 20);
e.context.lineTo(20, -20);
// undo all transforms
e.context.scale(1 / 3, 1 / 3);
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
});
```
### v3.13.0
#### `proj4js` integration
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
```js
import ol from 'openlayers';
import proj4 from 'proj4';
ol.proj.setProj4(proj4);
```
#### `ol.source.TileJSON` changes
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
```js
new ol.source.TileJSON({
url: 'http://serverwithoutcors.com/tilejson.json',
jsonp: true
})
```
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
### v3.12.0
#### `ol.Map#forEachFeatureAtPixel` changes
The optional `layerFilter` function is now also called for unmanaged layers. To get the same behaviour as before, wrap your layer filter code in an if block like this:
```js
function layerFilter(layer) {
if (map.getLayers().getArray().indexOf(layer) !== -1) {
// existing layer filter code
}
}
```
### v3.11.0 ### v3.11.0
#### `ol.format.KML` changes #### `ol.format.KML` changes
@@ -127,12 +46,6 @@ but with additional css:
With the introduction of true vector tile support, `ol.source.TileVector` becomes obsolete. Change your code to use `ol.layer.VectorTile` and `ol.source.VectorTile` instead of `ol.layer.Vector` and `ol.source.TileVector`. With the introduction of true vector tile support, `ol.source.TileVector` becomes obsolete. Change your code to use `ol.layer.VectorTile` and `ol.source.VectorTile` instead of `ol.layer.Vector` and `ol.source.TileVector`.
#### `ol.Map#forEachFeatureAtPixel` changes for unmanaged layers
`ol.Map#forEachFeatureAtPixel` will still be called for unmanaged layers, but the 2nd argument to the callback function will be `null` instead of a reference to the unmanaged layer. This brings back the behavior of the abandoned `ol.FeatureOverlay` that was replaced by unmanaged layers.
If you are affected by this change, please change your unmanaged layer to a regular layer by using e.g. `ol.Map#addLayer` instead of `ol.layer.Layer#setMap`.
### v3.10.0 ### v3.10.0
#### `ol.layer.Layer` changes #### `ol.layer.Layer` changes

View File

@@ -1,136 +0,0 @@
# v3.11.0
## Summary
The v3.11.0 release includes features and fixes from 73 pull requests since the v3.10.1 release. New features and improvements include:
* Support for raster reprojection - load raster sources in one projection and view them in another.
* Support for Mapbox Vector Tiles!
* Improved KML support, GeoJSON & TopoJSON fixes, and much more. See below for the full list.
## Upgrade notes
#### `ol.format.KML` changes
KML icons are scaled 50% so that the rendering better matches Google Earth rendering.
If a KML placemark has a name and is a point, an `ol.style.Text` is created with the name displayed to the right of the icon (if there is an icon).
This can be controlled with the showPointNames option which defaults to true.
To disable rendering of the point names for placemarks, use the option:
new ol.format.KML({ showPointNames: false });
#### `ol.interaction.DragBox` and `ol.interaction.DragZoom` changes
Styling is no longer done with `ol.Style`, but with pure CSS. The `style` constructor option is no longer required, and no longer available. Instead, there is a `className` option for the CSS selector. The default for `ol.interaction.DragBox` is `ol-dragbox`, and `ol.interaction.DragZoom` uses `ol-dragzoom`. If you previously had
```js
new ol.interaction.DragZoom({
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'red',
width: 3
}),
fill: new ol.style.Fill({
color: [255, 255, 255, 0.4]
})
})
});
```
you'll now just need
```js
new ol.interaction.DragZoom();
```
but with additional css:
```css
.ol-dragzoom {
border-color: red;
border-width: 3px;
background-color: rgba(255,255,255,0.4);
}
```
#### Removal of `ol.source.TileVector`
With the introduction of true vector tile support, `ol.source.TileVector` becomes obsolete. Change your code to use `ol.layer.VectorTile` and `ol.source.VectorTile` instead of `ol.layer.Vector` and `ol.source.TileVector`.
#### `ol.Map#forEachFeatureAtPixel` changes for unmanaged layers
`ol.Map#forEachFeatureAtPixel` will still be called for unmanaged layers, but the 2nd argument to the callback function will be `null` instead of a reference to the unmanaged layer. This brings back the behavior of the abandoned `ol.FeatureOverlay` that was replaced by unmanaged layers.
If you are affected by this change, please change your unmanaged layer to a regular layer by using e.g. `ol.Map#addLayer` instead of `ol.layer.Layer#setMap`.
## Full list of changes
* [#4394](https://github.com/openlayers/ol3/pull/4394) - Allow ol.Object property update without notification. ([@DavidHequet](https://github.com/DavidHequet))
* [#4395](https://github.com/openlayers/ol3/pull/4395) - Flag ol.style.Text setOffsetX and Y as @api. ([@adube](https://github.com/adube))
* [#4393](https://github.com/openlayers/ol3/pull/4393) - Faster vector tiles ([@ahocevar](https://github.com/ahocevar))
* [#4392](https://github.com/openlayers/ol3/pull/4392) - Update clean-css to version 3.4.7 🚀 ([@openlayers](https://github.com/openlayers))
* [#4391](https://github.com/openlayers/ol3/pull/4391) - Pass null as forEachFeatureAtPixel layer arg for unmanaged layers ([@ahocevar](https://github.com/ahocevar))
* [#4390](https://github.com/openlayers/ol3/pull/4390) - Fix usage of mocha-phantomjs-core after update ([@ahocevar](https://github.com/ahocevar))
* [#4387](https://github.com/openlayers/ol3/pull/4387) - Add default argument to getRendererFromQueryString ([@ahocevar](https://github.com/ahocevar))
* [#4376](https://github.com/openlayers/ol3/pull/4376) - Make KML format ignore image styles that aren't icons ([@elemoine](https://github.com/elemoine))
* [#4385](https://github.com/openlayers/ol3/pull/4385) - Don't transform the scale specified by the user ([@oterral](https://github.com/oterral))
* [#4388](https://github.com/openlayers/ol3/pull/4388) - Quick-fix running tests with PhantomJS ([@ahocevar](https://github.com/ahocevar))
* [#4378](https://github.com/openlayers/ol3/pull/4378) - Add a writeStyles option to KML format ([@elemoine](https://github.com/elemoine))
* [#4375](https://github.com/openlayers/ol3/pull/4375) - Fixed documentation typo (ol.source.ImageWMS) ([@simonseyock](https://github.com/simonseyock))
* [#4371](https://github.com/openlayers/ol3/pull/4371) - Fix typo in closure compilation tutorial ([@dtreiter](https://github.com/dtreiter))
* [#4370](https://github.com/openlayers/ol3/pull/4370) - Improve ol.interaction.Select#getLayer documentation. ([@jonataswalker](https://github.com/jonataswalker))
* [#4365](https://github.com/openlayers/ol3/pull/4365) - Update fs-extra to version 0.26.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4366](https://github.com/openlayers/ol3/pull/4366) - Update resemblejs to version 2.0.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4368](https://github.com/openlayers/ol3/pull/4368) - Append KML placemark text style to existing styles ([@marcjansen](https://github.com/marcjansen))
* [#4361](https://github.com/openlayers/ol3/pull/4361) - Make GPX format not fail on unsupported geometries ([@elemoine](https://github.com/elemoine))
* [#4360](https://github.com/openlayers/ol3/pull/4360) - Update getExtent return value jsdoc tag ([@fredj](https://github.com/fredj))
* [#4359](https://github.com/openlayers/ol3/pull/4359) - Update closure-util to version 1.9.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4357](https://github.com/openlayers/ol3/pull/4357) - Update all dependencies. ([@openlayers](https://github.com/openlayers))
* [#4356](https://github.com/openlayers/ol3/pull/4356) - Update Metalsmith and layouts plugin. ([@tschaub](https://github.com/tschaub))
* [#4355](https://github.com/openlayers/ol3/pull/4355) - Update PhantomJS. ([@tschaub](https://github.com/tschaub))
* [#4353](https://github.com/openlayers/ol3/pull/4353) - Resolve path to jsdoc-fork. ([@tschaub](https://github.com/tschaub))
* [#3627](https://github.com/openlayers/ol3/pull/3627) - Make package.json compatible for npm frontend use. ([@ThomasG77](https://github.com/ThomasG77))
* [#4163](https://github.com/openlayers/ol3/pull/4163) - Fixes for building with Node 4.x. ([@tschaub](https://github.com/tschaub))
* [#4347](https://github.com/openlayers/ol3/pull/4347) - Use require.resolve() to find jsdoc. ([@tschaub](https://github.com/tschaub))
* [#4291](https://github.com/openlayers/ol3/pull/4291) - Add 'Move a feature along a line' example. ([@jonataswalker](https://github.com/jonataswalker))
* [#4344](https://github.com/openlayers/ol3/pull/4344) - Allow different resolutions in x and y direction for ol.source.ImageStatic ([@bartvde](https://github.com/bartvde))
* [#4339](https://github.com/openlayers/ol3/pull/4339) - Make sure drawImage width and height are not too big ([@bartvde](https://github.com/bartvde))
* [#4334](https://github.com/openlayers/ol3/pull/4334) - Check view extent within image extent ([@ahocevar](https://github.com/ahocevar))
* [#4332](https://github.com/openlayers/ol3/pull/4332) - Fix write out GeoJSON features with id equal to 0 ([@fredj](https://github.com/fredj))
* [#4331](https://github.com/openlayers/ol3/pull/4331) - Allow TopoJSON features with id equal to 0 ([@fredj](https://github.com/fredj))
* [#4330](https://github.com/openlayers/ol3/pull/4330) - ol.format.TopoJSON is read only, update the jsdoc ([@openlayers](https://github.com/openlayers))
* [#4327](https://github.com/openlayers/ol3/pull/4327) - Allow GeoJSON features with id equal to 0 ([@fredj](https://github.com/fredj))
* [#4219](https://github.com/openlayers/ol3/pull/4219) - Support tiled vector data and Mapbox vector tiles ([@ahocevar](https://github.com/ahocevar))
* [#4322](https://github.com/openlayers/ol3/pull/4322) - Add wrapX override support for ol.source.Cluster ([@FRizZL](https://github.com/FRizZL))
* [#4316](https://github.com/openlayers/ol3/pull/4316) - Render name labels if the geometry is a point in KML format (@tamarmot) ([@marcjansen](https://github.com/marcjansen))
* [#4313](https://github.com/openlayers/ol3/pull/4313) - Align logos nicely with attribution text ([@ahocevar](https://github.com/ahocevar))
* [#4297](https://github.com/openlayers/ol3/pull/4297) - Create standalone versions of ol.ext packages ([@ahocevar](https://github.com/ahocevar))
* [#4302](https://github.com/openlayers/ol3/pull/4302) - scale icons by 0.5 so they are not huge ([@tamarmot](https://github.com/tamarmot))
* [#4301](https://github.com/openlayers/ol3/pull/4301) - Remove jshint -W069 tags in source code ([@fredj](https://github.com/fredj))
* [#4273](https://github.com/openlayers/ol3/pull/4273) - Expand docs on ol.source url prop. ([@Barryrowe](https://github.com/Barryrowe))
* [#4293](https://github.com/openlayers/ol3/pull/4293) - Refine the pull request process ([@ahocevar](https://github.com/ahocevar))
* [#4289](https://github.com/openlayers/ol3/pull/4289) - Restrict maxZoom of the static-image example ([@ahocevar](https://github.com/ahocevar))
* [#4275](https://github.com/openlayers/ol3/pull/4275) - Fix ol.events.condition.mouseOnly parameter type ([@fredj](https://github.com/fredj))
* [#4248](https://github.com/openlayers/ol3/pull/4248) - Use Math.cosh of ES6/2015 if available ([@marcjansen](https://github.com/marcjansen))
* [#4286](https://github.com/openlayers/ol3/pull/4286) - Add a color manipulation example. ([@tschaub](https://github.com/tschaub))
* [#4122](https://github.com/openlayers/ol3/pull/4122) - Raster reprojection ([@klokantech](https://github.com/klokantech))
* [#4283](https://github.com/openlayers/ol3/pull/4283) - Flag ol.tilegrid.TileGrid getTileCoordExtent as @api ([@adube](https://github.com/adube))
* [#4280](https://github.com/openlayers/ol3/pull/4280) - Use overlay container instead of viewport for ol.render.Box ([@ahocevar](https://github.com/ahocevar))
* [#4278](https://github.com/openlayers/ol3/pull/4278) - Use DOM instead of map canvas for ol.render.Box ([@ahocevar](https://github.com/ahocevar))
* [#4277](https://github.com/openlayers/ol3/pull/4277) - Improve the box select example ([@fredj](https://github.com/fredj))
* [#4276](https://github.com/openlayers/ol3/pull/4276) - Better ol.events.condition.platformModifierKeyOnly documentation ([@fredj](https://github.com/fredj))
* [#4102](https://github.com/openlayers/ol3/pull/4102) - Export ol.Observable#dispatchEvent function ([@fredj](https://github.com/fredj))
* [#4261](https://github.com/openlayers/ol3/pull/4261) - ol.events.condition.mouseOnly may be wrong ([@fredj](https://github.com/fredj))
* [#4269](https://github.com/openlayers/ol3/pull/4269) - Fix Zoom control duration option - allow `0` as value ([@adube](https://github.com/adube))
* [#4268](https://github.com/openlayers/ol3/pull/4268) - Add method for retrieving ol.Overlay by id ([@jonataswalker](https://github.com/jonataswalker))
* [#4257](https://github.com/openlayers/ol3/pull/4257) - Remove unused ol.math-methods ([@marcjansen](https://github.com/marcjansen))
* [#4270](https://github.com/openlayers/ol3/pull/4270) - Fix Keyboard zoom interation options ([@adube](https://github.com/adube))
* [#4272](https://github.com/openlayers/ol3/pull/4272) - Allow the DragZoom interaction created in defaults to use zoomDuration option. ([@adube](https://github.com/adube))
* [#4271](https://github.com/openlayers/ol3/pull/4271) - Fix DragZoom interaction duration, allow `0` value ([@adube](https://github.com/adube))
* [#4267](https://github.com/openlayers/ol3/pull/4267) - Example usability improvements ([@ahocevar](https://github.com/ahocevar))
* [#4263](https://github.com/openlayers/ol3/pull/4263) - Add back CSSProperties.prototype.touchAction extern ([@fredj](https://github.com/fredj))
* [#4259](https://github.com/openlayers/ol3/pull/4259) - Remove use of toDegrees/toRadians util functions ([@marcjansen](https://github.com/marcjansen))
* [#4258](https://github.com/openlayers/ol3/pull/4258) - Remove usage of goog.dom.TagName enum ([@marcjansen](https://github.com/marcjansen))
* [#4255](https://github.com/openlayers/ol3/pull/4255) - Fix zoom slider width for retina displays ([@ahocevar](https://github.com/ahocevar))
* [#4249](https://github.com/openlayers/ol3/pull/4249) - Make whole example box clickable ([@ahocevar](https://github.com/ahocevar))
* [#4045](https://github.com/openlayers/ol3/pull/4045) - Add parser for dimension property from WMTS Capabilities.xml ([@Jenselme](https://github.com/Jenselme))
* [#4161](https://github.com/openlayers/ol3/pull/4161) - Add `translatestart`, `translateend` and `translating` events to `ol.interaction.Translate` ([@jonataswalker](https://github.com/jonataswalker))
* [#4186](https://github.com/openlayers/ol3/pull/4186) - Do not export ol.webgl.Context ([@elemoine](https://github.com/elemoine))
* [#4239](https://github.com/openlayers/ol3/pull/4239) - Changing highlighted to highlight ([@austinkeeley](https://github.com/austinkeeley))
* [#3727](https://github.com/openlayers/ol3/pull/3727) - Added getOverviewMap getter method in overviewmapcontrol.js ([@bogdanvaduva](https://github.com/bogdanvaduva))

View File

@@ -1,11 +0,0 @@
# v3.11.1
## Summary
The v3.11.1 release is a patch release that addresses a few regressions in the v3.11.0 release. See the [v3.11.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.11.0) for details on upgrading from v3.10.
## Fixes
* [#4413](https://github.com/openlayers/ol3/pull/4413) - Revert "Merge pull request #4339 from bartvde/issue-4337" ([@bartvde](https://github.com/bartvde))
* [#4412](https://github.com/openlayers/ol3/pull/4412) - Revert "Merge pull request #4344 from bartvde/issue-2844" ([@ahocevar](https://github.com/ahocevar))
* [#4408](https://github.com/openlayers/ol3/pull/4408) - Use ratio when calculating ImageWMS width and height ([@ahocevar](https://github.com/ahocevar))

View File

@@ -1,11 +0,0 @@
# v3.11.2
## Summary
The v3.11.2 release is a patch release that addresses a few regressions in the v3.11.1 release. See the [v3.11.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.11.0) for details on upgrading from v3.10.
## Fixes
* [#4450](https://github.com/openlayers/ol3/pull/4450) - Fix select interaction regression caused by #4391 ([@ahocevar](https://github.com/ahocevar))
* [#4448](https://github.com/openlayers/ol3/pull/4448) - Check ol.source.UrlTile#urls property for null value ([@fredj](https://github.com/fredj))
* [#4439](https://github.com/openlayers/ol3/pull/4439) - Allow '' for crossOrigin (as Anonymous alias) ([@ahocevar](https://github.com/ahocevar))

View File

@@ -1,96 +0,0 @@
# v3.12.0
## Summary
The v3.12.0 release includes features and fixes from 71 pull requests since the v3.11.2 release. New features and improvements include:
* Tile coordinate wrapping for raster reprojection.
* Support for multi-line labels.
* Allow rendering geometries to an arbitrary canvas (useful for vector legends).
## Upgrade notes
#### `ol.Map#forEachFeatureAtPixel` changes
The optional `layerFilter` function is now also called for unmanaged layers. To get the same behaviour as before, wrap your layer filter code in an if block like this:
```js
function layerFilter(layer) {
if (map.getLayers().getArray().indexOf(layer) !== -1) {
// existing layer filter code
}
}
```
## Full list of changes
* [#4559](https://github.com/openlayers/ol3/pull/4559) - Fix up failing KML test in Firefox ([@bartvde](https://github.com/bartvde))
* [#4561](https://github.com/openlayers/ol3/pull/4561) - Exclude feature loader MVT test from IE9 ([@bartvde](https://github.com/bartvde))
* [#4552](https://github.com/openlayers/ol3/pull/4552) - Make sure compiled code calls ol.VectorTile#setProjection ([@ahocevar](https://github.com/ahocevar))
* [#4551](https://github.com/openlayers/ol3/pull/4551) - Handle tile coordinate wrapping when reprojecting raster tiles ([@klokantech](https://github.com/klokantech))
* [#4544](https://github.com/openlayers/ol3/pull/4544) - Update vector-tile to version 1.2.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4537](https://github.com/openlayers/ol3/pull/4537) - Allow specifying non default DPI on ol.source.TileArcGISRest ([@bartvde](https://github.com/bartvde))
* [#4548](https://github.com/openlayers/ol3/pull/4548) - Improve vector tile related docs ([@ahocevar](https://github.com/ahocevar))
* [#4549](https://github.com/openlayers/ol3/pull/4549) - Update vector label example ([@tsauerwein](https://github.com/tsauerwein))
* [#4512](https://github.com/openlayers/ol3/pull/4512) - Support for multi-line labels (improved) ([@flightaware](https://github.com/flightaware))
* [#4546](https://github.com/openlayers/ol3/pull/4546) - Update coveralls to version 2.11.6 🚀 ([@openlayers](https://github.com/openlayers))
* [#4539](https://github.com/openlayers/ol3/pull/4539) - Ignore index.html in example list ([@fredj](https://github.com/fredj))
* [#4536](https://github.com/openlayers/ol3/pull/4536) - Register the change callback when the tile is enqueued ([@fredj](https://github.com/fredj))
* [#4528](https://github.com/openlayers/ol3/pull/4528) - Remove redundant code from ol.featureloader.tile ([@ahocevar](https://github.com/ahocevar))
* [#4535](https://github.com/openlayers/ol3/pull/4535) - Do not use an array for a single style ([@ahocevar](https://github.com/ahocevar))
* [#4532](https://github.com/openlayers/ol3/pull/4532) - Mark olx.source.WMTSOptions#dimensions as not null ([@fredj](https://github.com/fredj))
* [#4530](https://github.com/openlayers/ol3/pull/4530) - Remove use of goog.isNull ([@fredj](https://github.com/fredj))
* [#4529](https://github.com/openlayers/ol3/pull/4529) - Update coding style rules ([@fredj](https://github.com/fredj))
* [#4518](https://github.com/openlayers/ol3/pull/4518) - Add support for OSM vector tiles ([@ahocevar](https://github.com/ahocevar))
* [#4524](https://github.com/openlayers/ol3/pull/4524) - Add example for rendering custom point symbols ([@ahocevar](https://github.com/ahocevar))
* [#4523](https://github.com/openlayers/ol3/pull/4523) - Allow rendering geometries to an arbitrary canvas ([@ahocevar](https://github.com/ahocevar))
* [#4525](https://github.com/openlayers/ol3/pull/4525) - Make render tests work on more devices ([@ahocevar](https://github.com/ahocevar))
* [#4515](https://github.com/openlayers/ol3/pull/4515) - Accept HTMLCanvasElement for an icon's img ([@ahocevar](https://github.com/ahocevar))
* [#4521](https://github.com/openlayers/ol3/pull/4521) - Fix imagestyle docs ([@ahocevar](https://github.com/ahocevar))
* [#4508](https://github.com/openlayers/ol3/pull/4508) - Remove unused files ([@fredj](https://github.com/fredj))
* [#4487](https://github.com/openlayers/ol3/pull/4487) - Remove fallback css color ([@fredj](https://github.com/fredj))
* [#4502](https://github.com/openlayers/ol3/pull/4502) - Improve ol.source.WMTS.optionsFromCapabilities jsdoc layout ([@fredj](https://github.com/fredj))
* [#4511](https://github.com/openlayers/ol3/pull/4511) - Minor code cleanup ([@fredj](https://github.com/fredj))
* [#4510](https://github.com/openlayers/ol3/pull/4510) - Adding a check just in case the projection is not defined/supported ([@GeoCat](https://github.com/GeoCat))
* [#4505](https://github.com/openlayers/ol3/pull/4505) - Remove use of goog.object.getKeys ([@fredj](https://github.com/fredj))
* [#4472](https://github.com/openlayers/ol3/pull/4472) - Do not ignore layer filter for unmanaged layers ([@ahocevar](https://github.com/ahocevar))
* [#4476](https://github.com/openlayers/ol3/pull/4476) - Remove use of goog.functions.constant ([@fredj](https://github.com/fredj))
* [#4484](https://github.com/openlayers/ol3/pull/4484) - Remove use of goog.dom.createDom ([@fredj](https://github.com/fredj))
* [#4486](https://github.com/openlayers/ol3/pull/4486) - Remove note about DragZoom and vector support ([@fredj](https://github.com/fredj))
* [#4483](https://github.com/openlayers/ol3/pull/4483) - Remove use of goog.object.containsKey ([@fredj](https://github.com/fredj))
* [#4475](https://github.com/openlayers/ol3/pull/4475) - Fix up failing tests in Internet Explorer ([@bartvde](https://github.com/bartvde))
* [#4485](https://github.com/openlayers/ol3/pull/4485) - Use appendChild instead of goog.dom.append ([@fredj](https://github.com/fredj))
* [#4481](https://github.com/openlayers/ol3/pull/4481) - Remove blur workaround in ol.control.Attribution ([@fredj](https://github.com/fredj))
* [#4479](https://github.com/openlayers/ol3/pull/4479) - Export ol.interaction.Interaction#getMap function ([@fredj](https://github.com/fredj))
* [#4478](https://github.com/openlayers/ol3/pull/4478) - Fix olx.control.FullScreenOptions#label apidoc ([@fredj](https://github.com/fredj))
* [#4477](https://github.com/openlayers/ol3/pull/4477) - Replace goog.nullFunction with ol.nullFunction ([@fredj](https://github.com/fredj))
* [#4474](https://github.com/openlayers/ol3/pull/4474) - Remove use of goog.dom.createElement and goog.dom.createTextNode ([@fredj](https://github.com/fredj))
* [#4469](https://github.com/openlayers/ol3/pull/4469) - Upgrade to JSTS 0.17.0 in example ([@bjornharrtell](https://github.com/bjornharrtell))
* [#4465](https://github.com/openlayers/ol3/pull/4465) - Update handlebars to version 4.0.5 🚀 ([@openlayers](https://github.com/openlayers))
* [#4464](https://github.com/openlayers/ol3/pull/4464) - Merge in changes from the 3.11.2 release. ([@openlayers](https://github.com/openlayers))
* [#4463](https://github.com/openlayers/ol3/pull/4463) - Remove use of goog.array.sort ([@fredj](https://github.com/fredj))
* [#4450](https://github.com/openlayers/ol3/pull/4450) - Fix select interaction regression caused by #4391 ([@ahocevar](https://github.com/ahocevar))
* [#4458](https://github.com/openlayers/ol3/pull/4458) - Remove extra space in type annotation ([@fredj](https://github.com/fredj))
* [#4420](https://github.com/openlayers/ol3/pull/4420) - Remove Bootstrap and jQuery from example snippets. ([@openlayers](https://github.com/openlayers))
* [#4442](https://github.com/openlayers/ol3/pull/4442) - Use jsdoc@3.4.0. ([@tschaub](https://github.com/tschaub))
* [#4449](https://github.com/openlayers/ol3/pull/4449) - Change the label of the full screen button to be more intuitive ([@bartvde](https://github.com/bartvde))
* [#4448](https://github.com/openlayers/ol3/pull/4448) - Check ol.source.UrlTile#urls property for null value ([@fredj](https://github.com/fredj))
* [#4440](https://github.com/openlayers/ol3/pull/4440) - Raster reprojection tutorial ([@klokantech](https://github.com/klokantech))
* [#4439](https://github.com/openlayers/ol3/pull/4439) - Allow '' for crossOrigin (as Anonymous alias) ([@ahocevar](https://github.com/ahocevar))
* [#4429](https://github.com/openlayers/ol3/pull/4429) - Dispatch a change event only if the value changes ([@fredj](https://github.com/fredj))
* [#4435](https://github.com/openlayers/ol3/pull/4435) - Remove unnecessary cast ([@fredj](https://github.com/fredj))
* [#4434](https://github.com/openlayers/ol3/pull/4434) - Remove unused local variables ([@fredj](https://github.com/fredj))
* [#4433](https://github.com/openlayers/ol3/pull/4433) - Remove unused local variables ([@fredj](https://github.com/fredj))
* [#4140](https://github.com/openlayers/ol3/pull/4140) - Add flight animation example ([@tsauerwein](https://github.com/tsauerwein))
* [#4428](https://github.com/openlayers/ol3/pull/4428) - Add imageSize regression test for ol.source.ImageWMS ([@ahocevar](https://github.com/ahocevar))
* [#4426](https://github.com/openlayers/ol3/pull/4426) - Improve ol.source.StaticImage ([@ahocevar](https://github.com/ahocevar))
* [#4425](https://github.com/openlayers/ol3/pull/4425) - Test number property with !== undefined ([@fredj](https://github.com/fredj))
* [#4423](https://github.com/openlayers/ol3/pull/4423) - Update mocha to version 2.3.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4416](https://github.com/openlayers/ol3/pull/4416) - Update clean-css to version 3.4.8 🚀 ([@openlayers](https://github.com/openlayers))
* [#4415](https://github.com/openlayers/ol3/pull/4415) - Scale StaticImage image to imageExtent ([@ahocevar](https://github.com/ahocevar))
* [#4414](https://github.com/openlayers/ol3/pull/4414) - Remove ol.ImageUrlFunction ([@ahocevar](https://github.com/ahocevar))
* [#4389](https://github.com/openlayers/ol3/pull/4389) - Smooth transitions on parameter changes ([@elemoine](https://github.com/elemoine))
* [#4410](https://github.com/openlayers/ol3/pull/4410) - Merge in changes from the 3.11.1 release. ([@openlayers](https://github.com/openlayers))
* [#4401](https://github.com/openlayers/ol3/pull/4401) - Allow style function to return a style. ([@tschaub](https://github.com/tschaub))
* [#4404](https://github.com/openlayers/ol3/pull/4404) - Set correctly the opt_this parameter when writing a KML document ([@oterral](https://github.com/oterral))
* [#4397](https://github.com/openlayers/ol3/pull/4397) - Update glob to version 6.0.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4362](https://github.com/openlayers/ol3/pull/4362) - Rotate control now takes optional resetNorth function. ([@tamarmot](https://github.com/tamarmot))

View File

@@ -1,11 +0,0 @@
# v3.12.1
## Summary
The v3.12.1 release is a patch release that addresses a few regressions in the v3.12.0 release. See the [v3.12.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.12.0) for details on upgrading from v3.11.
## Fixes
* [#4578](https://github.com/openlayers/ol3/pull/4578) - Fix apidoc landing page markup ([@ahocevar](https://github.com/ahocevar))
* [#4570](https://github.com/openlayers/ol3/pull/4570) - Rename defaultSort to numberSafeCompareFunction on ol.array ([@bartvde](https://github.com/bartvde))
* [#4567](https://github.com/openlayers/ol3/pull/4567) - Always pass on a compare function to sort ([@bartvde](https://github.com/bartvde))

View File

@@ -1,109 +0,0 @@
# v3.13.0
## Summary
The v3.13.0 release includes features and fixes from 68 pull requests since the v3.12.1 release. New features and improvements include:
* Improved tiles rendering for the canvas renderer
* Improved MapQuest rendering
* Add color option to ol.style.Icon
* Load TileJSON sources via XMLHttpRequest by default
* Add new ol.geom.LineString#getCoordinateAt function
* Simplify meters per unit handling
* Use ESLint as a replacement for gjslint.py and jshint
## Upgrade notes
#### `proj4js` integration
Before this release, OpenLayers depended on the global proj4 namespace. When using a module loader like Browserify, you might not want to depend on the global `proj4` namespace. You can use the `ol.proj.setProj4` function to set the proj4 function object. For example in a browserify ES6 environment:
```js
import ol from 'openlayers';
import proj4 from 'proj4';
ol.proj.setProj4(proj4);
```
#### `ol.source.TileJSON` changes
The `ol.source.TileJSON` now uses `XMLHttpRequest` to load the TileJSON instead of JSONP with callback.
When using server without proper CORS support, `jsonp: true` option can be passed to the constructor to get the same behavior as before:
```js
new ol.source.TileJSON({
url: 'http://serverwithoutcors.com/tilejson.json',
jsonp: true
})
```
Also for Mapbox v3, make sure you use urls ending with `.json` (which are able to handle both `XMLHttpRequest` and JSONP) instead of `.jsonp`.
## Full list of changes
* [#4694](https://github.com/openlayers/ol3/pull/4694) - Fix eslint errors in wms-time example ([@fredj](https://github.com/fredj))
* [#4527](https://github.com/openlayers/ol3/pull/4527) - Add support for smooth TileWMS dimensions ([@bartvde](https://github.com/bartvde))
* [#4691](https://github.com/openlayers/ol3/pull/4691) - Updated Bing Maps key. ([@tschaub](https://github.com/tschaub))
* [#4673](https://github.com/openlayers/ol3/pull/4673) - Respect fixed tile url functions when setting url(s) ([@ahocevar](https://github.com/ahocevar))
* [#4689](https://github.com/openlayers/ol3/pull/4689) - Revert "Do not render in handleDownEvent" ([@openlayers](https://github.com/openlayers))
* [#4688](https://github.com/openlayers/ol3/pull/4688) - Give map a focus-outline in accessible-example ([@marcjansen](https://github.com/marcjansen))
* [#4642](https://github.com/openlayers/ol3/pull/4642) - Move the icon style color to its own example ([@alexbrault](https://github.com/alexbrault))
* [#4685](https://github.com/openlayers/ol3/pull/4685) - Remove bin/check-whitespace.py ([@fredj](https://github.com/fredj))
* [#4684](https://github.com/openlayers/ol3/pull/4684) - Update eslint-config-openlayers to version 3.0.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4677](https://github.com/openlayers/ol3/pull/4677) - Make pixel projection handling work in compiled mode ([@ahocevar](https://github.com/ahocevar))
* [#4639](https://github.com/openlayers/ol3/pull/4639) - Remove use of goog.bind and use ES5 .bind. ([@nicholas-l](https://github.com/nicholas-l))
* [#4655](https://github.com/openlayers/ol3/pull/4655) - Update browserify to version 13.0.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4666](https://github.com/openlayers/ol3/pull/4666) - Add a 'boxdrag' event to ol.interaction.DragBox. Resolves #4563 . ([@WeaveTeam](https://github.com/WeaveTeam))
* [#4669](https://github.com/openlayers/ol3/pull/4669) - Remove reference to Closure Linter in CONTRIBUTING.md ([@fredj](https://github.com/fredj))
* [#4665](https://github.com/openlayers/ol3/pull/4665) - Update istanbul to version 0.4.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4663](https://github.com/openlayers/ol3/pull/4663) - Update glob to version 6.0.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4667](https://github.com/openlayers/ol3/pull/4667) - Fix rendering of transparent MapQuest layer type ([@klokantech](https://github.com/klokantech))
* [#4661](https://github.com/openlayers/ol3/pull/4661) - Fixes #4654 Developer Documentation Updated ([@gaf-ag](https://github.com/gaf-ag))
* [#4658](https://github.com/openlayers/ol3/pull/4658) - Update jquery to version 2.2.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4659](https://github.com/openlayers/ol3/pull/4659) - Make sure icons show up in Safari ([@bartvde](https://github.com/bartvde))
* [#4652](https://github.com/openlayers/ol3/pull/4652) - Use map.getTargetElement instead of map.getTarget ([@fredj](https://github.com/fredj))
* [#4649](https://github.com/openlayers/ol3/pull/4649) - Missing parameter description for ol.source.Tile#getOpaque ([@klokantech](https://github.com/klokantech))
* [#4602](https://github.com/openlayers/ol3/pull/4602) - Use ESLint. ([@tschaub](https://github.com/tschaub))
* [#4628](https://github.com/openlayers/ol3/pull/4628) - Fix for reprojecting opaque tile sources ([@klokantech](https://github.com/klokantech))
* [#4618](https://github.com/openlayers/ol3/pull/4618) - Update resemblejs to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4647](https://github.com/openlayers/ol3/pull/4647) - Proper rounding for possibly negative numbers ([@ahocevar](https://github.com/ahocevar))
* [#4641](https://github.com/openlayers/ol3/pull/4641) - Remove extra options from icon example. ([@tschaub](https://github.com/tschaub))
* [#4629](https://github.com/openlayers/ol3/pull/4629) - Simplify scaleline calculation ([@ahocevar](https://github.com/ahocevar))
* [#4457](https://github.com/openlayers/ol3/pull/4457) - Add color option to ol.style.Icon ([@alexbrault](https://github.com/alexbrault))
* [#4638](https://github.com/openlayers/ol3/pull/4638) - Do not rely on projection extent ([@ahocevar](https://github.com/ahocevar))
* [#4635](https://github.com/openlayers/ol3/pull/4635) - Update async to version 1.5.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4581](https://github.com/openlayers/ol3/pull/4581) - Do not render in handleDownEvent ([@ahocevar](https://github.com/ahocevar))
* [#4541](https://github.com/openlayers/ol3/pull/4541) - Add new ol.geom.LineString#getCoordinateAt function ([@fredj](https://github.com/fredj))
* [#4489](https://github.com/openlayers/ol3/pull/4489) - Update phantomjs to version 1.9.19 🚀 ([@openlayers](https://github.com/openlayers))
* [#4625](https://github.com/openlayers/ol3/pull/4625) - Use XHR by default to load TileJSON in ol.source.TileJSON ([@klokantech](https://github.com/klokantech))
* [#4622](https://github.com/openlayers/ol3/pull/4622) - Update fs-extra to version 0.26.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4630](https://github.com/openlayers/ol3/pull/4630) - Simplify meters per unit handling ([@ahocevar](https://github.com/ahocevar))
* [#4490](https://github.com/openlayers/ol3/pull/4490) - Update istanbul to version 0.4.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4574](https://github.com/openlayers/ol3/pull/4574) - Added boxEndCondition to DragBoxOptions to replace the hardcoded chec… ([@WeaveTeam](https://github.com/WeaveTeam))
* [#4553](https://github.com/openlayers/ol3/pull/4553) - Update mustache to version 2.2.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4626](https://github.com/openlayers/ol3/pull/4626) - Fixed documentation error ([@simonseyock](https://github.com/simonseyock))
* [#4606](https://github.com/openlayers/ol3/pull/4606) - Include originating MapBrowserEvent in ol.DragBoxEvent ([@fredj](https://github.com/fredj))
* [#4614](https://github.com/openlayers/ol3/pull/4614) - Remove checksum interface. ([@tschaub](https://github.com/tschaub))
* [#4613](https://github.com/openlayers/ol3/pull/4613) - Include own layer in layerFilter and only select unselected features ([@ahocevar](https://github.com/ahocevar))
* [#4612](https://github.com/openlayers/ol3/pull/4612) - Set oli.source.VectorEvent#feature to ol.Feature|undefined ([@fredj](https://github.com/fredj))
* [#4620](https://github.com/openlayers/ol3/pull/4620) - Fix olx.format.PolylineOptions#factor type ([@fredj](https://github.com/fredj))
* [#4621](https://github.com/openlayers/ol3/pull/4621) - Fix olx.format.GPXOptions#readExtensions type ([@fredj](https://github.com/fredj))
* [#4619](https://github.com/openlayers/ol3/pull/4619) - Add option to load TileJSON via XHR ([@klokantech](https://github.com/klokantech))
* [#4617](https://github.com/openlayers/ol3/pull/4617) - Add missing return type to GeoJSON format ([@gberaudo](https://github.com/gberaudo))
* [#4615](https://github.com/openlayers/ol3/pull/4615) - Adjust copyright to include 2016 ([@marcjansen](https://github.com/marcjansen))
* [#4616](https://github.com/openlayers/ol3/pull/4616) - Update closure-util to version 1.10.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4596](https://github.com/openlayers/ol3/pull/4596) - Use consistent tile coordinate keys ([@ahocevar](https://github.com/ahocevar))
* [#4609](https://github.com/openlayers/ol3/pull/4609) - Add ol.proj.setProj4 function ([@bartvde](https://github.com/bartvde))
* [#4603](https://github.com/openlayers/ol3/pull/4603) - Update async to version 1.5.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4604](https://github.com/openlayers/ol3/pull/4604) - Update clean-css to version 3.4.9 🚀 ([@openlayers](https://github.com/openlayers))
* [#4600](https://github.com/openlayers/ol3/pull/4600) - Update glob to version 6.0.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4595](https://github.com/openlayers/ol3/pull/4595) - Pass 'opaque' option on to superclass ([@ahocevar](https://github.com/ahocevar))
* [#4598](https://github.com/openlayers/ol3/pull/4598) - Make ol.source.Tile#getTilePixelRatio work correctly for all sources ([@klokantech](https://github.com/klokantech))
* [#4594](https://github.com/openlayers/ol3/pull/4594) - Fix for TileQueue gradually choking up when using raster reprojection ([@klokantech](https://github.com/klokantech))
* [#4557](https://github.com/openlayers/ol3/pull/4557) - Conditionally render tiles to a separate tile canvas ([@ahocevar](https://github.com/ahocevar))
* [#4580](https://github.com/openlayers/ol3/pull/4580) - Update fs-extra to version 0.26.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4579](https://github.com/openlayers/ol3/pull/4579) - Release v3.12.1 ([@openlayers](https://github.com/openlayers))
* [#4578](https://github.com/openlayers/ol3/pull/4578) - Fix apidoc landing page markup ([@ahocevar](https://github.com/ahocevar))
* [#4575](https://github.com/openlayers/ol3/pull/4575) - Update rbush to version 1.4.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4571](https://github.com/openlayers/ol3/pull/4571) - Correct typedef of selectinteraction options obj ([@marcjansen](https://github.com/marcjansen))
* [#4570](https://github.com/openlayers/ol3/pull/4570) - Rename defaultSort to numberSafeCompareFunction on ol.array ([@bartvde](https://github.com/bartvde))
* [#4567](https://github.com/openlayers/ol3/pull/4567) - Always pass on a compare function to sort ([@bartvde](https://github.com/bartvde))
* [#4001](https://github.com/openlayers/ol3/pull/4001) - Export PDF's using jsPDF ([@bartvde](https://github.com/bartvde))

View File

@@ -1,10 +0,0 @@
# v3.13.1
## Summary
The v3.13.1 release is a patch release that addresses a few regressions in the v3.13.0 release. See the [v3.13.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.13.0) for details on upgrading from v3.12.
## Fixes
* [#4736](https://github.com/openlayers/ol3/pull/4736) - Properly detect feature on unmanaged layer for toggle selection ([@ahocevar](https://github.com/ahocevar))
* [#4777](https://github.com/openlayers/ol3/pull/4777) - Fix source.UrlTile URL expansion ([@gberaudo](https://github.com/gberaudo))

View File

@@ -1,154 +0,0 @@
# v3.14.0
## Summary
The v3.14.0 release includes features and fixes from 93 pull requests since the v3.13.1 release. New features and improvements include:
* New `source` option for the `ol.control.FullScreen`, to allow including other elements besides the map in a full screen view (#4679).
* New `target` property for the Drag&Drop interaction allows using a different drop target than the map viewport (#4876).
* `ol.style.RegularShape` has a new `rotateWithView` option, for controlling how regular shape symbols are rendered on rotated views (#4698).
* New `layers` option for `ol.format.WMSGetFeatureInfo` format, to selectively only read features from specific layers (#4700).
* New `precision` parameter for formatting coordinates with `ol.coordinate.toStringHDMS` (#4787).
* Smarter tile queue for improved tile loading user experience when more than one tile layer is used (#4794).
* Improved rendering performance for tile layers by rendering tiles directly to the map canvas (#4597).
* The `goog.events` event system was replaced with our own lightweight event system. This significally reduces the build size (#4711). Replacement of other `goog.*` components with ES5 features or custom code marks a huge step towards the complete removal of the Closure Library dependency.
## Upgrade notes
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
#### Layer pre-/postcompose event changes
It is the responsibility of the application to undo any canvas transform changes at the end of a layer 'precompose' or 'postcompose' handler. Previously, it was ok to set a null transform. The API now guarantees a device pixel coordinate system on the canvas with its origin in the top left corner of the map. However, applications should not rely on the underlying canvas being the same size as the visible viewport.
Old code:
```js
layer.on('precompose', function(e) {
// rely on canvas dimensions to move coordinate origin to center
e.context.translate(e.context.canvas.width / 2, e.context.canvas.height / 2);
e.context.scale(3, 3);
// draw an x in the center of the viewport
e.context.moveTo(-20, -20);
e.context.lineTo(20, 20);
e.context.moveTo(-20, 20);
e.context.lineTo(20, -20);
// rely on the canvas having a null transform
e.context.setTransform(1, 0, 0, 1, 0, 0);
});
```
New code:
```js
layer.on('precompose', function(e) {
// use map size and pixel ratio to move coordinate origin to center
var size = map.getSize();
var pixelRatio = e.frameState.pixelRatio;
e.context.translate(size[0] / 2 * pixelRatio, size[1] / 2 * pixelRatio);
e.context.scale(3, 3);
// draw an x in the center of the viewport
e.context.moveTo(-20, -20);
e.context.lineTo(20, 20);
e.context.moveTo(-20, 20);
e.context.lineTo(20, -20);
// undo all transforms
e.context.scale(1 / 3, 1 / 3);
e.context.translate(-size[0] / 2 * pixelRatio, -size[1] / 2 * pixelRatio);
});
```
## Full list of changes
* [#4896](https://github.com/openlayers/ol3/pull/4896) - Ignore XML sequence when comparing GML ([@ahocevar](https://github.com/ahocevar))
* [#4890](https://github.com/openlayers/ol3/pull/4890) - ol.format.KML cleanup ([@fredj](https://github.com/fredj))
* [#4894](https://github.com/openlayers/ol3/pull/4894) - Only run raster operations after image sources have loaded. ([@tschaub](https://github.com/tschaub))
* [#4892](https://github.com/openlayers/ol3/pull/4892) - Stricter check for ImageData constructor ([@ahocevar](https://github.com/ahocevar))
* [#4891](https://github.com/openlayers/ol3/pull/4891) - Fix tests so they all pass in IE9 ([@ahocevar](https://github.com/ahocevar))
* [#4889](https://github.com/openlayers/ol3/pull/4889) - Use requestAnimation polyfill for examples and update release notes ([@ahocevar](https://github.com/ahocevar))
* [#4887](https://github.com/openlayers/ol3/pull/4887) - Use less aggressive DOM function overrides ([@ahocevar](https://github.com/ahocevar))
* [#4885](https://github.com/openlayers/ol3/pull/4885) - Mark overlayContainer and overlayContainerStopEvent as non-nullable ([@fredj](https://github.com/fredj))
* [#4884](https://github.com/openlayers/ol3/pull/4884) - Remove use of goog.math.isFiniteNumber() ([@fredj](https://github.com/fredj))
* [#4881](https://github.com/openlayers/ol3/pull/4881) - Update jquery to version 2.2.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#4780](https://github.com/openlayers/ol3/pull/4780) - Adapt the code for the new closure-compiler version ([@fredj](https://github.com/fredj))
* [#3453](https://github.com/openlayers/ol3/pull/3453) - Consider multi in add/remove/toggle select logic ([@bjornharrtell](https://github.com/bjornharrtell))
* [#4876](https://github.com/openlayers/ol3/pull/4876) - Add `target` property to Drag&Drop interaction ([@tsauerwein](https://github.com/tsauerwein))
* [#4854](https://github.com/openlayers/ol3/pull/4854) - Always report skipped feature hits for the original layer ([@ahocevar](https://github.com/ahocevar))
* [#4877](https://github.com/openlayers/ol3/pull/4877) - Update eslint to version 2.2.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4870](https://github.com/openlayers/ol3/pull/4870) - Reuse dragListenerKeys_ local variable ([@fredj](https://github.com/fredj))
* [#4721](https://github.com/openlayers/ol3/pull/4721) - Fix reprojection of raster sources with gutter ([@klokantech](https://github.com/klokantech))
* [#4874](https://github.com/openlayers/ol3/pull/4874) - Assert we have a feature id ([@bartvde](https://github.com/bartvde))
* [#4869](https://github.com/openlayers/ol3/pull/4869) - Improve precision of ol.reproj.render ([@klokantech](https://github.com/klokantech))
* [#4866](https://github.com/openlayers/ol3/pull/4866) - Use requestAnimationFrame polyfill (for IE9) ([@ahocevar](https://github.com/ahocevar))
* [#4863](https://github.com/openlayers/ol3/pull/4863) - Remove use of goog.dom.createElement ([@fredj](https://github.com/fredj))
* [#4864](https://github.com/openlayers/ol3/pull/4864) - Use querySelectorAll instead of goog.dom.getElementsByClass ([@fredj](https://github.com/fredj))
* [#4597](https://github.com/openlayers/ol3/pull/4597) - Render tiles directly to the map canvas ([@ahocevar](https://github.com/ahocevar))
* [#4862](https://github.com/openlayers/ol3/pull/4862) - Add OSGeo badge ([@ahocevar](https://github.com/ahocevar))
* [#4845](https://github.com/openlayers/ol3/pull/4845) - Fix geolocation error cast ([@gberaudo](https://github.com/gberaudo))
* [#4851](https://github.com/openlayers/ol3/pull/4851) - Don't use goog.isBoolean() ([@marcjansen](https://github.com/marcjansen))
* [#4852](https://github.com/openlayers/ol3/pull/4852) - Don't use goog.isString() ([@marcjansen](https://github.com/marcjansen))
* [#4849](https://github.com/openlayers/ol3/pull/4849) - Fix docs of LogoOptions.prototype.src ([@openlayers](https://github.com/openlayers))
* [#4794](https://github.com/openlayers/ol3/pull/4794) - Make tile loading count no longer depend on source count ([@ahocevar](https://github.com/ahocevar))
* [#4843](https://github.com/openlayers/ol3/pull/4843) - Remove use of goog.dom.getParentElement ([@fredj](https://github.com/fredj))
* [#4839](https://github.com/openlayers/ol3/pull/4839) - Add template type to ol.Collection ([@fredj](https://github.com/fredj))
* [#4847](https://github.com/openlayers/ol3/pull/4847) - Update eslint to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#4632](https://github.com/openlayers/ol3/pull/4632) - Overloading fill color (polygon or text) with CanvasPattern and CanvasGradient ([@bjnsn](https://github.com/bjnsn))
* [#4842](https://github.com/openlayers/ol3/pull/4842) - Remove use of goog.dom.createDom ([@fredj](https://github.com/fredj))
* [#4808](https://github.com/openlayers/ol3/pull/4808) - Type cleanup ([@fredj](https://github.com/fredj))
* [#4737](https://github.com/openlayers/ol3/pull/4737) - Use olx.format.ReadOptions in ol.interaction.DragAndDrop ([@fredj](https://github.com/fredj))
* [#4830](https://github.com/openlayers/ol3/pull/4830) - Make sure window.proj4 is always restored in tests ([@ahocevar](https://github.com/ahocevar))
* [#4838](https://github.com/openlayers/ol3/pull/4838) - Use regular expression instead of String#endsWith() check ([@ahocevar](https://github.com/ahocevar))
* [#4837](https://github.com/openlayers/ol3/pull/4837) - Update metalsmith-layouts to version 1.5.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4836](https://github.com/openlayers/ol3/pull/4836) - Use lowercase for all user agent checks ([@ahocevar](https://github.com/ahocevar))
* [#4833](https://github.com/openlayers/ol3/pull/4833) - Upgrade linter and config. ([@tschaub](https://github.com/tschaub))
* [#4831](https://github.com/openlayers/ol3/pull/4831) - Add navigation header to examples page ([@jonataswalker](https://github.com/jonataswalker))
* [#4824](https://github.com/openlayers/ol3/pull/4824) - Don't use goog.string.newlines.* ([@marcjansen](https://github.com/marcjansen))
* [#4825](https://github.com/openlayers/ol3/pull/4825) - Don't use goog.string.isEmpty ([@marcjansen](https://github.com/marcjansen))
* [#4823](https://github.com/openlayers/ol3/pull/4823) - Fix type for layers option on ol.interaction.Select ([@ahocevar](https://github.com/ahocevar))
* [#4815](https://github.com/openlayers/ol3/pull/4815) - wrapX false in synthetic examples ([@fredj](https://github.com/fredj))
* [#4810](https://github.com/openlayers/ol3/pull/4810) - Add checks for undefined in controls ([@gberaudo](https://github.com/gberaudo))
* [#4787](https://github.com/openlayers/ol3/pull/4787) - Add precision parameter for HDMS coordinate ([@pfanguin](https://github.com/pfanguin))
* [#4811](https://github.com/openlayers/ol3/pull/4811) - Make ol.style.Style a @struct ([@fredj](https://github.com/fredj))
* [#4800](https://github.com/openlayers/ol3/pull/4800) - Update phantomjs-prebuilt to version 2.1.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4792](https://github.com/openlayers/ol3/pull/4792) - Use ol.events.listen instead of ol.Observable#on ([@fredj](https://github.com/fredj))
* [#4796](https://github.com/openlayers/ol3/pull/4796) - Remove use of goog.isString() ([@marcjansen](https://github.com/marcjansen))
* [#4795](https://github.com/openlayers/ol3/pull/4795) - Cleanup after goog.array, goog.object and goog.isDef removal ([@ahocevar](https://github.com/ahocevar))
* [#4791](https://github.com/openlayers/ol3/pull/4791) - Remove unnecessary cast ([@fredj](https://github.com/fredj))
* [#4778](https://github.com/openlayers/ol3/pull/4778) - Remove use of goog.object. ([@tschaub](https://github.com/tschaub))
* [#4789](https://github.com/openlayers/ol3/pull/4789) - Use ol.array instead of goog.array ([@fredj](https://github.com/fredj))
* [#4788](https://github.com/openlayers/ol3/pull/4788) - Remove unnecessary newlines ([@fredj](https://github.com/fredj))
* [#4731](https://github.com/openlayers/ol3/pull/4731) - Remove all remaining unnecessary casts ([@gberaudo](https://github.com/gberaudo))
* [#4776](https://github.com/openlayers/ol3/pull/4776) - Correct assertion message in ol.array.binarySearch-test ([@marcjansen](https://github.com/marcjansen))
* [#4711](https://github.com/openlayers/ol3/pull/4711) - Removal of goog.events.* ([@ahocevar](https://github.com/ahocevar))
* [#4777](https://github.com/openlayers/ol3/pull/4777) - Fix source.UrlTile URL expansion ([@gberaudo](https://github.com/gberaudo))
* [#4730](https://github.com/openlayers/ol3/pull/4730) - Document ol.Geolocation error event ([@fredj](https://github.com/fredj))
* [#4772](https://github.com/openlayers/ol3/pull/4772) - Use node.setAttribute to set namespaceURI of a node ([@adube](https://github.com/adube))
* [#4774](https://github.com/openlayers/ol3/pull/4774) - Update graceful-fs to version 4.1.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4680](https://github.com/openlayers/ol3/pull/4680) - Remove goog array. ([@nicholas-l](https://github.com/nicholas-l))
* [#4771](https://github.com/openlayers/ol3/pull/4771) - Use innerHTML instead of innerText to populate the status element ([@fredj](https://github.com/fredj))
* [#4769](https://github.com/openlayers/ol3/pull/4769) - Add opaque option to olx.source.OSMOptions ([@fredj](https://github.com/fredj))
* [#4736](https://github.com/openlayers/ol3/pull/4736) - Properly detect feature on unmanaged layer for toggle selection ([@ahocevar](https://github.com/ahocevar))
* [#4756](https://github.com/openlayers/ol3/pull/4756) - Remove VectorTile getSource re-definition of return value ([@adube](https://github.com/adube))
* [#4733](https://github.com/openlayers/ol3/pull/4733) - Avoid rendering too big and too small images for vector tiles ([@ahocevar](https://github.com/ahocevar))
* [#4754](https://github.com/openlayers/ol3/pull/4754) - Upgrade to mocha@2.4.5. ([@tschaub](https://github.com/tschaub))
* [#4750](https://github.com/openlayers/ol3/pull/4750) - Update metalsmith-layouts to version 1.4.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#4751](https://github.com/openlayers/ol3/pull/4751) - Update phantomjs to version 2.1.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4741](https://github.com/openlayers/ol3/pull/4741) - Report on installed versions in Travis. ([@openlayers](https://github.com/openlayers))
* [#4742](https://github.com/openlayers/ol3/pull/4742) - Upgrade to eslint@2.0.0-beta.2. ([@tschaub](https://github.com/tschaub))
* [#4746](https://github.com/openlayers/ol3/pull/4746) - Downgrade to mocha@2.3.4. ([@tschaub](https://github.com/tschaub))
* [#4740](https://github.com/openlayers/ol3/pull/4740) - Update fs-extra to version 0.26.5 🚀 ([@openlayers](https://github.com/openlayers))
* [#4738](https://github.com/openlayers/ol3/pull/4738) - Add unit tests for ol.control.Rotate and ol.control.Zoom ([@fredj](https://github.com/fredj))
* [#4718](https://github.com/openlayers/ol3/pull/4718) - Improve raster reprojection behavior when tiles fail to load ([@klokantech](https://github.com/klokantech))
* [#4734](https://github.com/openlayers/ol3/pull/4734) - Update sinon to version 1.17.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#4726](https://github.com/openlayers/ol3/pull/4726) - Update mocha to version 2.4.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4725](https://github.com/openlayers/ol3/pull/4725) - Untangle vector tile feature reprojection ([@ahocevar](https://github.com/ahocevar))
* [#4735](https://github.com/openlayers/ol3/pull/4735) - Add default value for defaultDataProjection ([@fredj](https://github.com/fredj))
* [#4732](https://github.com/openlayers/ol3/pull/4732) - Fix '@see' link in src/ol/deviceorientation.js ([@fredj](https://github.com/fredj))
* [#4720](https://github.com/openlayers/ol3/pull/4720) - Improve tileLoadFunction docs ([@ahocevar](https://github.com/ahocevar))
* [#4717](https://github.com/openlayers/ol3/pull/4717) - Update phantomjs to version 2.1.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#4679](https://github.com/openlayers/ol3/pull/4679) - Add a source option for the full screen control ([@gaf-ag](https://github.com/gaf-ag))
* [#4712](https://github.com/openlayers/ol3/pull/4712) - Add missing JSDoc tags ([@fredj](https://github.com/fredj))
* [#4700](https://github.com/openlayers/ol3/pull/4700) - Add 'layers' option for WMSGetFeatureInfo format ([@adube](https://github.com/adube))
* [#4705](https://github.com/openlayers/ol3/pull/4705) - Remove remaining unnecessary ol.source.State casts ([@gberaudo](https://github.com/gberaudo))
* [#4703](https://github.com/openlayers/ol3/pull/4703) - Source options fixes. ([@gberaudo](https://github.com/gberaudo))
* [#4698](https://github.com/openlayers/ol3/pull/4698) - Add rotateWithView option to ol.style.RegularShape ([@fredj](https://github.com/fredj))
* [#4697](https://github.com/openlayers/ol3/pull/4697) - Bind tileUrlFunction to the source ([@gberaudo](https://github.com/gberaudo))

View File

@@ -1,10 +0,0 @@
# v3.14.1
## Summary
The v3.14.1 release is a patch release that addresses a few regressions in the v3.14.0 release. See the [v3.14.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.14.0) for details on upgrading from v3.13.x.
## Fixes
* [#4939](https://github.com/openlayers/ol3/pull/4939) - Fix rendering of opaque layers with opacity != 1 ([@ahocevar](https://github.com/ahocevar))
* [#4921](https://github.com/openlayers/ol3/pull/4921) - Unlisten before calling listener and bind to target by default ([@ahocevar](https://github.com/ahocevar))

View File

@@ -24,6 +24,7 @@
"externs/topojson.js" "externs/topojson.js"
], ],
"define": [ "define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true", "goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true", "goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false" "goog.DEBUG=false"

View File

@@ -18,13 +18,13 @@
"externs/example.js", "externs/example.js",
"externs/fastclick.js", "externs/fastclick.js",
"externs/geojson.js", "externs/geojson.js",
"externs/jspdf.js",
"externs/jquery-1.9.js", "externs/jquery-1.9.js",
"externs/proj4js.js", "externs/proj4js.js",
"externs/tilejson.js", "externs/tilejson.js",
"externs/topojson.js" "externs/topojson.js"
], ],
"define": [ "define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true", "goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true", "goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false" "goog.DEBUG=false"

View File

@@ -1,8 +1,8 @@
<!DOCTYPE html> <!doctype html>
<html lang="en-US"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
@@ -11,7 +11,6 @@
<link rel="stylesheet" href="./resources/layout.css" type="text/css"> <link rel="stylesheet" href="./resources/layout.css" type="text/css">
{{{ extraHead.local }}} {{{ extraHead.local }}}
{{{ css.tag }}} {{{ css.tag }}}
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch,requestAnimationFrame"></script>
<script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script> <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
<title>{{ title }}</title> <title>{{ title }}</title>
</head> </head>
@@ -20,28 +19,19 @@
<header class="navbar" role="navigation"> <header class="navbar" role="navigation">
<div class="container" id="navbar-inner-container"> <div class="container" id="navbar-inner-container">
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png">&nbsp;OpenLayers 3 Examples</a> <a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png">&nbsp;OpenLayers 3 Examples</a>
<ul class="nav navbar-nav pull-right">
<li><a href="../doc">Docs</a></li>
<li><a class="active" href="index.html">Examples</a></li>
<li><a href="../apidoc">API</a></li>
<li><a href="https://github.com/openlayers/ol3">Code</a></li>
</ul>
</div> </div>
</header> </header>
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid"> {{{ contents }}}
<div class="span12">
<h4 id="title">{{ title }}</h4>
{{{ contents }}}
</div>
</div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<h4 id="title">{{ title }}</h4>
<p id="shortdesc">{{ shortdesc }}</p> <p id="shortdesc">{{ shortdesc }}</p>
<div id="docs">{{ md docs }}</div> <div id="docs">{{ md docs }}</div>
<div id="tags">{{ tags }}</div>
<div id="api-links">Related API documentation: {{{ js.apiHtml }}}</div> <div id="api-links">Related API documentation: {{{ js.apiHtml }}}</div>
</div> </div>
</div> </div>
@@ -51,33 +41,47 @@
<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="jsfiddle-button"><i class="fa fa-jsfiddle"></i> Edit</a> <a id="jsfiddle-button"><i class="fa fa-jsfiddle"></i> Edit</a>
</div> </div>
<form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/library/pure/"> <form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
<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="wrap" value="l">
<input type="hidden" name="resources" value="http://openlayers.org/en/v{{ olVersion }}/css/ol.css,http://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}"> <input type="hidden" name="resources" value="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js,http://openlayers.org/en/v{{ olVersion }}/css/ol.css,http://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}">
</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;
&lt;head&gt; &lt;head&gt;
&lt;title&gt;{{ title }}&lt;/title&gt; &lt;title&gt;{{ title }}&lt;/title&gt;
&lt;link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css"&gt; &lt;script src="https://code.jquery.com/jquery-1.11.2.min.js"&gt;&lt;/script&gt;
&lt;script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"&gt;&lt;/script&gt;{{#if extraHead.remote}} &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"&gt;
{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}} &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"&gt;&lt;/script&gt;
&lt;style&gt; &lt;link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css"&gt;
{{ indent css.source spaces=6 }} &lt;/style&gt;{{/if}} &lt;script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"&gt;&lt;/script&gt;
&lt;/head&gt; {{ extraHead.remote }}
&lt;body&gt; {{#if css.source}}
{{ indent contents spaces=4 }} &lt;script&gt; &lt;style&gt;
{{ indent js.source spaces=6 }} &lt;/script&gt; {{ css.source }}
&lt;/body&gt; &lt;/style&gt;
{{/if}}
&lt;/head&gt;
&lt;body&gt;
&lt;div class="container-fluid"&gt;
{{ contents }}
&lt;/div&gt;
&lt;script&gt;
{{ js.source }}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre> &lt;/html&gt;</code></pre>
</div> </div>
</div> </div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="./resources/common.js"></script> <script src="./resources/common.js"></script>
<script src="./resources/prism/prism.min.js"></script> <script src="./resources/prism/prism.min.js"></script>
{{{ js.tag }}} {{{ js.tag }}}
</body> </body>
</html> </html>

View File

@@ -16,4 +16,6 @@ To enable this, examples have the following, not needed in application code:
* html files load `resources/common.js` and some scripts use `common.getRendererFromQueryString()` to set the map renderer; application code would not need these * html files load `resources/common.js` and some scripts use `common.getRendererFromQueryString()` to set the map renderer; application code would not need these
* in addition, examples use Twitter Bootstrap and jQuery; this is of course not a requirement - you may use whichever presentation/helper libraries you wish
At the bottom of each example generated in the `build/examples` folder, a modified version of its source code is shown. That modified version can be run standalone and is usually used as starting point for users to extend examples into their own application. At the bottom of each example generated in the `build/examples` folder, a modified version of its source code is shown. That modified version can be run standalone and is usually used as starting point for users to extend examples into their own application.

View File

@@ -16,7 +16,7 @@
] ]
}, },
"plugins": [ "plugins": [
"node_modules/jsdoc/plugins/markdown", "node_modules/jsdoc-fork/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",

View File

@@ -10,8 +10,7 @@
<td><p>Layers are lightweight containers that get their data from [sources](ol.source.html).</p> <td><p>Layers are lightweight containers that get their data from [sources](ol.source.html).</p>
[ol.layer.Tile](ol.layer.Tile.html)<br> [ol.layer.Tile](ol.layer.Tile.html)<br>
[ol.layer.Image](ol.layer.Image.html)<br> [ol.layer.Image](ol.layer.Image.html)<br>
[ol.layer.Vector](ol.layer.Vector.html)<br> [ol.layer.Vector](ol.layer.Vector.html)</td>
[ol.layer.VectorTile](ol.layer.VectorTile.html)</td>
</tr><tr> </tr><tr>
<th>Controls</th><th>Interactions</th><th>Sources and formats</th> <th>Controls</th><th>Interactions</th><th>Sources and formats</th>
</tr><tr> </tr><tr>
@@ -28,7 +27,6 @@ Interactions for [vector features](ol.Feature.html)
<td>[Tile sources](ol.source.Tile.html) for [ol.layer.Tile](ol.layer.Tile.html) <td>[Tile sources](ol.source.Tile.html) for [ol.layer.Tile](ol.layer.Tile.html)
<br>[Image sources](ol.source.Image.html) for [ol.layer.Image](ol.layer.Image.html) <br>[Image sources](ol.source.Image.html) for [ol.layer.Image](ol.layer.Image.html)
<br>[Vector sources](ol.source.Vector.html) for [ol.layer.Vector](ol.layer.Vector.html) <br>[Vector sources](ol.source.Vector.html) for [ol.layer.Vector](ol.layer.Vector.html)
<br>[Vector tile sources](ol.source.VectorTile.html) for [ol.layer.VectorTile](ol.layer.VectorTile.html)
<br>[Formats](ol.format.Feature.html) for reading/writing vector data <br>[Formats](ol.format.Feature.html) for reading/writing vector data
<br>[ol.format.WMSCapabilities](ol.format.WMSCapabilities.html)</td></tr> <br>[ol.format.WMSCapabilities](ol.format.WMSCapabilities.html)</td></tr>
<tr><th>Projections</th><th>Observable objects</th><th>Other components</th></tr> <tr><th>Projections</th><th>Observable objects</th><th>Other components</th></tr>

View File

@@ -16,7 +16,7 @@ exports.defineTags = function(dictionary) {
doclet.stability = level; doclet.stability = level;
} else { } else {
var errorText = util.format('Invalid stability level (%s) in %s line %s', tag.text, doclet.meta.filename, doclet.meta.lineno); var errorText = util.format('Invalid stability level (%s) in %s line %s', tag.text, doclet.meta.filename, doclet.meta.lineno);
require('jsdoc/lib/jsdoc/util/error').handle( new Error(errorText) ); require('jsdoc-fork/lib/jsdoc/util/error').handle( new Error(errorText) );
} }
} }
}); });

View File

@@ -1,10 +1,10 @@
/*global env: true */ /*global env: true */
var template = require('jsdoc/lib/jsdoc/template'), var template = require('jsdoc-fork/lib/jsdoc/template'),
fs = require('jsdoc/lib/jsdoc/fs'), fs = require('jsdoc-fork/lib/jsdoc/fs'),
path = require('jsdoc/lib/jsdoc/path'), path = require('jsdoc-fork/lib/jsdoc/path'),
taffy = require('taffydb').taffy, taffy = require('taffydb').taffy,
handle = require('jsdoc/lib/jsdoc/util/error').handle, handle = require('jsdoc-fork/lib/jsdoc/util/error').handle,
helper = require('jsdoc/lib/jsdoc/util/templateHelper'), helper = require('jsdoc-fork/lib/jsdoc/util/templateHelper'),
_ = require('underscore'), _ = require('underscore'),
htmlsafe = helper.htmlsafe, htmlsafe = helper.htmlsafe,
linkto = helper.linkto, linkto = helper.linkto,
@@ -350,8 +350,8 @@ exports.publish = function(taffyData, opts, tutorials) {
var staticFileScanner; var staticFileScanner;
if (conf['default'].staticFiles) { if (conf['default'].staticFiles) {
staticFilePaths = conf['default'].staticFiles.paths || []; staticFilePaths = conf['default'].staticFiles.paths || [];
staticFileFilter = new (require('jsdoc/lib/jsdoc/src/filter')).Filter(conf['default'].staticFiles); staticFileFilter = new (require('jsdoc-fork/lib/jsdoc/src/filter')).Filter(conf['default'].staticFiles);
staticFileScanner = new (require('jsdoc/lib/jsdoc/src/scanner')).Scanner(); staticFileScanner = new (require('jsdoc-fork/lib/jsdoc/src/scanner')).Scanner();
staticFilePaths.forEach(function(filePath) { staticFilePaths.forEach(function(filePath) {
var extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); var extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -6,6 +6,8 @@ var assert = require('assert');
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var Promise = require('bluebird');
/** /**
* Publish hook for the JSDoc template. Writes to JSON stdout. * Publish hook for the JSDoc template. Writes to JSON stdout.
@@ -169,13 +171,17 @@ exports.publish = function(data, opts) {
return (symbol.name in augments || symbol.virtual); return (symbol.name in augments || symbol.virtual);
}); });
process.stdout.write( return new Promise(function(resolve, reject) {
JSON.stringify({
symbols: symbols, process.stdout.write(
defines: defines, JSON.stringify({
typedefs: typedefs, symbols: symbols,
externs: externs, defines: defines,
base: base typedefs: typedefs,
}, null, 2)); externs: externs,
base: base
}, null, 2), resolve);
});
}; };

View File

@@ -14,6 +14,7 @@
"externs/topojson.js" "externs/topojson.js"
], ],
"define": [ "define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true", "goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true", "goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false" "goog.DEBUG=false"
@@ -23,14 +24,9 @@
], ],
"jscomp_off": [ "jscomp_off": [
"useOfGoogBase", "useOfGoogBase",
"unnecessaryCasts",
"lintChecks" "lintChecks"
], ],
"hide_warnings_for": [
"node_modules/closure-util"
],
"jscomp_warning": [
"unnecessaryCasts"
],
"extra_annotation_name": [ "extra_annotation_name": [
"api", "observable" "api", "observable"
], ],

View File

@@ -11,6 +11,7 @@
} }
.ol-scale-line { .ol-scale-line {
background: #95b9e6;
background: rgba(0,60,136,0.3); background: rgba(0,60,136,0.3);
border-radius: 4px; border-radius: 4px;
bottom: 8px; bottom: 8px;
@@ -19,9 +20,9 @@
position: absolute; position: absolute;
} }
.ol-scale-line-inner { .ol-scale-line-inner {
border: 1px solid #eee; border: 1px solid #eeeeee;
border-top: none; border-top: none;
color: #eee; color: #eeeeee;
font-size: 10px; font-size: 10px;
text-align: center; text-align: center;
margin: 1px; margin: 1px;
@@ -46,6 +47,7 @@
.ol-control { .ol-control {
position: absolute; position: absolute;
background-color: #eee;
background-color: rgba(255,255,255,0.4); background-color: rgba(255,255,255,0.4);
border-radius: 4px; border-radius: 4px;
padding: 2px; padding: 2px;
@@ -93,6 +95,7 @@
height: 1.375em; height: 1.375em;
width: 1.375em; width: 1.375em;
line-height: .4em; line-height: .4em;
background-color: #7b98bc;
background-color: rgba(0,60,136,0.5); background-color: rgba(0,60,136,0.5);
border: none; border: none;
border-radius: 2px; border-radius: 2px;
@@ -119,6 +122,7 @@
.ol-control button:hover, .ol-control button:hover,
.ol-control button:focus { .ol-control button:focus {
text-decoration: none; text-decoration: none;
background-color: #4c6079;
background-color: rgba(0,60,136,0.7); background-color: rgba(0,60,136,0.7);
} }
.ol-zoom .ol-zoom-in { .ol-zoom .ol-zoom-in {

View File

@@ -167,6 +167,7 @@ The minimum config file looks like this:
"node_modules/openlayers/externs/topojson.js" "node_modules/openlayers/externs/topojson.js"
], ],
"define": [ "define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true", "goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true", "goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false", "goog.DEBUG=false",
@@ -222,6 +223,7 @@ Here is a version of `config.json` with more compilation checks enabled:
"node_modules/openlayers/externs/topojson.js" "node_modules/openlayers/externs/topojson.js"
], ],
"define": [ "define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true", "goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true", "goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false", "goog.DEBUG=false",
@@ -310,7 +312,7 @@ directory:
``` ```
Note that the page includes a `script` tag referencing the `app.js` file, Note that the page includes a `script` tag referencing the `app.js` file,
which is the file resulting from the compilation. which is the file resuted from the compilation.
You are done! You are done!

View File

@@ -60,6 +60,7 @@ Creating a custom build requires writing a build configuration file. The format
"externs/topojson.js" "externs/topojson.js"
], ],
"define": [ "define": [
"goog.array.ASSUME_NATIVE_FUNCTIONS=true",
"goog.dom.ASSUME_STANDARDS_MODE=true", "goog.dom.ASSUME_STANDARDS_MODE=true",
"goog.json.USE_NATIVE_JSON=true", "goog.json.USE_NATIVE_JSON=true",
"goog.DEBUG=false" "goog.DEBUG=false"

View File

@@ -10,4 +10,3 @@ layout: doc.hbs
* [Create Custom Builds](custom-builds.html) * [Create Custom Builds](custom-builds.html)
* [Bundle Application and OpenLayers using Browserify](browserify.html) * [Bundle Application and OpenLayers using Browserify](browserify.html)
* [Compile Application and OpenLayers together](closure.html) * [Compile Application and OpenLayers together](closure.html)
* [Raster Reprojection](raster-reprojection.html)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,132 +0,0 @@
---
title: Raster Reprojection
layout: doc.hbs
---
# Raster Reprojection
OpenLayers 3 has an ability to display raster data from WMS, WMTS, static images and many other sources in a different coordinate system than delivered from the server.
Transformation of the map projections of the image happens directly in a web browser.
The view in any Proj4js supported coordinate reference system is possible and previously incompatible layers can now be combined and overlaid.
# Usage
The API usage is very simple. Just specify proper projection (using [EPSG](http://epsg.io) code) on `ol.View`:
``` javascript
var map = new ol.Map({
target: 'map',
view: new ol.View({
projection: 'EPSG:3857', //HERE IS THE VIEW PROJECTION
center: [0, 0],
zoom: 2
}),
layers: [
new ol.layer.Tile({
source: new ol.source.TileWMS({
projection: 'EPSG:4326', //HERE IS THE DATA SOURCE PROJECTION
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}
})
})
]
});
```
If a source (based on `ol.source.TileImage` or `ol.source.Image`) has a projection different from the current `ol.View`s projection then the reprojection happens automatically under the hood.
### Examples
- [Raster reprojection demo](http://openlayers.org/en/master/examples/reprojection.html)
- [OpenStreetMap to WGS84 reprojection](http://openlayers.org/en/master/examples/reprojection-wgs84.html)
- [Reprojection with EPSG.io database search](http://openlayers.org/en/master/examples/reprojection-by-code.html)
- [Image reprojection](http://openlayers.org/en/master/examples/reprojection-image.html)
### Custom projection
The easiest way to use a custom projection is to add the [Proj4js](http://proj4js.org/) library to your project and then define the projection using a proj4 definition string.
Following example shows definition of a [British National Grid](http://epsg.io/27700):
``` html
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12/proj4.js"></script>
```
``` javascript
proj4.defs('EPSG:27700', '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 ' +
'+x_0=400000 +y_0=-100000 +ellps=airy ' +
'+towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 ' +
'+units=m +no_defs');
var proj27700 = ol.proj.get('EPSG:27700');
proj27700.setExtent([0, 0, 700000, 1300000]);
```
### Change of the view projection
To switch the projection used to display the map you have to set a new `ol.View` with selected projection on the `ol.Map`:
``` javascript
map.setView(new ol.View({
projection: 'EPSG:27700',
center: [400000, 650000],
zoom: 4
}));
```
## TileGrid and Extents
When reprojection is needed, new tiles (in the target projection) are under the hood created from the original source tiles.
The TileGrid of the reprojected tiles is by default internally constructed using `ol.tilegrid.getForProjection(projection)`.
The projection should have extent defined (see above) for this to work properly.
Alternatively, a custom target TileGrid can be constructed manually and set on the source instance using `ol.source.TileImage#setTileGridForProjection(projection, tilegrid)`.
This TileGrid will then be used when reprojecting to the specified projection instead of creating the default one.
In certain cases, this can be used to optimize performance (by tweaking tile sizes) or visual quality (by specifying resolutions).
# How it works
The reprojection process is based on triangles -- the target raster is divided into a limited number of triangles with vertices transformed using `ol.proj` capabilities ([proj4js](http://proj4js.org/) is usually utilized to define custom transformations).
The reprojection of pixels inside the triangle is approximated with an affine transformation (with rendering hardware-accelerated by the canvas 2d context):
<img src="raster-reprojection-resources/how-it-works.jpg" alt="How it works" width="600" />
This way we can support a wide range of projections from proj4js (or even custom transformation functions) on almost any hardware (with canvas 2d support) with a relatively small number of actual transformation calculations.
The precision of the reprojection is then limited by the number of triangles.
The reprojection process preserves transparency on the raster data supplied from the source (png or gif) and the gaps and no-data pixels generated by reprojection are automatically transparent.
###Dynamic triangulation
The above image above shows a noticeable error (especially on the edges) when the original image (left; EPSG:27700) is transformed with only a limited number of triangles (right; EPSG:3857).
The error can be minimized by increasing the number of triangles used.
Since some transformations require a more detail triangulation network, the dynamic triangulation process automatically measures reprojection error and iteratively subdivides to meet a specific error threshold:
<img src="raster-reprojection-resources/iterative-triangulation.png" alt="Iterative triangulation" width="600" />
For debugging, rendering of the reprojection edges can be enabled by `ol.source.TileImage#setRenderReprojectionEdges(true)`.
# Advanced
### Disabling reprojection
In case you are creating a custom build of OpenLayers and do not need the reprojection code, you can reduce the build size by setting `ol.ENABLE_RASTER_REPROJECTION` to `false`, which completely disables the reprojection support.
See [Custom builds](custom-builds.html#defines) tutorial on how to do this.
### Triangulation precision threshold
The default [triangulation error threshold](#dynamic-triangulation) in pixels is given by `ol.DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD` (0.5 pixel).
In case a different threshold needs to be defined for different sources, the `reprojectionErrorThreshold` option can be passed when constructing the tile image source.
###Limiting visibility of reprojected map by extent
The reprojection algorithm uses inverse transformation (from *view projection* to *data projection*).
For certain coordinate systems this can result in a "double occurrence" of the source data on a map.
For example, when reprojecting a map of Switzerland from EPSG:21781 to EPSG:3857, it is displayed twice: once at the proper place in Europe, but also in the Pacific Ocean near New Zealand, on the opposite side of the globe.
<img src="raster-reprojection-resources/double-occurrence.jpg" alt="Double occurrence of a reprojected map" width="600" />
Although this is mathematically correct behavior of the inverse transformation, visibility of the layer on multiple places is not expected by users.
A possible general solution would be to calculate the forward transformation for every vertex as well - but this would significantly decrease performance (especially for computationally expensive transformations).
Therefore a recommended workaround is to define a proper visibility extent on the `ol.layer.Tile` in the view projection.
Setting such a limit is demonstrated in the [reprojection demo example](http://openlayers.org/en/master/examples/reprojection.html).
### Resolution calculation
When determining source tiles to load, the ideal source resolution needs to be calculated.
The `ol.reproj.calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution)` function calculates the ideal value in order to achieve pixel mapping as close as possible to 1:1 during reprojection, which is then used to select proper zoom level from the source.
It is, however, generally not practical to use the same source zoom level for the whole target zoom level -- different projections can have significantly different resolutions in different parts of the world (e.g. polar regions in EPSG:3857 vs EPSG:4326) and enforcing a single resolution for the whole zoom level would result in some tiles being scaled up/down, possibly requiring a huge number of source tiles to be loaded.
Therefore, the resolution mapping is calculated separately for each reprojected tile (in the middle of the tile extent).

View File

@@ -1,17 +0,0 @@
{
"globals": {
"FastClick": false,
"$": false,
"arc": false,
"common": false,
"createMapboxStreetsV6Style": false,
"d3": false,
"jsPDF": false,
"jsts": false,
"topojson": false,
"turf": false
},
"rules": {
"no-unused-vars": [2, {"varsIgnorePattern": "^map"}]
}
}

View File

@@ -14,6 +14,3 @@ a.skiplink:focus {
background-color: #fff; background-color: #fff;
padding: 0.3em; padding: 0.3em;
} }
#map:focus {
outline: #4A74A8 solid 0.15em;
}

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Accessible Map title: Accessibility example
shortdesc: Example of an accessible map. shortdesc: Example of an accessible map.
docs: > docs: >
This page's `map` element has its `tabindex` attribute set to `"0"`, that makes it focusable. To focus the map element you can either navigate to it using the "tab" key or use the skip link. When the `map` element is focused the + and - keys can be used to zoom in and out and the arrow keys can be used to pan. This page's `map` element has its `tabindex` attribute set to `"0"`, that makes it focusable. To focus the map element you can either navigate to it using the "tab" key or use the skip link. When the `map` element is focused the + and - keys can be used to zoom in and out and the arrow keys can be used to pan.
@@ -10,7 +10,11 @@ docs: >
tags: "accessibility, tabindex" tags: "accessibility, tabindex"
--- ---
<a class="skiplink" href="#map">Go to map</a> <div class="row-fluid">
<div id="map" class="map" tabindex="0"></div> <div class="span12">
<button id="zoom-out">Zoom out</button> <a class="skiplink" href="#map">Go to map</a>
<button id="zoom-in">Zoom in</button> <div id="map" class="map" tabindex="0"></div>
<button id="zoom-out">Zoom out</button>
<button id="zoom-in">Zoom in</button>
</div>
</div>

View File

@@ -1,19 +1,27 @@
--- ---
layout: example.html layout: example.html
title: View Animation title: Animation example
shortdesc: Demonstrates animated pan, zoom, and rotation. shortdesc: Demonstrates animated pan, zoom, and rotation.
docs: > docs: >
This example shows how to use the beforeRender function on the Map to run one This example shows how to use the beforeRender function on the Map to run one
or more animations. or more animations.
tags: "animation" tags: "animation"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<button id="rotate-left" title="Rotate clockwise"></button> <div class="span12">
<button id="rotate-right" title="Rotate counterclockwise"></button> <div id="map" class="map"></div>
<button id="rotate-around-rome">Rotate around Rome</button> </div>
<button id="pan-to-london">Pan to London</button> </div>
<button id="elastic-to-moscow">Elastic to Moscow</button> <div class="row-fluid">
<button id="bounce-to-istanbul">Bounce to Istanbul</button> <div class="span12">
<button id="spin-to-rome">Spin to Rome</button> <button id="rotate-left" title="Rotate clockwise"></button>
<button id="fly-to-bern">Fly to Bern</button> <button id="rotate-right" title="Rotate counterclockwise"></button>
<button id="spiral-to-madrid">Spiral to Madrid</button> <button id="rotate-around-rome">Rotate around Rome</button>
<button id="pan-to-london">Pan to London</button>
<button id="elastic-to-moscow">Elastic to Moscow</button>
<button id="bounce-to-istanbul">Bounce to Istanbul</button>
<button id="spin-to-rome">Spin to Rome</button>
<button id="fly-to-bern">Fly to Bern</button>
<button id="spiral-to-madrid">Spiral to Madrid</button>
</div>
</div>

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Tiled ArcGIS MapServer title: Tiled ArcGIS MapServer example
shortdesc: Example of a tiled ArcGIS layer. shortdesc: Example of a tiled ArcGIS layer.
docs: > docs: >
This example shows how to use an ArcGIS REST MapService as tiles. This example shows how to use an ArcGIS REST MapService as tiles.
@@ -9,4 +9,8 @@ docs: >
<code>ol.source.XYZ</code> instead. <code>ol.source.XYZ</code> instead.
tags: arcgis, tile, tilelayer" tags: arcgis, tile, tilelayer"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Attributions title: Attributions example
shortdesc: Example of a attributions visibily change on map resize, to collapse them on small maps. shortdesc: Example of a attributions visibily change on map resize, to collapse them on small maps.
docs: > docs: >
When the map gets too small because of a resize, the attribution will be collapsed. When the map gets too small because of a resize, the attribution will be collapsed.
@@ -8,4 +8,8 @@ docs: >
of the map gets smaller than 600 pixels. of the map gets smaller than 600 pixels.
tags: "attributions, openstreetmap" tags: "attributions, openstreetmap"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -14,7 +14,7 @@ var map = new ol.Map({
source: new ol.source.OSM() source: new ol.source.OSM()
}) })
], ],
controls: ol.control.defaults({attribution: false}).extend([attribution]), controls: ol.control.defaults({ attribution: false }).extend([attribution]),
renderer: common.getRendererFromQueryString(), renderer: common.getRendererFromQueryString(),
target: 'map', target: 'map',
view: new ol.View({ view: new ol.View({

View File

@@ -1,18 +1,22 @@
--- ---
layout: example.html layout: example.html
title: Bing Maps title: Bing Maps example
shortdesc: Example of a Bing Maps layer. shortdesc: Example of a Bing Maps layer.
docs: > docs: >
<p>When the Bing Maps tile service doesn't have tiles for a given resolution and region it returns "placeholder" tiles indicating that. Zoom the map beyond level 19 to see the "placeholder" tiles. If you want OpenLayers to display stretched tiles in place of "placeholder" tiles beyond zoom level 19 then set <code>maxZoom</code> to <code>19</code> in the options passed to <code>ol.source.BingMaps</code>.</p> <p>When the Bing Maps tile service doesn't have tiles for a given resolution and region it returns "placeholder" tiles indicating that. Zoom the map beyond level 19 to see the "placeholder" tiles. If you want OpenLayers to display stretched tiles in place of "placeholder" tiles beyond zoom level 19 then set <code>maxZoom</code> to <code>19</code> in the options passed to <code>ol.source.BingMaps</code>.</p>
tags: "bing, bing-maps" tags: "bing, bing-maps"
cloak: cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<select id="layer-select"> <div class="span12">
<option value="Aerial">Aerial</option> <div id="map" class="map"></div>
<option value="AerialWithLabels" selected>Aerial with labels</option> <select id="layer-select">
<option value="Road">Road</option> <option value="Aerial">Aerial</option>
<option value="collinsBart">Collins Bart</option> <option value="AerialWithLabels" selected>Aerial with labels</option>
<option value="ordnanceSurvey">Ordnance Survey</option> <option value="Road">Road</option>
</select> <option value="collinsBart">Collins Bart</option>
<option value="ordnanceSurvey">Ordnance Survey</option>
</select>
</div>
</div>

View File

@@ -18,7 +18,7 @@ for (i = 0, ii = styles.length; i < ii; ++i) {
visible: false, visible: false,
preload: Infinity, preload: Infinity,
source: new ol.source.BingMaps({ source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF', key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
imagerySet: styles[i] imagerySet: styles[i]
// use maxZoom 19 to see stretched tiles instead of the BingMaps // use maxZoom 19 to see stretched tiles instead of the BingMaps
// "no photos at this zoom level" tiles // "no photos at this zoom level" tiles

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Blend Modes title: Blend modes example
shortdesc: Shows how to change the canvas compositing / blending mode in post- and precompose eventhandlers. shortdesc: Shows how to change the canvas compositing / blending mode in post- and precompose eventhandlers.
docs: > docs: >
<p>This example shows how to change the canvas compositing / blending mode in <p>This example shows how to change the canvas compositing / blending mode in
@@ -20,49 +20,57 @@ docs: >
checkboxes.</p> checkboxes.</p>
tags: "blendmode, blend-mode, blend mode, blendingmode, blending-mode, blending mode, composition, compositing, canvas, vector" tags: "blendmode, blend-mode, blend mode, blendingmode, blending-mode, blending mode, composition, compositing, canvas, vector"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<form class="form-horizontal"> <div class="span12">
<label> <div id="map" class="map"></div>
<select id="blend-mode" class="form-control"> </div>
<option value="source-over">source-over (default)</option> </div>
<option>source-in</option> <div class="row-fluid">
<option>source-out</option> <div class="span12">
<option>source-atop</option> <form class="form-horizontal">
<option>destination-over</option> <label>
<option>destination-in</option> <select id="blend-mode" class="form-control">
<option>destination-out</option> <option value="source-over">source-over (default)</option>
<option>destination-atop</option> <option>source-in</option>
<option>lighter</option> <option>source-out</option>
<option>copy</option> <option>source-atop</option>
<option>xor</option> <option>destination-over</option>
<option>multiply</option> <option>destination-in</option>
<option>screen</option> <option>destination-out</option>
<option>overlay</option> <option>destination-atop</option>
<option>darken</option> <option>lighter</option>
<option>lighten</option> <option>copy</option>
<option>color-dodge</option> <option>xor</option>
<option>color-burn</option> <option>multiply</option>
<option>hard-light</option> <option>screen</option>
<option>soft-light</option> <option>overlay</option>
<option selected>difference</option> <option>darken</option>
<option>exclusion</option> <option>lighten</option>
<option>hue</option> <option>color-dodge</option>
<option>saturation</option> <option>color-burn</option>
<option>color</option> <option>hard-light</option>
<option>luminosity</option> <option>soft-light</option>
</select> <option selected>difference</option>
Canvas compositing / blending mode <option>exclusion</option>
</label> <option>hue</option>
<label> <option>saturation</option>
<input type="checkbox" id="affect-red" checked> <option>color</option>
Red circle affected <option>luminosity</option>
</label> </select>
<label> Canvas compositing / blending mode
<input type="checkbox" id="affect-green" checked> </label>
Green circle affected <label>
</label> <input type="checkbox" id="affect-red" checked>
<label> Red circle affected
<input type="checkbox" id="affect-blue" checked> </label>
Blue circle affected <label>
</label> <input type="checkbox" id="affect-green" checked>
</form> Green circle affected
</label>
<label>
<input type="checkbox" id="affect-blue" checked>
Blue circle affected
</label>
</form>
</div>
</div>

View File

@@ -85,13 +85,8 @@ var map = new ol.Map({
}) })
}); });
// Get the form elements and bind the listeners
var select = document.getElementById('blend-mode');
var affectRed = document.getElementById('affect-red');
var affectGreen = document.getElementById('affect-green');
var affectBlue = document.getElementById('affect-blue');
// Various helper methods and event handlers
/** /**
* This method sets the globalCompositeOperation to the value of the select * This method sets the globalCompositeOperation to the value of the select
* field and it is bound to the precompose event of the layers. * field and it is bound to the precompose event of the layers.
@@ -159,6 +154,12 @@ var affectLayerClicked = function() {
}; };
// Get the form elements and bind the listeners
var select = document.getElementById('blend-mode');
var affectRed = document.getElementById('affect-red');
var affectGreen = document.getElementById('affect-green');
var affectBlue = document.getElementById('affect-blue');
// Rerender map when blend mode changes // Rerender map when blend mode changes
select.addEventListener('change', function() { select.addEventListener('change', function() {
map.render(); map.render();

View File

@@ -1,12 +1,20 @@
--- ---
layout: example.html layout: example.html
title: Box Selection title: Box selection example
shortdesc: Using a DragBox interaction to select features. shortdesc: Using a DragBox interaction to select features.
docs: > docs: >
<p>This example shows how to use a <code>DragBox</code> interaction to select features. Selected features are added <p>This example shows how to use a <code>DragBox</code> interaction to select features. Selected features are added
to the feature overlay of a select interaction (<code>ol.interaction.Select</code>) for highlighting.</p> to the feature overlay of a select interaction (<code>ol.interaction.Select</code>) for highlighting.</p>
<p>Use <code>Ctrl+Drag</code> (<code>Command+Drag</code> on Mac) to draw boxes.</p> <p>Use <code>Ctrl+drag</code> (<code>Meta+drag</code> on Mac) to draw boxes.</p>
tags: "DragBox, feature, selection, box" tags: "DragBox, feature, selection, box"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div id="info">No countries selected</div> <div class="span12">
<div id="map" class="map"></div>
</div>
<div class="span4 offset4 pull-right">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>

View File

@@ -48,7 +48,7 @@ map.addInteraction(dragBox);
var infoBox = document.getElementById('info'); var infoBox = document.getElementById('info');
dragBox.on('boxend', function() { dragBox.on('boxend', function(e) {
// features that intersect the box are added to the collection of // features that intersect the box are added to the collection of
// selected features, and their names are displayed in the "info" // selected features, and their names are displayed in the "info"
// div // div
@@ -64,7 +64,7 @@ dragBox.on('boxend', function() {
}); });
// 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(e) {
selectedFeatures.clear(); selectedFeatures.clear();
infoBox.innerHTML = '&nbsp;'; infoBox.innerHTML = '&nbsp;';
}); });

View File

@@ -1,3 +1,4 @@
.tooltip-inner { .tooltip-inner {
white-space: nowrap; white-space: nowrap;
} }

View File

@@ -1,13 +1,13 @@
--- ---
layout: example.html layout: example.html
title: Custom Tooltips title: Custom tooltips example
shortdesc: This example shows how to customize the buttons tooltips with Bootstrap. shortdesc: This example shows how to customize the buttons tooltips with Bootstrap.
docs: > docs: >
This example shows how to customize the buttons tooltips with <a href="http://getbootstrap.com/javascript/#tooltips">Bootstrap</a>. This example shows how to customize the buttons tooltips with <a href="http://getbootstrap.com/javascript/#tooltips">Bootstrap</a>.
tags: "custom, tooltip" tags: "custom, tooltip"
resources:
- https://code.jquery.com/jquery-1.11.2.min.js
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -1,13 +1,17 @@
--- ---
layout: example.html layout: example.html
title: Canvas Tiles title: Canvas tiles example
shortdesc: Renders tiles with coordinates for debugging. shortdesc: Renders tiles with coordinates for debugging.
docs: > docs: >
The black grid tiles are generated on the client with an HTML5 canvas. The The black grid tiles are generated on the client with an HTML5 canvas. The
displayed tile coordinates are OpenLayers tile coordinates. These increase displayed tile coordinates are OpenLayers tile coordinates. These increase
from bottom to top, but standard XYZ tiling scheme coordinates increase from from bottom to top, but standard XYZ tiling scheme coordinates increase from
top to bottom. To calculate the `y` for a standard XYZ tile coordinate, use top to bottom. To calculate the `y` for a standard XYZ tile coordinate, use
`-y - 1`. `-y - 1`.
tags: "layers, openstreetmap, canvas" tags: "layers, openstreetmap, canvas"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Advanced View Positioning title: Advanced View Positioning example
shortdesc: This example demonstrates how a map's view can be adjusted so a geometry or coordinate is positioned at a specific pixel location. shortdesc: This example demonstrates how a map's view can be adjusted so a geometry or coordinate is positioned at a specific pixel location.
docs: > docs: >
This example demonstrates how a map's view can be This example demonstrates how a map's view can be
@@ -10,19 +10,25 @@ docs: >
is used to fit a geometry in the view with the same padding. The is used to fit a geometry in the view with the same padding. The
view's <code>centerOn</code> method is used to position a coordinate (Lausanne) view's <code>centerOn</code> method is used to position a coordinate (Lausanne)
at a specific pixel location (the center of the black box). at a specific pixel location (the center of the black box).
<p>Use <code>Alt+Shift+Drag</code> to rotate the map.</p> <p>Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p>
tags: "center, rotation, openstreetmap" tags: "center, rotation, openstreetmap"
--- ---
<div class="mapcontainer"> <div class="row-fluid">
<div id="map" class="map"></div> <div class="span12 mapcontainer">
<div class="padding-top"></div> <div id="map" class="map"></div>
<div class="padding-left"></div> <div class="padding-top"></div>
<div class="padding-right"></div> <div class="padding-left"></div>
<div class="padding-bottom"></div> <div class="padding-right"></div>
<div class="center"></div> <div class="padding-bottom"></div>
<div class="center"></div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<button id="zoomtoswitzerlandbest">Zoom to Switzerland</button> (best fit),<br/>
<button id="zoomtoswitzerlandconstrained">Zoom to Switzerland</button> (respect resolution constraint).<br/>
<button id="zoomtoswitzerlandnearest">Zoom to Switzerland</button> (nearest),<br/>
<button id="zoomtolausanne">Zoom to Lausanne</button> (with min resolution),<br/>
<button id="centerlausanne">Center on Lausanne</button>
</div>
</div> </div>
<button id="zoomtoswitzerlandbest">Zoom to Switzerland</button> (best fit),<br/>
<button id="zoomtoswitzerlandconstrained">Zoom to Switzerland</button> (respect resolution constraint).<br/>
<button id="zoomtoswitzerlandnearest">Zoom to Switzerland</button> (nearest),<br/>
<button id="zoomtolausanne">Zoom to Lausanne</button> (with min resolution),<br/>
<button id="centerlausanne">Center on Lausanne</button>

View File

@@ -65,7 +65,14 @@ zoomtoswitzerlandbest.addEventListener('click', function() {
var feature = source.getFeatures()[0]; var feature = source.getFeatures()[0];
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry()); var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize()); var size = /** @type {ol.Size} */ (map.getSize());
view.fit(polygon, size, {padding: [170, 50, 30, 150], constrainResolution: false}); view.fit(
polygon,
size,
{
padding: [170, 50, 30, 150],
constrainResolution: false
}
);
}, false); }, false);
var zoomtoswitzerlandconstrained = var zoomtoswitzerlandconstrained =
@@ -74,7 +81,13 @@ zoomtoswitzerlandconstrained.addEventListener('click', function() {
var feature = source.getFeatures()[0]; var feature = source.getFeatures()[0];
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry()); var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize()); var size = /** @type {ol.Size} */ (map.getSize());
view.fit(polygon, size, {padding: [170, 50, 30, 150]}); view.fit(
polygon,
size,
{
padding: [170, 50, 30, 150]
}
);
}, false); }, false);
var zoomtoswitzerlandnearest = var zoomtoswitzerlandnearest =
@@ -83,7 +96,14 @@ zoomtoswitzerlandnearest.addEventListener('click', function() {
var feature = source.getFeatures()[0]; var feature = source.getFeatures()[0];
var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry()); var polygon = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize()); var size = /** @type {ol.Size} */ (map.getSize());
view.fit(polygon, size, {padding: [170, 50, 30, 150], nearest: true}); view.fit(
polygon,
size,
{
padding: [170, 50, 30, 150],
nearest: true
}
);
}, false); }, false);
var zoomtolausanne = document.getElementById('zoomtolausanne'); var zoomtolausanne = document.getElementById('zoomtolausanne');
@@ -91,7 +111,14 @@ zoomtolausanne.addEventListener('click', function() {
var feature = source.getFeatures()[1]; var feature = source.getFeatures()[1];
var point = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry()); var point = /** @type {ol.geom.SimpleGeometry} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize()); var size = /** @type {ol.Size} */ (map.getSize());
view.fit(point, size, {padding: [170, 50, 30, 150], minResolution: 50}); view.fit(
point,
size,
{
padding: [170, 50, 30, 150],
minResolution: 50
}
);
}, false); }, false);
var centerlausanne = document.getElementById('centerlausanne'); var centerlausanne = document.getElementById('centerlausanne');
@@ -99,5 +126,9 @@ centerlausanne.addEventListener('click', function() {
var feature = source.getFeatures()[1]; var feature = source.getFeatures()[1];
var point = /** @type {ol.geom.Point} */ (feature.getGeometry()); var point = /** @type {ol.geom.Point} */ (feature.getGeometry());
var size = /** @type {ol.Size} */ (map.getSize()); var size = /** @type {ol.Size} */ (map.getSize());
view.centerOn(point.getCoordinates(), size, [570, 500]); view.centerOn(
point.getCoordinates(),
size,
[570, 500]
);
}, false); }, false);

View File

@@ -1,9 +1,13 @@
--- ---
layout: example.html layout: example.html
title: Clustered Features title: Clustering example
shortdesc: Example of using <code>ol.source.Cluster</code>. 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"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -34,11 +34,11 @@ var clusterSource = new ol.source.Cluster({
var styleCache = {}; var styleCache = {};
var clusters = new ol.layer.Vector({ var clusters = new ol.layer.Vector({
source: clusterSource, source: clusterSource,
style: function(feature) { style: function(feature, resolution) {
var size = feature.get('features').length; var size = feature.get('features').length;
var style = styleCache[size]; var style = styleCache[size];
if (!style) { if (!style) {
style = new ol.style.Style({ style = [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
radius: 10, radius: 10,
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
@@ -54,7 +54,7 @@ var clusters = new ol.layer.Vector({
color: '#fff' color: '#fff'
}) })
}) })
}); })];
styleCache[size] = style; styleCache[size] = style;
} }
return style; return style;
@@ -65,6 +65,10 @@ var raster = new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'}) source: new ol.source.MapQuest({layer: 'sat'})
}); });
var raw = new ol.layer.Vector({
source: source
});
var map = new ol.Map({ var map = new ol.Map({
layers: [raster, clusters], layers: [raster, clusters],
renderer: 'canvas', renderer: 'canvas',

View File

@@ -1,26 +1,30 @@
--- ---
layout: example.html layout: example.html
title: Color Manipulation title: Manipulating colors with a raster source
shortdesc: Demonstrates color manipulation with a raster source. shortdesc: Demonstrates color manipulation with a raster source.
docs: > docs: >
A raster source allows arbitrary manipulation of pixel values. In this example, RGB values on the input tile source are adjusted in a pixel-wise operation before being rendered with a second raster source. The raster operation takes pixels in in RGB space, converts them to HCL color space, adjusts the values based on the controls above, and then converts them back to RGB space for rendering. A raster source allows arbitrary manipulation of pixel values. In this example, RGB values on the input tile source are adjusted in a pixel-wise operation before being rendered with a second raster source. The raster operation takes pixels in in RGB space, converts them to HCL color space, adjusts the values based on the controls above, and then converts them back to RGB space for rendering.
tags: "color, hue, lightness, chroma" tags: "color, hue, lightness, chroma"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<table class="controls"> <div class="span12">
<tr> <div id="map" class="map"></div>
<td>hue</td> <table class="controls">
<td><span id="hueOut"></span>°</td> <tr>
<td><input id="hue" type="range" min="-180" max="180" value="0"/></td> <td>hue</td>
</tr> <td><span id="hueOut"></span>°</td>
<tr> <td><input id="hue" type="range" min="-180" max="180" value="0"/></td>
<td>chroma</td> </tr>
<td><span id="chromaOut"></span> %</td> <tr>
<td><input id="chroma" type="range" min="0" max="100" value="100"/></td> <td>chroma</td>
</tr> <td><span id="chromaOut"></span> %</td>
<tr> <td><input id="chroma" type="range" min="0" max="100" value="100"/></td>
<td>lightness</td> </tr>
<td><span id="lightnessOut"></span> %</td> <tr>
<td><input id="lightness" type="range" min="0" max="100" value="100"/></td> <td>lightness</td>
</tr> <td><span id="lightnessOut"></span> %</td>
</table> <td><input id="lightness" type="range" min="0" max="100" value="100"/></td>
</tr>
</table>
</div>
</div>

View File

@@ -138,8 +138,6 @@ var raster = new ol.source.Raster({
} }
}); });
var controls = {};
raster.on('beforeoperations', function(event) { raster.on('beforeoperations', function(event) {
var data = event.data; var data = event.data;
for (var id in controls) { for (var id in controls) {
@@ -162,6 +160,7 @@ var map = new ol.Map({
}); });
var controlIds = ['hue', 'chroma', 'lightness']; var controlIds = ['hue', 'chroma', 'lightness'];
var controls = {};
controlIds.forEach(function(id) { controlIds.forEach(function(id) {
var control = document.getElementById(id); var control = document.getElementById(id);
var output = document.getElementById(id + 'Out'); var output = document.getElementById(id + 'Out');

View File

@@ -1,9 +1,13 @@
--- ---
layout: example.html layout: example.html
title: Custom Controls title: Custom control example
shortdesc: Shows how to create custom controls. shortdesc: Shows how to create custom controls.
docs: > docs: >
This example creates a "rotate to north" button. This example creates a "rotate to north" button.
tags: "custom, control" tags: "custom, control"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -19,6 +19,7 @@ var app = window.app;
// //
/** /**
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
@@ -32,7 +33,7 @@ app.RotateNorthControl = function(opt_options) {
button.innerHTML = 'N'; button.innerHTML = 'N';
var this_ = this; var this_ = this;
var handleRotateNorth = function() { var handleRotateNorth = function(e) {
this_.getMap().getView().setRotation(0); this_.getMap().getView().setRotation(0);
}; };
@@ -74,7 +75,7 @@ var map = new ol.Map({
target: 'map', target: 'map',
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [0, 0],
zoom: 3, zoom: 2,
rotation: 1 rotation: 1
}) })
}); });

View File

@@ -1,10 +1,14 @@
--- ---
layout: example.html layout: example.html
title: Custom Interactions title: Custom interaction example
shortdesc: Example of a custom interaction. shortdesc: Example of a custom interaction.
docs: > docs: >
This example demonstrates creating a custom interaction by subclassing `ol.interaction.Pointer`. This example demonstrates creating a custom interaction by subclassing `ol.interaction.Pointer`.
Note that the built in interaction `ol.interaction.Translate` might be a better option for moving features. Note that the built in interaction `ol.interaction.Translate` might be a better option for moving features.
tags: "drag, feature, vector, editing, custom, interaction" tags: "drag, feature, vector, editing, custom, interaction"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -19,7 +19,9 @@ goog.require('ol.style.Style');
/** /**
* Define a namespace for the application. * Define a namespace for the application.
*/ */
var app = {}; window.app = {};
var app = window.app;
/** /**
@@ -71,7 +73,7 @@ app.Drag.prototype.handleDownEvent = function(evt) {
var map = evt.map; var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel, var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature) { function(feature, layer) {
return feature; return feature;
}); });
@@ -88,6 +90,13 @@ app.Drag.prototype.handleDownEvent = function(evt) {
* @param {ol.MapBrowserEvent} evt Map browser event. * @param {ol.MapBrowserEvent} evt Map browser event.
*/ */
app.Drag.prototype.handleDragEvent = function(evt) { app.Drag.prototype.handleDragEvent = function(evt) {
var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
return feature;
});
var deltaX = evt.coordinate[0] - this.coordinate_[0]; var deltaX = evt.coordinate[0] - this.coordinate_[0];
var deltaY = evt.coordinate[1] - this.coordinate_[1]; var deltaY = evt.coordinate[1] - this.coordinate_[1];
@@ -107,7 +116,7 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
if (this.cursor_) { if (this.cursor_) {
var map = evt.map; var map = evt.map;
var feature = map.forEachFeatureAtPixel(evt.pixel, var feature = map.forEachFeatureAtPixel(evt.pixel,
function(feature) { function(feature, layer) {
return feature; return feature;
}); });
var element = evt.map.getTargetElement(); var element = evt.map.getTargetElement();
@@ -125,9 +134,10 @@ app.Drag.prototype.handleMoveEvent = function(evt) {
/** /**
* @param {ol.MapBrowserEvent} evt Map browser event.
* @return {boolean} `false` to stop the drag sequence. * @return {boolean} `false` to stop the drag sequence.
*/ */
app.Drag.prototype.handleUpEvent = function() { app.Drag.prototype.handleUpEvent = function(evt) {
this.coordinate_ = null; this.coordinate_ = null;
this.feature_ = null; this.feature_ = null;
return false; return false;
@@ -149,7 +159,7 @@ var map = new ol.Map({
layers: [ layers: [
new ol.layer.Tile({ new ol.layer.Tile({
source: new ol.source.TileJSON({ source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json' url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
}) })
}), }),
new ol.layer.Vector({ new ol.layer.Vector({

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: d3 Integration title: d3 integration example
shortdesc: Example of using ol3 and d3 together. shortdesc: Example of using ol3 and d3 together.
docs: > docs: >
<p>The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a canvas element that is then used as the image of an ol3 image layer.</p> <p>The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a canvas element that is then used as the image of an ol3 image layer.</p>
@@ -9,4 +9,8 @@ resources:
- http://d3js.org/d3.v3.min.js - http://d3js.org/d3.v3.min.js
- http://d3js.org/topojson.v1.min.js - http://d3js.org/topojson.v1.min.js
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

3
examples/d3.js vendored
View File

@@ -1,4 +1,5 @@
// NOCOMPILE // NOCOMPILE
// this example uses d3 for which we don't have an externs file.
goog.require('ol'); goog.require('ol');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
@@ -39,7 +40,7 @@ d3.json('data/topojson/us.json', function(error, us) {
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {ol.proj.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {HTMLCanvasElement} A canvas element. * @return {HTMLCanvasElement}
*/ */
var canvasFunction = function(extent, resolution, pixelRatio, var canvasFunction = function(extent, resolution, pixelRatio,
size, projection) { size, projection) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

File diff suppressed because one or more lines are too long

View File

@@ -1,283 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<msGMLOutput
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<restaurant_layer>
<gml:name>Restaurants</gml:name>
<restaurant_feature>
<gml:boundedBy>
<gml:Box srsName="EPSG:21781">
<gml:coordinates>537750.006175,150923.784252 537750.006175,150923.784252</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<THE_GEOM>
<gml:Point srsName="EPSG:21781">
<gml:coordinates>537750.006175,150923.784252</gml:coordinates>
</gml:Point>
</THE_GEOM>
<display_name>Château d&#39;Ouchy</display_name>
<name>Château d&#39;Ouchy</name>
<osm_id>1230808910</osm_id>
<access></access>
<aerialway></aerialway>
<amenity>restaurant</amenity>
<barrier></barrier>
<bicycle></bicycle>
<brand></brand>
<building></building>
<covered></covered>
<denomination></denomination>
<ele></ele>
<foot></foot>
<highway></highway>
<layer></layer>
<leisure></leisure>
<man_made></man_made>
<motorcar></motorcar>
<natural></natural>
<operator></operator>
<population></population>
<power></power>
<place></place>
<railway></railway>
<ref></ref>
<religion></religion>
<shop></shop>
<sport></sport>
<surface></surface>
<tourism></tourism>
<waterway></waterway>
<wood></wood>
</restaurant_feature>
<restaurant_feature>
<gml:boundedBy>
<gml:Box srsName="EPSG:21781">
<gml:coordinates>537770.247124,150975.613968 537770.247124,150975.613968</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<THE_GEOM>
<gml:Point srsName="EPSG:21781">
<gml:coordinates>537770.247124,150975.613968</gml:coordinates>
</gml:Point>
</THE_GEOM>
<display_name>Cafe du Vieil Ouchy</display_name>
<name>Cafe du Vieil Ouchy</name>
<osm_id>1433812389</osm_id>
<access></access>
<aerialway></aerialway>
<amenity>restaurant</amenity>
<barrier></barrier>
<bicycle></bicycle>
<brand></brand>
<building></building>
<covered></covered>
<denomination></denomination>
<ele></ele>
<foot></foot>
<highway></highway>
<layer></layer>
<leisure></leisure>
<man_made></man_made>
<motorcar></motorcar>
<natural></natural>
<operator>Carine Duca</operator>
<population></population>
<power></power>
<place></place>
<railway></railway>
<ref></ref>
<religion></religion>
<shop></shop>
<sport></sport>
<surface></surface>
<tourism></tourism>
<waterway></waterway>
<wood></wood>
</restaurant_feature>
<restaurant_feature>
<gml:boundedBy>
<gml:Box srsName="EPSG:21781">
<gml:coordinates>537789.197617,150976.218227 537789.197617,150976.218227</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<THE_GEOM>
<gml:Point srsName="EPSG:21781">
<gml:coordinates>537789.197617,150976.218227</gml:coordinates>
</gml:Point>
</THE_GEOM>
<display_name>Creperie</display_name>
<name>Creperie</name>
<osm_id>1433812391</osm_id>
<access></access>
<aerialway></aerialway>
<amenity>restaurant</amenity>
<barrier></barrier>
<bicycle></bicycle>
<brand></brand>
<building></building>
<covered></covered>
<denomination></denomination>
<ele></ele>
<foot></foot>
<highway></highway>
<layer></layer>
<leisure></leisure>
<man_made></man_made>
<motorcar></motorcar>
<natural></natural>
<operator></operator>
<population></population>
<power></power>
<place></place>
<railway></railway>
<ref></ref>
<religion></religion>
<shop></shop>
<sport></sport>
<surface></surface>
<tourism></tourism>
<waterway></waterway>
<wood></wood>
</restaurant_feature>
<restaurant_feature>
<gml:boundedBy>
<gml:Box srsName="EPSG:21781">
<gml:coordinates>537810.679909,150983.377694 537810.679909,150983.377694</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<THE_GEOM>
<gml:Point srsName="EPSG:21781">
<gml:coordinates>537810.679909,150983.377694</gml:coordinates>
</gml:Point>
</THE_GEOM>
<display_name>1433812390</display_name>
<name></name>
<osm_id>1433812390</osm_id>
<access></access>
<aerialway></aerialway>
<amenity>restaurant</amenity>
<barrier></barrier>
<bicycle></bicycle>
<brand></brand>
<building></building>
<covered></covered>
<denomination></denomination>
<ele></ele>
<foot></foot>
<highway></highway>
<layer></layer>
<leisure></leisure>
<man_made></man_made>
<motorcar></motorcar>
<natural></natural>
<operator></operator>
<population></population>
<power></power>
<place></place>
<railway></railway>
<ref></ref>
<religion></religion>
<shop></shop>
<sport></sport>
<surface></surface>
<tourism></tourism>
<waterway></waterway>
<wood></wood>
</restaurant_feature>
</restaurant_layer>
<hotel_layer>
<gml:name>Hôtels</gml:name>
<hotel_feature>
<gml:boundedBy>
<gml:Box srsName="EPSG:21781">
<gml:coordinates>537762.425297,150971.904013 537762.425297,150971.904013</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<THE_GEOM>
<gml:Point srsName="EPSG:21781">
<gml:coordinates>537762.425297,150971.904013</gml:coordinates>
</gml:Point>
</THE_GEOM>
<display_name>Hotel du port</display_name>
<name>Hotel du port</name>
<osm_id>2886793101</osm_id>
<access></access>
<aerialway></aerialway>
<amenity></amenity>
<barrier></barrier>
<bicycle></bicycle>
<brand></brand>
<building></building>
<covered></covered>
<denomination></denomination>
<ele></ele>
<foot></foot>
<highway></highway>
<layer></layer>
<leisure></leisure>
<man_made></man_made>
<motorcar></motorcar>
<natural></natural>
<operator></operator>
<population></population>
<power></power>
<place></place>
<railway></railway>
<ref></ref>
<religion></religion>
<shop></shop>
<sport></sport>
<surface></surface>
<tourism>hotel</tourism>
<waterway></waterway>
<wood></wood>
</hotel_feature>
<hotel_feature>
<gml:boundedBy>
<gml:Box srsName="EPSG:21781">
<gml:coordinates>537798.352160,150985.584164 537798.352160,150985.584164</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<THE_GEOM>
<gml:Point srsName="EPSG:21781">
<gml:coordinates>537798.352160,150985.584164</gml:coordinates>
</gml:Point>
</THE_GEOM>
<display_name>Angleterre</display_name>
<name>Angleterre</name>
<osm_id>1433812387</osm_id>
<access></access>
<aerialway></aerialway>
<amenity></amenity>
<barrier></barrier>
<bicycle></bicycle>
<brand></brand>
<building></building>
<covered></covered>
<denomination></denomination>
<ele></ele>
<foot></foot>
<highway></highway>
<layer></layer>
<leisure></leisure>
<man_made></man_made>
<motorcar></motorcar>
<natural></natural>
<operator></operator>
<population></population>
<power></power>
<place></place>
<railway></railway>
<ref></ref>
<religion></religion>
<shop></shop>
<sport></sport>
<surface></surface>
<tourism>hotel</tourism>
<waterway></waterway>
<wood></wood>
</hotel_feature>
</hotel_layer>
</msGMLOutput>

View File

@@ -1,19 +1,23 @@
--- ---
layout: example.html layout: example.html
title: Device Orientation title: Device-Orientation example
shortdesc: Listen to DeviceOrientation events. shortdesc: Listen to DeviceOrientation events.
docs: > docs: >
This example shows how to track changes in device orientation. This example shows how to track changes in device orientation.
tags: "orientation, openstreetmap" tags: "orientation, openstreetmap"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<label> <div class="span12">
track changes <div id="map" class="map"></div>
<input id="track" type="checkbox"/> <div class="span12">
</label> <h4 id="title">Device orientation example</h4>
<p> <label class="checkbox" for="track">
α : <code id="alpha"></code>&nbsp;&nbsp; <input id="track" type="checkbox"/>track changes
β : <code id="beta"></code>&nbsp;&nbsp; </label>
γ : <code id="gamma"></code>&nbsp;&nbsp; <p>&alpha; : <code id="alpha"></code></p>
heading : <code id="heading"></code> <p>&beta; : <code id="beta"></code></p>
</p> <p>&gamma; : <code id="gamma"></code></p>
<p>heading : <code id="heading"></code></p>
</div>
</div>
</div>

View File

@@ -39,7 +39,7 @@ el('track').addEventListener('change', function() {
deviceOrientation.setTracking(this.checked); deviceOrientation.setTracking(this.checked);
}); });
deviceOrientation.on('change', function() { deviceOrientation.on('change', function(event) {
el('alpha').innerText = deviceOrientation.getAlpha() + ' [rad]'; el('alpha').innerText = deviceOrientation.getAlpha() + ' [rad]';
el('beta').innerText = deviceOrientation.getBeta() + ' [rad]'; el('beta').innerText = deviceOrientation.getBeta() + ' [rad]';
el('gamma').innerText = deviceOrientation.getGamma() + ' [rad]'; el('gamma').innerText = deviceOrientation.getGamma() + ' [rad]';

View File

@@ -1,12 +1,21 @@
--- ---
layout: example.html layout: example.html
title: Drag-and-Drop Image Vector title: Drag-and-Drop image vector example
shortdesc: Example of using the drag-and-drop interaction with a ol.source.ImageVector. shortdesc: Example of using the drag-and-drop interaction with a ol.source.ImageVector. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client.
docs: > docs: >
Example of using the drag-and-drop interaction with a ol.source.ImageVector. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client. Example of using the drag-and-drop interaction with a ol.source.ImageVector. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to
an image on the client.
tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image" tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image"
cloak: cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div id="info">&nbsp;</div> <div class="span12">
<div id="map" class="map"></div>
<div class="span4 offset4 pull-right">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>
</div>

View File

@@ -19,7 +19,7 @@ goog.require('ol.style.Style');
var defaultStyle = { var defaultStyle = {
'Point': new ol.style.Style({ 'Point': [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(255,255,0,0.5)' color: 'rgba(255,255,0,0.5)'
@@ -30,14 +30,14 @@ var defaultStyle = {
width: 1 width: 1
}) })
}) })
}), })],
'LineString': new ol.style.Style({ 'LineString': [new ol.style.Style({
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
color: '#f00', color: '#f00',
width: 3 width: 3
}) })
}), })],
'Polygon': new ol.style.Style({ 'Polygon': [new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(0,255,255,0.5)' color: 'rgba(0,255,255,0.5)'
}), }),
@@ -45,8 +45,8 @@ var defaultStyle = {
color: '#0ff', color: '#0ff',
width: 1 width: 1
}) })
}), })],
'MultiPoint': new ol.style.Style({ 'MultiPoint': [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(255,0,255,0.5)' color: 'rgba(255,0,255,0.5)'
@@ -57,14 +57,14 @@ var defaultStyle = {
width: 1 width: 1
}) })
}) })
}), })],
'MultiLineString': new ol.style.Style({ 'MultiLineString': [new ol.style.Style({
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
color: '#0f0', color: '#0f0',
width: 3 width: 3
}) })
}), })],
'MultiPolygon': new ol.style.Style({ 'MultiPolygon': [new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(0,0,255,0.5)' color: 'rgba(0,0,255,0.5)'
}), }),
@@ -72,7 +72,7 @@ var defaultStyle = {
color: '#00f', color: '#00f',
width: 1 width: 1
}) })
}) })]
}; };
var styleFunction = function(feature, resolution) { var styleFunction = function(feature, resolution) {
@@ -100,7 +100,7 @@ var map = new ol.Map({
new ol.layer.Tile({ new ol.layer.Tile({
source: new ol.source.BingMaps({ source: new ol.source.BingMaps({
imagerySet: 'Aerial', imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF' key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
}) })
}) })
], ],
@@ -128,7 +128,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
var displayFeatureInfo = function(pixel) { var displayFeatureInfo = function(pixel) {
var features = []; var features = [];
map.forEachFeatureAtPixel(pixel, function(feature) { map.forEachFeatureAtPixel(pixel, function(feature, layer) {
features.push(feature); features.push(feature);
}); });
if (features.length > 0) { if (features.length > 0) {

View File

@@ -1,12 +1,21 @@
--- ---
layout: example.html layout: example.html
title: Drag-and-Drop title: Drag-and-Drop example
shortdesc: Example of using the drag-and-drop interaction. shortdesc: Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857.
docs: > docs: >
Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857. Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will
only work with data in EPSG:4326 and EPSG:3857.
tags: "drag-and-drop, gpx, geojson, igc, kml, topojson" tags: "drag-and-drop, gpx, geojson, igc, kml, topojson"
cloak: cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://bingmapsportal.com/ here Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3: Your Bing Maps Key from http://bingmapsportal.com/ here
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div id="info">&nbsp;</div> <div class="span12">
<div id="map" class="map"></div>
<div class="span4 offset4 pull-right">
<div id="info" class="alert alert-success">
&nbsp;
</div>
</div>
</div>
</div>

View File

@@ -18,7 +18,7 @@ goog.require('ol.style.Style');
var defaultStyle = { var defaultStyle = {
'Point': new ol.style.Style({ 'Point': [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(255,255,0,0.5)' color: 'rgba(255,255,0,0.5)'
@@ -29,14 +29,14 @@ var defaultStyle = {
width: 1 width: 1
}) })
}) })
}), })],
'LineString': new ol.style.Style({ 'LineString': [new ol.style.Style({
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
color: '#f00', color: '#f00',
width: 3 width: 3
}) })
}), })],
'Polygon': new ol.style.Style({ 'Polygon': [new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(0,255,255,0.5)' color: 'rgba(0,255,255,0.5)'
}), }),
@@ -44,8 +44,8 @@ var defaultStyle = {
color: '#0ff', color: '#0ff',
width: 1 width: 1
}) })
}), })],
'MultiPoint': new ol.style.Style({ 'MultiPoint': [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(255,0,255,0.5)' color: 'rgba(255,0,255,0.5)'
@@ -56,14 +56,14 @@ var defaultStyle = {
width: 1 width: 1
}) })
}) })
}), })],
'MultiLineString': new ol.style.Style({ 'MultiLineString': [new ol.style.Style({
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
color: '#0f0', color: '#0f0',
width: 3 width: 3
}) })
}), })],
'MultiPolygon': new ol.style.Style({ 'MultiPolygon': [new ol.style.Style({
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(0,0,255,0.5)' color: 'rgba(0,0,255,0.5)'
}), }),
@@ -71,7 +71,7 @@ var defaultStyle = {
color: '#00f', color: '#00f',
width: 1 width: 1
}) })
}) })]
}; };
var styleFunction = function(feature, resolution) { var styleFunction = function(feature, resolution) {
@@ -99,7 +99,7 @@ var map = new ol.Map({
new ol.layer.Tile({ new ol.layer.Tile({
source: new ol.source.BingMaps({ source: new ol.source.BingMaps({
imagerySet: 'Aerial', imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF' key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
}) })
}) })
], ],
@@ -124,7 +124,7 @@ dragAndDropInteraction.on('addfeatures', function(event) {
var displayFeatureInfo = function(pixel) { var displayFeatureInfo = function(pixel) {
var features = []; var features = [];
map.forEachFeatureAtPixel(pixel, function(feature) { map.forEachFeatureAtPixel(pixel, function(feature, layer) {
features.push(feature); features.push(feature);
}); });
if (features.length > 0) { if (features.length > 0) {

View File

@@ -1,9 +1,13 @@
--- ---
layout: example.html layout: example.html
title: Drag, Rotate, and Zoom title: Drag rotate and zoom example
shortdesc: A single interaction to drag, rotate, and zoom. shortdesc: A single interaction to drag, rotate, and zoom.
docs: > docs: >
<p><code>Shift+Drag</code> to rotate and zoom the map around its center.</p> <p><code>Shift</code> + Drag to rotate and zoom the map around its center.</p>
tags: "drag, rotate, zoom, interaction" tags: "drag, rotate, zoom, interaction"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -1,17 +1,21 @@
--- ---
layout: example.html layout: example.html
title: Draw and Modify Features title: Draw and modify features example
shortdesc: Example of using the ol.interaction.Draw interaction together with the ol.interaction.Modify interaction. shortdesc: Example of using the ol.interaction.Draw interaction together with the ol.interaction.Modify interaction.
docs: > docs: >
Example of using the ol.interaction.Draw interaction together with the ol.interaction.Modify interaction. Example of using the ol.interaction.Draw interaction together with the ol.interaction.Modify interaction.
tags: "draw, edit, modify, vector, featureoverlay" tags: "draw, edit, modify, vector, featureoverlay"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<form class="form-inline"> <div class="span12">
<label>Geometry type &nbsp;</label> <div id="map" class="map"></div>
<select id="type"> </div>
<option value="Point">Point</option> <form class="form-inline">
<option value="LineString">LineString</option> <label>Geometry type &nbsp;</label>
<option value="Polygon">Polygon</option> <select id="type">
</select> <option value="Point">Point</option>
</form> <option value="LineString">LineString</option>
<option value="Polygon">Polygon</option>
</select>
</form>
</div>

View File

@@ -60,8 +60,6 @@ var modify = new ol.interaction.Modify({
map.addInteraction(modify); map.addInteraction(modify);
var draw; // global so we can remove it later var draw; // global so we can remove it later
var typeSelect = document.getElementById('type');
function addInteraction() { function addInteraction() {
draw = new ol.interaction.Draw({ draw = new ol.interaction.Draw({
features: features, features: features,
@@ -70,11 +68,14 @@ function addInteraction() {
map.addInteraction(draw); map.addInteraction(draw);
} }
var typeSelect = document.getElementById('type');
/** /**
* Handle change event. * Let user change the geometry type.
* @param {Event} e Change event.
*/ */
typeSelect.onchange = function() { typeSelect.onchange = function(e) {
map.removeInteraction(draw); map.removeInteraction(draw);
addInteraction(); addInteraction();
}; };

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Draw Features title: Draw features example
shortdesc: Example of using the ol.interaction.Draw interaction. shortdesc: Example of using the ol.interaction.Draw interaction.
docs: > docs: >
Example of using the Draw interaction. Select a geometry type from the Example of using the Draw interaction. Select a geometry type from the
@@ -12,16 +12,20 @@ docs: >
points and creates a rectangular box. points and creates a rectangular box.
tags: "draw, edit, freehand, vector" tags: "draw, edit, freehand, vector"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<form class="form-inline"> <div class="span12">
<label>Geometry type &nbsp;</label> <div id="map" class="map"></div>
<select id="type"> <form class="form-inline">
<option value="Point">Point</option> <label>Geometry type &nbsp;</label>
<option value="LineString">LineString</option> <select id="type">
<option value="Polygon">Polygon</option> <option value="None">None</option>
<option value="Circle">Circle</option> <option value="Point">Point</option>
<option value="Square">Square</option> <option value="LineString">LineString</option>
<option value="Box">Box</option> <option value="Polygon">Polygon</option>
<option value="None">None</option> <option value="Circle">Circle</option>
</select> <option value="Square">Square</option>
</form> <option value="Box">Box</option>
</select>
</form>
</div>
</div>

View File

@@ -83,9 +83,10 @@ function addInteraction() {
/** /**
* Handle change event. * Let user change the geometry type.
* @param {Event} e Change event.
*/ */
typeSelect.onchange = function() { typeSelect.onchange = function(e) {
map.removeInteraction(draw); map.removeInteraction(draw);
addInteraction(); addInteraction();
}; };

View File

@@ -1,9 +1,13 @@
--- ---
layout: example.html layout: example.html
title: Dynamic Data title: Dynamic data example
shortdesc: Example of dynamic data. shortdesc: Example of dynamic data.
docs: > docs: >
Example of dynamic data. Example of dynamic data.
tags: "dynamic-data" tags: "dynamic-data"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -9,4 +9,8 @@ docs: >
<p>To achieve this, we make heavy use of style functions and <code>ol.style.Style#geometry</code>.</p> <p>To achieve this, we make heavy use of style functions and <code>ol.style.Style#geometry</code>.</p>
tags: "KML, vector, style, geometry, cluster" tags: "KML, vector, style, geometry, cluster"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -56,7 +56,7 @@ function createEarthquakeStyle(feature) {
}); });
} }
var maxFeatureCount, vector; var maxFeatureCount;
function calculateClusterInfo(resolution) { function calculateClusterInfo(resolution) {
maxFeatureCount = 0; maxFeatureCount = 0;
var features = vector.getSource().getFeatures(); var features = vector.getSource().getFeatures();
@@ -65,8 +65,7 @@ function calculateClusterInfo(resolution) {
feature = features[i]; feature = features[i];
var originalFeatures = feature.get('features'); var originalFeatures = feature.get('features');
var extent = ol.extent.createEmpty(); var extent = ol.extent.createEmpty();
var j, jj; for (var j = 0, jj = originalFeatures.length; j < jj; ++j) {
for (j = 0, jj = originalFeatures.length; j < jj; ++j) {
ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent()); ol.extent.extend(extent, originalFeatures[j].getGeometry().getExtent());
} }
maxFeatureCount = Math.max(maxFeatureCount, jj); maxFeatureCount = Math.max(maxFeatureCount, jj);
@@ -85,7 +84,7 @@ function styleFunction(feature, resolution) {
var style; var style;
var size = feature.get('features').length; var size = feature.get('features').length;
if (size > 1) { if (size > 1) {
style = new ol.style.Style({ style = [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
radius: feature.get('radius'), radius: feature.get('radius'),
fill: new ol.style.Fill({ fill: new ol.style.Fill({
@@ -97,15 +96,15 @@ function styleFunction(feature, resolution) {
fill: textFill, fill: textFill,
stroke: textStroke stroke: textStroke
}) })
}); })];
} else { } else {
var originalFeature = feature.get('features')[0]; var originalFeature = feature.get('features')[0];
style = createEarthquakeStyle(originalFeature); style = [createEarthquakeStyle(originalFeature)];
} }
return style; return style;
} }
function selectStyleFunction(feature) { function selectStyleFunction(feature, resolution) {
var styles = [new ol.style.Style({ var styles = [new ol.style.Style({
image: new ol.style.Circle({ image: new ol.style.Circle({
radius: feature.get('radius'), radius: feature.get('radius'),
@@ -121,7 +120,7 @@ function selectStyleFunction(feature) {
return styles; return styles;
} }
vector = new ol.layer.Vector({ var vector = new ol.layer.Vector({
source: new ol.source.Cluster({ source: new ol.source.Cluster({
distance: 40, distance: 40,
source: new ol.source.Vector({ source: new ol.source.Vector({

View File

@@ -1,9 +0,0 @@
---
layout: example.html
title: Earthquakes with custom symbols
shortdesc: Demonstrates the use of `ol.render.toCanvas` to create custom icon symbols.
docs: >
This example parses a KML file and renders the features as a vector layer. The layer is given a <code>style</code> that renders earthquake locations with a custom lightning symbol and a size relative to their magnitude.
tags: "KML, vector, style, canvas, symbol"
---
<div id="map" class="map"></div>

View File

@@ -1,71 +0,0 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.KML');
goog.require('ol.geom.Polygon');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.render');
goog.require('ol.source.Stamen');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.Icon');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var styleCache = {};
var styleFunction = function(feature) {
// 2012_Earthquakes_Mag5.kml stores the magnitude of each earthquake in a
// standards-violating <magnitude> tag in each Placemark. We extract it from
// the Placemark's name instead.
var name = feature.get('name');
var magnitude = parseFloat(name.substr(2));
var size = parseInt(10 + 40 * (magnitude - 5), 10);
var style = styleCache[size];
if (!style) {
var canvas =
/** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
var render = ol.render.toContext(
/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')),
{size: [size + 2, size + 2], pixelRatio: size / 10});
render.setFillStrokeStyle(
new ol.style.Fill({color: 'rgba(255, 153, 0, 0.4)'}),
new ol.style.Stroke({color: 'rgba(255, 204, 0, 0.2)', width: 1}));
render.drawPolygonGeometry(new ol.geom.Polygon(
[[[0, 0], [4, 2], [6, 0], [10, 5], [6, 3], [4, 5], [0, 0]]]));
style = new ol.style.Style({
image: new ol.style.Icon({
img: canvas,
imgSize: [canvas.width, canvas.height],
rotation: 1.2
})
});
styleCache[size] = style;
}
return style;
};
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
url: 'data/kml/2012_Earthquakes_Mag5.kml',
format: new ol.format.KML({
extractStyles: false
})
}),
style: styleFunction
});
var raster = new ol.layer.Tile({
source: new ol.source.Stamen({
layer: 'toner'
})
});
var map = new ol.Map({
layers: [raster, vector],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -1,9 +1,13 @@
--- ---
layout: example.html layout: example.html
title: EPSG:4326 title: EPSG:4326 example
shortdesc: Example of a map in EPSG:4326. shortdesc: Example of a map in EPSG:4326.
docs: > docs: >
This example shows how to create a map in EPSG:4326. This example shows how to create a map in EPSG:4326.
tags: "epsg4326" tags: "epsg4326"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -1,14 +1,18 @@
--- ---
layout: example.html layout: example.html
title: Map Export title: Export map example
shortdesc: Example of exporting a map as a PNG image. shortdesc: Example of exporting a map as a PNG image.
docs: > docs: >
Example of exporting a map as a PNG image. Example of exporting a map as a PNG image.
tags: "export, png, openstreetmap" tags: "export, png, openstreetmap"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<div id="no-download" class="alert alert-danger" style="display: none"> <div class="span12">
This example requires a browser that supports the <div id="map" class="map"></div>
<a href="http://caniuse.com/#feat=download">link download</a> attribute. <div id="no-download" class="alert alert-danger" style="display: none">
This example requires a browser that supports the
<a href="http://caniuse.com/#feat=download">link download</a> attribute.
</div>
<a id="export-png" class="btn btn-default" download="map.png"><i class="fa fa-download"></i> Export PNG</a>
</div>
</div> </div>
<a id="export-png" class="btn btn-default" download="map.png"><i class="fa fa-download"></i> Download PNG</a>

View File

@@ -34,7 +34,7 @@ var map = new ol.Map({
var exportPNGElement = document.getElementById('export-png'); var exportPNGElement = document.getElementById('export-png');
if ('download' in exportPNGElement) { if ('download' in exportPNGElement) {
exportPNGElement.addEventListener('click', function() { exportPNGElement.addEventListener('click', function(e) {
map.once('postcompose', function(event) { map.once('postcompose', function(event) {
var canvas = event.context.canvas; var canvas = event.context.canvas;
exportPNGElement.href = canvas.toDataURL('image/png'); exportPNGElement.href = canvas.toDataURL('image/png');

View File

@@ -1,3 +0,0 @@
.map {
max-width: 566px;
}

View File

@@ -1,33 +0,0 @@
---
layout: example.html
title: Export PDF example
shortdesc: Example of exporting a map as a PDF.
docs: >
Example of exporting a map as a PDF using the <a href="https://github.com/MrRio/jsPDF" target="_blank">jsPDF</a> library.
tags: "export, pdf, openstreetmap"
resources:
- http://mrrio.github.io/jsPDF/dist/jspdf.min.js
---
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<form class="form">
<label>Page size </label>
<select id="format">
<option value="a0">A0 (slow)</option>
<option value="a1">A1</option>
<option value="a2">A2</option>
<option value="a3">A3</option>
<option value="a4" selected>A4</option>
<option value="a5">A5 (fast)</option>
</select>
<label>Resolution </label>
<select id="resolution">
<option value="72">72 dpi (fast)</option>
<option value="150">150 dpi</option>
<option value="300">300 dpi (slow)</option>
</select>
</form>
<button id="export-pdf">Export PDF</button>

View File

@@ -1,109 +0,0 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control');
goog.require('ol.format.WKT');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var format = new ol.format.WKT();
var feature = format.readFeature(
'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' +
'-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' +
'-39.1552734375, 10.689697265625 -25.0927734375))');
feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
features: [feature]
})
});
var map = new ol.Map({
layers: [raster, vector],
target: 'map',
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: false
})
}),
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
var dims = {
a0: [1189, 841],
a1: [841, 594],
a2: [594, 420],
a3: [420, 297],
a4: [297, 210],
a5: [210, 148]
};
var loading = 0;
var loaded = 0;
var exportButton = document.getElementById('export-pdf');
exportButton.addEventListener('click', function() {
exportButton.disabled = true;
document.body.style.cursor = 'progress';
var format = document.getElementById('format').value;
var resolution = document.getElementById('resolution').value;
var dim = dims[format];
var width = Math.round(dim[0] * resolution / 25.4);
var height = Math.round(dim[1] * resolution / 25.4);
var size = /** @type {ol.Size} */ (map.getSize());
var extent = map.getView().calculateExtent(size);
var source = raster.getSource();
var tileLoadStart = function() {
++loading;
};
var tileLoadEnd = function() {
++loaded;
if (loading === loaded) {
var canvas = this;
window.setTimeout(function() {
loading = 0;
loaded = 0;
var data = canvas.toDataURL('image/png');
var pdf = new jsPDF('landscape', undefined, format);
pdf.addImage(data, 'JPEG', 0, 0, dim[0], dim[1]);
pdf.save('map.pdf');
source.un('tileloadstart', tileLoadStart);
source.un('tileloadend', tileLoadEnd, canvas);
source.un('tileloaderror', tileLoadEnd, canvas);
map.setSize(size);
map.getView().fit(extent, size);
map.renderSync();
exportButton.disabled = false;
document.body.style.cursor = 'auto';
}, 100);
}
};
map.once('postcompose', function(event) {
source.on('tileloadstart', tileLoadStart);
source.on('tileloadend', tileLoadEnd, event.context.canvas);
source.on('tileloaderror', tileLoadEnd, event.context.canvas);
});
map.setSize([width, height]);
map.getView().fit(extent, /** @type {ol.Size} */ (map.getSize()));
map.renderSync();
}, false);

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Custom Animation title: Feature animation example
shortdesc: Demonstrates how to animate features. shortdesc: Demonstrates how to animate features.
docs: > docs: >
This example shows how to use <b>postcompose</b> and <b>vectorContext</b> to This example shows how to use <b>postcompose</b> and <b>vectorContext</b> to
@@ -8,4 +8,8 @@ docs: >
is added to the layer. is added to the layer.
tags: "animation, vector, feature, flash" tags: "animation, vector, feature, flash"
--- ---
<div id="map" class="map"></div> <div class="row">
<div class="span8">
<div id="map" class="map"></div>
</div>
</div>

View File

@@ -83,7 +83,7 @@ function flash(feature) {
return; return;
} }
// tell OL3 to continue postcompose animation // tell OL3 to continue postcompose animation
map.render(); frameState.animate = true;
} }
listenerKey = map.on('postcompose', animate); listenerKey = map.on('postcompose', animate);
} }

View File

@@ -1,6 +1,6 @@
--- ---
layout: example.html layout: example.html
title: Marker Animation title: Animate a feature movement
shortdesc: Demonstrates how to move a feature along a line. shortdesc: Demonstrates how to move a feature along a line.
docs: > docs: >
This example shows how to use <b>postcompose</b> and <b>vectorContext</b> to This example shows how to use <b>postcompose</b> and <b>vectorContext</b> to
@@ -8,9 +8,17 @@ docs: >
is being used. is being used.
tags: "animation, feature, postcompose, polyline" tags: "animation, feature, postcompose, polyline"
--- ---
<div id="map" class="map"></div> <div class="row-fluid">
<label for="speed"> <div class="span12">
speed:&nbsp; <div id="map" class="map"></div>
<input id="speed" type="range" min="10" max="999" step="10" value="60"> </div>
</label> </div>
<button id="start-animation">Start Animation</button> <div class="row-fluid">
<div class="span12">
<label for="speed">
speed:&nbsp;
<input id="speed" type="range" min="10" max="999" step="10" value="60">
</label>
<button id="start-animation">Start Animation</button>
</div>
</div>

View File

@@ -108,21 +108,16 @@ var styles = {
}) })
}; };
var animating = false;
var speed, now;
var speedInput = document.getElementById('speed');
var startButton = document.getElementById('start-animation');
var vectorLayer = new ol.layer.Vector({ var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({ source: new ol.source.Vector({
features: [routeFeature, geoMarker, startMarker, endMarker] features: [routeFeature, geoMarker, startMarker, endMarker]
}), }),
style: function(feature) { style: function(feature, resolution) {
// hide geoMarker if animation is active // hide geoMarker if animation is active
if (animating && feature.get('type') === 'geoMarker') { if (animating && feature.get('type') === 'geoMarker') {
return null; return [];
} }
return styles[feature.get('type')]; return [styles[feature.get('type')]];
} }
}); });
@@ -140,7 +135,7 @@ var map = new ol.Map({
new ol.layer.Tile({ new ol.layer.Tile({
source: new ol.source.BingMaps({ source: new ol.source.BingMaps({
imagerySet: 'AerialWithLabels', imagerySet: 'AerialWithLabels',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF' key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3'
}) })
}), }),
vectorLayer vectorLayer
@@ -203,4 +198,8 @@ function stopAnimation(ended) {
map.un('postcompose', moveFeature); map.un('postcompose', moveFeature);
} }
var speed, now;
var animating = false;
var speedInput = document.getElementById('speed');
var startButton = document.getElementById('start-animation');
startButton.addEventListener('click', startAnimation, false); startButton.addEventListener('click', startAnimation, false);

View File

@@ -1,17 +0,0 @@
---
layout: example.html
title: Flight Animation
shortdesc: Demonstrates how to animate flights with ´postcompose´.
docs: >
This example shows how to use <b>postcompose</b> and <b>vectorContext</b> to
animate flights. A great circle arc between two airports is calculated using
<a href="https://github.com/springmeyer/arc.js">arc.js</a> and then the flight
paths are animated with <b>postcompose</b>. The flight data is provided by
<a href="http://openflights.org/data.html">OpenFlights</a> (a simplified data
set from the <a href="https://www.mapbox.com/mapbox.js/example/v1.0.0/animating-flight-paths/">
Mapbox.js documentation</a> is used).
tags: "animation, vector, feature, flights, arc"
resources:
- https://api.mapbox.com/mapbox.js/plugins/arc.js/v0.1.0/arc.js
---
<div id="map" class="map"></div>

View File

@@ -1,130 +0,0 @@
// NOCOMPILE
goog.require('ol.Attribution');
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.LineString');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.proj');
goog.require('ol.source.Stamen');
goog.require('ol.source.Vector');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.Stamen({
layer: 'toner'
})
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
var defaultStroke = new ol.style.Stroke({
color: '#EAE911',
width: 2
});
var defaultStyle = new ol.style.Style({
stroke: defaultStroke
});
var flightsSource;
var addLater = function(feature, timeout) {
window.setTimeout(function() {
feature.set('start', new Date().getTime());
flightsSource.addFeature(feature);
}, timeout);
};
var pointsPerMs = 0.1;
var animateFlights = function(event) {
var vectorContext = event.vectorContext;
var frameState = event.frameState;
vectorContext.setFillStrokeStyle(null, defaultStroke);
var features = flightsSource.getFeatures();
for (var i = 0; i < features.length; i++) {
var feature = features[i];
if (!feature.get('finished')) {
// only draw the lines for which the animation has not
// finished yet
var coords = feature.getGeometry().getCoordinates();
var elapsedTime = frameState.time - feature.get('start');
var elapsedPoints = elapsedTime * pointsPerMs;
if (elapsedPoints >= coords.length) {
feature.set('finished', true);
}
var maxIndex = Math.min(elapsedPoints, coords.length);
var currentLine = new ol.geom.LineString(coords.slice(0, maxIndex));
// directly draw the line with the vector context
vectorContext.drawLineStringGeometry(currentLine, feature);
}
}
// tell OL3 to continue the postcompose animation
map.render();
};
flightsSource = new ol.source.Vector({
wrapX: false,
attributions: [new ol.Attribution({
html: 'Flight data by ' +
'<a href="http://openflights.org/data.html">OpenFlights</a>,'
})],
loader: function() {
var url = 'data/openflights/flights.json';
fetch(url).then(function(response) {
return response.json();
}).then(function(json) {
var flightsData = json.flights;
for (var i = 0; i < flightsData.length; i++) {
var flight = flightsData[i];
var from = flight[0];
var to = flight[1];
// create an arc circle between the two locations
var arcGenerator = new arc.GreatCircle(
{x: from[1], y: from[0]},
{x: to[1], y: to[0]});
var arcLine = arcGenerator.Arc(100, {offset: 10});
if (arcLine.geometries.length === 1) {
var line = new ol.geom.LineString(arcLine.geometries[0].coords);
line.transform(ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857'));
var feature = new ol.Feature({
geometry: line,
finished: false
});
// add the feature with a delay so that the animation
// for all features does not start at the same time
addLater(feature, i * 50);
}
}
map.on('postcompose', animateFlights);
});
}
});
var flightsLayer = new ol.layer.Vector({
source: flightsSource,
style: function(feature) {
// if the animation is still active for a feature, do not
// render the feature with the layer style
if (feature.get('finished')) {
return defaultStyle;
} else {
return null;
}
}
});
map.addLayer(flightsLayer);

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