Merge branch 'master' of github.com:openlayers/ol3 into vector

This commit is contained in:
ahocevar
2013-03-11 15:21:01 +01:00
46 changed files with 699 additions and 227 deletions

View File

@@ -56,8 +56,8 @@ rotateRight.addEventListener('click', function() {
var panToLondon = document.getElementById('pan-to-london');
panToLondon.addEventListener('click', function() {
var pan = ol.animation.pan({
source: map.getView().getView2D().getCenter(),
duration: 2000
duration: 2000,
source: map.getView().getView2D().getCenter()
});
map.addPreRenderFunction(pan);
map.getView().getView2D().setCenter(london);
@@ -66,9 +66,9 @@ panToLondon.addEventListener('click', function() {
var elasticToMoscow = document.getElementById('elastic-to-moscow');
elasticToMoscow.addEventListener('click', function() {
var pan = ol.animation.pan({
source: map.getView().getView2D().getCenter(),
duration: 2000,
easing: ol.easing.elastic
easing: ol.easing.elastic,
source: map.getView().getView2D().getCenter()
});
map.addPreRenderFunction(pan);
map.getView().getView2D().setCenter(moscow);
@@ -77,9 +77,9 @@ elasticToMoscow.addEventListener('click', function() {
var bounceToInstanbul = document.getElementById('bounce-to-instanbul');
bounceToInstanbul.addEventListener('click', function() {
var pan = ol.animation.pan({
source: map.getView().getView2D().getCenter(),
duration: 2000,
easing: ol.easing.bounce
easing: ol.easing.bounce,
source: map.getView().getView2D().getCenter()
});
map.addPreRenderFunction(pan);
map.getView().getView2D().setCenter(instanbul);

View File

@@ -42,7 +42,7 @@ domMap.bindTo('layers', webglMap);
domMap.bindTo('view', webglMap);
var canvasMap = new ol.Map({
renderer: ol.RendererHint.DOM,
renderer: ol.RendererHint.CANVAS,
target: 'canvasMap'
});
canvasMap.bindTo('layers', webglMap);

61
examples/geolocation.html Normal file
View File

@@ -0,0 +1,61 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="examples.css" type="text/css">
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<style>
.icon-flag {
font-size: 22px;
text-shadow: 2px 2px 3px #013;
}
</style>
<title>Geolocation example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h4 id="title">Geolocation example</h4>
<p id="shortdesc">Example of a geolocation map.</p>
<div id="docs">
<p>See the <a href="geolocation.js" target="_blank">geolocation.js source</a> to see how this is done.</p>
</div>
<button id="locate"><i class="icon-screenshot"></i> locate</button>
<div id="tags">geolocation, openstreetmap</div>
</div>
</div>
</div>
<script src="jquery.min.js" type="text/javascript"></script>
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="loader.js?id=geolocation" type="text/javascript"></script>
</body>
</html>

43
examples/geolocation.js Normal file
View File

@@ -0,0 +1,43 @@
goog.require('ol.AnchoredElement');
goog.require('ol.Coordinate');
goog.require('ol.Geolocation');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OpenStreetMap');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.OpenStreetMap()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: new ol.Coordinate(0, 0),
zoom: 2
})
});
var geolocation = new ol.Geolocation();
geolocation.bindTo('projection', map.getView());
var marker = new ol.AnchoredElement({
map: map,
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0))
});
// bind the marker position to the device location.
marker.bindTo('position', geolocation);
geolocation.addEventListener('accuracy_changed', function() {
$(marker.getElement()).tooltip({
title: this.getAccuracy() + 'm from this point'
});
});
$('#locate').click(function() {
geolocation.setTracking(true);
});

View File

@@ -3,11 +3,15 @@ goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.projection');
goog.require('ol.source.BingMaps');
var layer = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
source: new ol.source.BingMaps({
key: 'AgtFlPYDnymLEe9zJ5PCkghbNiFZE9aAtTy3mPaEnEBXqLHtFuTcKoZ-miMC3w7R',
style: 'Aerial'
})
});
var map = new ol.Map({
@@ -15,8 +19,9 @@ var map = new ol.Map({
renderer: ol.RendererHint.WEBGL,
target: 'map',
view: new ol.View2D({
center: new ol.Coordinate(0, 0),
zoom: 2
center: ol.projection.transform(
new ol.Coordinate(-9.375, 51.483333), 'EPSG:4326', 'EPSG:3857'),
zoom: 15
})
});

4
examples/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

52
examples/rotation.html Normal file
View File

@@ -0,0 +1,52 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="examples.css" type="text/css">
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Rotation example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h4 id="title">Rotation example</h4>
<p id="shortdesc">Example of a rotated map. Use <code>Alt</code>+<code>Shift</code>+drag to rotate the map.</p>
<div id="docs">
<p>See the <a href="rotation.js" target="_blank">rotation.js source</a> to see how this is done.</p>
</div>
<div id="tags">rotation, openstreetmap</div>
</div>
</div>
</div>
<script src="loader.js?id=rotation" type="text/javascript"></script>
</body>
</html>

22
examples/rotation.js Normal file
View File

@@ -0,0 +1,22 @@
goog.require('ol.Coordinate');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.OpenStreetMap');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.OpenStreetMap()
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: new ol.Coordinate(-25860000, 4130000),
rotation: Math.PI / 6,
zoom: 10
})
});

View File

@@ -0,0 +1,52 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="examples.css" type="text/css">
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Semi-transparent layer example</title>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h4 id="title">Semi-transparent layer example</h4>
<p id="shortdesc">Example of a map with a semi-transparent layer.</p>
<div id="docs">
<p>See the <a href="semi-transparent-layer.js" target="_blank">semi-transparent-layer.js source</a> to see how this is done.</p>
</div>
<div id="tags">transparent, mapquest, tilejson</div>
</div>
</div>
</div>
<script src="loader.js?id=semi-transparent-layer" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,29 @@
goog.require('ol.Coordinate');
goog.require('ol.Map');
goog.require('ol.RendererHints');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.projection');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.TileJSON');
var map = new ol.Map({
layers: [
new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
}),
new ol.layer.TileLayer({
source: new ol.source.TileJSON({
uri: 'http://api.tiles.mapbox.com/v3/mapbox.va-quake-aug.jsonp'
})
})
],
renderers: ol.RendererHints.createFromQueryData(),
target: 'map',
view: new ol.View2D({
center: ol.projection.transform(
new ol.Coordinate(-77.93255, 37.9555), 'EPSG:4326', 'EPSG:3857'),
zoom: 5
})
});