Merge branch 'master' of github.com:openlayers/ol3 into vector
This commit is contained in:
commit
a66f26f839
46 files changed
+699
-227
No files matched your search
+2
-2
@@ -4,7 +4,7 @@ before_install:
|
||||
|
||||
before_script:
|
||||
- "./build.py plovr"
|
||||
- "./build.py serve-precommit &"
|
||||
- "./build.py serve-integration-test &"
|
||||
- "sleep 3"
|
||||
|
||||
script: "./build.py JSDOC=jsdoc/jsdoc precommit"
|
||||
script: "./build.py JSDOC=jsdoc/jsdoc integration-test"
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
OpenLayers contributors:
|
||||
|
||||
* Antoine Abt
|
||||
* Mike Adair
|
||||
* Jeff Adams
|
||||
* Seb Benthall
|
||||
* Bruno Binet
|
||||
* Stéphane Brunner
|
||||
* Howard Butler
|
||||
* Bertil Chaupis
|
||||
* John Cole
|
||||
* Tim Coulter
|
||||
* Robert Coup
|
||||
* Jeff Dege
|
||||
* Roald de Wit
|
||||
* Schuyler Erle
|
||||
* Christian López Espínola
|
||||
* John Frank
|
||||
* Sean Gilles
|
||||
* Pierre Giraud
|
||||
* Ivan Grcic
|
||||
* Andreas Hocevar
|
||||
* Marc Jansen
|
||||
* Ian Johnson
|
||||
* Frédéric Junod
|
||||
* Eric Lemoine
|
||||
* Philip Lindsay
|
||||
* Martijn van Oosterhout
|
||||
* David Overstrom
|
||||
* Tom Payne
|
||||
* Corey Puffault
|
||||
* Peter William Robins
|
||||
* Gregers Rygg
|
||||
* Tim Schaub
|
||||
* Christopher Schmidt
|
||||
* Cameron Shorter
|
||||
* Pedro Simonetti
|
||||
* Paul Spencer
|
||||
* Paul Smith
|
||||
* Glen Stampoultzis
|
||||
* James Stembridge
|
||||
* Erik Uzureau
|
||||
* Bart van den Eijnden
|
||||
* Ivan Willig
|
||||
* Thomas Wood
|
||||
* Bill Woodall
|
||||
* Steve Woodbridge
|
||||
* David Zwarg
|
||||
|
||||
Some portions of OpenLayers are used under the Apache 2.0 license, available
|
||||
in doc/licenses/APACHE-2.0.txt.
|
||||
|
||||
Some portions of OpenLayers are used under the MIT license, availabie in
|
||||
doc/licenses/MIT-LICENSE.txt.
|
||||
|
||||
Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used
|
||||
under the BSD license, available in doc/licenses/BSD-LICENSE.txt
|
||||
+2
-1
@@ -50,7 +50,8 @@ Use the following to run the tests:
|
||||
|
||||
$ ./build.py test
|
||||
|
||||
This command assumes that the `phantomjs` command is on your PATH.
|
||||
This command assumes that the `phantomjs` command is on your PATH and that the
|
||||
polvr web server is running (`./build.py serve`).
|
||||
|
||||
### The `precommit` target
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Copyright 2005-2013 OpenLayers Contributors. All rights reserved. See
|
||||
authors.txt for full list.
|
||||
AUTHORS.md for full list.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
+27
-3
@@ -67,7 +67,7 @@ Run the plovr web server (see above), and either open the `test/ol.html` file
|
||||
in the browser (e.g. <http://localhost:8000/test/ol.html>), or run `./build.py test`
|
||||
on the console (headless testing with PhantomJS, make sure to install it first from http://phantomjs.org/download.html).
|
||||
|
||||
See also the test-specific [readme](https://github.com/openlayers/ol3/tree/master/test).
|
||||
See also the test-specific [README](test/README.md).
|
||||
|
||||
## Run the linter
|
||||
|
||||
@@ -77,9 +77,33 @@ Then:
|
||||
|
||||
$ ./build.py lint
|
||||
|
||||
## Run the precommit hook before pushing a commit:
|
||||
## Run the check hook before pushing a commit
|
||||
|
||||
$ ./build.py precommit
|
||||
$ ./build.py check
|
||||
|
||||
The check hook does a few quick tests to make sure that the basics still work. This includes:
|
||||
|
||||
* Running the linter
|
||||
* Building the library
|
||||
* Running the tests
|
||||
|
||||
|
||||
## Continuous integration tests
|
||||
|
||||
When you submit a pull request the [Travis continuous integration
|
||||
server](https://travis-ci.org/) will run a full suite of tests, including
|
||||
building all versions of the library and checking that all of the examples
|
||||
work. You will receive an email with the results, and the status will be
|
||||
displayed in the pull request. If you want to run the integration tests
|
||||
locally, then you'll need to make sure that Plovr is running if it isn't
|
||||
already, and then start the tests:
|
||||
|
||||
$ ./build.py integration-test
|
||||
|
||||
Running the full suite of integration tests currently takes 5-10 minutes.
|
||||
|
||||
This makes sure that your commit won't break the build. It also runs JSDoc3 to
|
||||
make sure that there are no invalid API doc directives.
|
||||
|
||||
## Add examples
|
||||
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
OpenLayers contributors:
|
||||
|
||||
Antoine Abt
|
||||
Mike Adair
|
||||
Jeff Adams
|
||||
Seb Benthall
|
||||
Bruno Binet
|
||||
Stéphane Brunner
|
||||
Howard Butler
|
||||
Bertil Chaupis
|
||||
John Cole
|
||||
Tim Coulter
|
||||
Robert Coup
|
||||
Jeff Dege
|
||||
Roald de Wit
|
||||
Schuyler Erle
|
||||
Christian López Espínola
|
||||
John Frank
|
||||
Sean Gilles
|
||||
Pierre Giraud
|
||||
Ivan Grcic
|
||||
Andreas Hocevar
|
||||
Marc Jansen
|
||||
Ian Johnson
|
||||
Frédéric Junod
|
||||
Eric Lemoine
|
||||
Philip Lindsay
|
||||
Martijn van Oosterhout
|
||||
David Overstrom
|
||||
Tom Payne
|
||||
Corey Puffault
|
||||
Peter William Robins
|
||||
Gregers Rygg
|
||||
Tim Schaub
|
||||
Christopher Schmidt
|
||||
Cameron Shorter
|
||||
Pedro Simonetti
|
||||
Paul Spencer
|
||||
Paul Smith
|
||||
Glen Stampoultzis
|
||||
James Stembridge
|
||||
Erik Uzureau
|
||||
Bart van den Eijnden
|
||||
Ivan Willig
|
||||
Thomas Wood
|
||||
Bill Woodall
|
||||
Steve Woodbridge
|
||||
David Zwarg
|
||||
|
||||
Some portions of OpenLayers are used under the Apache 2.0 license, available
|
||||
in doc/licenses/APACHE-2.0.txt.
|
||||
|
||||
Some portions of OpenLayers are used under the MIT license, availabie in
|
||||
doc/licenses/MIT-LICENSE.txt.
|
||||
|
||||
Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used
|
||||
under the BSD license, available in doc/licenses/BSD-LICENSE.txt
|
||||
@@ -63,6 +63,7 @@ EXAMPLES_SRC = [path
|
||||
if not path.startswith('examples/bootstrap')
|
||||
if not path.startswith('examples/font-awesome')
|
||||
if path != 'examples/Jugl.js'
|
||||
if path != 'examples/jquery.min.js'
|
||||
if path != 'examples/example-list.js']
|
||||
|
||||
INTERNAL_SRC = [
|
||||
@@ -95,15 +96,18 @@ def report_sizes(t):
|
||||
t.info(' compressed: %d bytes', len(stringio.getvalue()))
|
||||
|
||||
|
||||
virtual('all', 'build-all', 'build', 'examples', 'precommit')
|
||||
virtual('default', 'build')
|
||||
|
||||
|
||||
virtual('precommit', 'lint', 'build-all', 'test', 'build', 'build-examples', 'check-examples', 'doc')
|
||||
virtual('integration-test', 'lint', 'build', 'build-all', 'test', 'build-examples', 'check-examples', 'doc')
|
||||
|
||||
|
||||
virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-simple.js', 'build/ol-whitespace.js')
|
||||
|
||||
|
||||
virtual('check', 'lint', 'build/ol.css', 'build/ol.js', 'test')
|
||||
|
||||
|
||||
virtual('todo', 'fixme')
|
||||
|
||||
|
||||
@@ -206,6 +210,15 @@ def examples_star_json(name, match):
|
||||
'examples/%(id)s.js' % match.groupdict(),
|
||||
'build/src/internal/src/types.js',
|
||||
],
|
||||
'externs': [
|
||||
'//json.js',
|
||||
'//jquery-1.7.js',
|
||||
'externs/bingmaps.js',
|
||||
'externs/bootstrap.js',
|
||||
'externs/geojson.js',
|
||||
'externs/proj4js.js',
|
||||
'externs/tilejson.js',
|
||||
],
|
||||
})
|
||||
with open(t.name, 'w') as f:
|
||||
f.write(content)
|
||||
@@ -227,7 +240,7 @@ def serve(t):
|
||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'build/ol.json', 'build/ol-all.json', EXAMPLES_JSON, 'test/test.json')
|
||||
|
||||
|
||||
@target('serve-precommit', PLOVR_JAR, INTERNAL_SRC)
|
||||
@target('serve-integration-test', PLOVR_JAR, INTERNAL_SRC)
|
||||
def serve_precommit(t):
|
||||
t.run('%(JAVA)s', '-jar', PLOVR_JAR, 'serve', 'build/ol-all.json', 'test/test.json')
|
||||
|
||||
@@ -410,7 +423,7 @@ def hostexamples(t):
|
||||
'build/ol.css', build_dir)
|
||||
t.cp('examples/example-list.html', examples_dir + '/index.html')
|
||||
t.cp('examples/example-list.js', 'examples/example-list.xml',
|
||||
'examples/Jugl.js', examples_dir)
|
||||
'examples/Jugl.js', 'examples/jquery.min.js', examples_dir)
|
||||
t.rm_rf('build/gh-pages/%(BRANCH)s/closure-library')
|
||||
t.makedirs('build/gh-pages/%(BRANCH)s/closure-library')
|
||||
with t.chdir('build/gh-pages/%(BRANCH)s/closure-library'):
|
||||
@@ -476,7 +489,7 @@ else:
|
||||
|
||||
@target('fixme', phony=True)
|
||||
def find_fixme(t):
|
||||
regex = re.compile(".(FIXME|TODO).")
|
||||
regex = re.compile('FIXME|TODO')
|
||||
matches = dict()
|
||||
totalcount = 0
|
||||
for filename in SRC:
|
||||
@@ -485,16 +498,16 @@ def find_fixme(t):
|
||||
if regex.search(line):
|
||||
if (filename not in matches):
|
||||
matches[filename] = list()
|
||||
matches[filename].append("#" + str(lineno + 1).ljust(10) + line.strip())
|
||||
matches[filename].append('#%-10d %s' % (lineno + 1, line.strip()))
|
||||
totalcount += 1
|
||||
f.close()
|
||||
|
||||
for filename in matches:
|
||||
print " ", filename, "has", len(matches[filename]), "matches:"
|
||||
print ' %s has %d matches:' % (filename, len(matches[filename]))
|
||||
for match in matches[filename]:
|
||||
print " ", match
|
||||
print ' %s' % (match,)
|
||||
print
|
||||
print "A total number of", totalcount, "TODO/FIXME was found"
|
||||
print 'A total of %d TODO/FIXME(s) were found' % (totalcount,)
|
||||
|
||||
|
||||
@target('reallyclean')
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
|
||||
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="stringLine truncated
|
||||
a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNoLine truncated
|
||||
.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[iLine truncated
|
||||
@@ -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>
|
||||
@@ -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
|
||||
})
|
||||
});
|
||||
@@ -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>
|
||||
@@ -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
|
||||
})
|
||||
});
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @fileoverview Externs for bootstrap.js
|
||||
*
|
||||
* @see http://twitter.github.com/bootstrap/javascript.html
|
||||
* @externs
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param {String|Object.<string,*>=} option
|
||||
* @return {!jQuery}
|
||||
*/
|
||||
jQuery.prototype.popover = function(option) {};
|
||||
|
||||
|
||||
/**
|
||||
* @param {String|Object.<string,*>=} option
|
||||
* @return {!jQuery}
|
||||
*/
|
||||
jQuery.prototype.tooltip = function(option) {};
|
||||
@@ -74,13 +74,18 @@
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.doubleClickZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.dragPan boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.keyboard boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.keyboardPanOffset number|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.mouseWheelZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.shiftDragZoom boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchPan boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchRotate boolean|undefined
|
||||
@exportObjectLiteralProperty ol.interaction.DefaultOptions.touchZoom boolean|undefined
|
||||
|
||||
@exportObjectLiteral ol.interaction.KeyboardPanOptions
|
||||
@exportObjectLiteralProperty ol.interaction.KeyboardPanOptions.pixelDelta number|undefined
|
||||
|
||||
@exportObjectLiteral ol.interaction.KeyboardZoomOptions
|
||||
@exportObjectLiteralProperty ol.interaction.KeyboardZoomOptions.delta number|undefined
|
||||
|
||||
@exportObjectLiteral ol.layer.LayerOptions
|
||||
@exportObjectLiteralProperty ol.layer.LayerOptions.brightness number|undefined
|
||||
@exportObjectLiteralProperty ol.layer.LayerOptions.contrast number|undefined
|
||||
@@ -136,6 +141,9 @@
|
||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.ProjectionLike
|
||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
|
||||
|
||||
@exportObjectLiteral ol.source.TileJSONOptions
|
||||
@exportObjectLiteralProperty ol.source.TileJSONOptions.uri string
|
||||
|
||||
@exportObjectLiteral ol.source.TiledWMSOptions
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.attributions Array.<ol.Attribution>|undefined
|
||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.params Object
|
||||
|
||||
+3
-4
@@ -2,7 +2,6 @@
|
||||
|
||||
goog.provide('ol.animation');
|
||||
|
||||
goog.require('goog.fx.easing');
|
||||
goog.require('ol.PreRenderFunction');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.easing');
|
||||
@@ -48,7 +47,7 @@ ol.animation.pan = function(options) {
|
||||
var sourceY = source.y;
|
||||
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
||||
var easing = goog.isDef(options.easing) ?
|
||||
options.easing : goog.fx.easing.inAndOut;
|
||||
options.easing : ol.easing.inAndOut;
|
||||
return function(map, frameState) {
|
||||
if (frameState.time < start) {
|
||||
frameState.animate = true;
|
||||
@@ -79,7 +78,7 @@ ol.animation.rotate = function(options) {
|
||||
var start = goog.isDef(options.start) ? options.start : goog.now();
|
||||
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
||||
var easing = goog.isDef(options.easing) ?
|
||||
options.easing : goog.fx.easing.inAndOut;
|
||||
options.easing : ol.easing.inAndOut;
|
||||
|
||||
return function(map, frameState) {
|
||||
if (frameState.time < start) {
|
||||
@@ -110,7 +109,7 @@ ol.animation.zoom = function(options) {
|
||||
var start = goog.isDef(options.start) ? options.start : goog.now();
|
||||
var duration = goog.isDef(options.duration) ? options.duration : 1000;
|
||||
var easing = goog.isDef(options.easing) ?
|
||||
options.easing : ol.easing.linear;
|
||||
options.easing : ol.easing.inAndOut;
|
||||
return function(map, frameState) {
|
||||
if (frameState.time < start) {
|
||||
frameState.animate = true;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@exportSymbol ol.easing
|
||||
@exportProperty ol.easing.bounce
|
||||
@exportProperty ol.easing.easeIn
|
||||
@exportProperty ol.easing.easeOut
|
||||
@exportProperty ol.easing.elastic
|
||||
@exportProperty ol.easing.inAndOut
|
||||
@exportProperty ol.easing.linear
|
||||
@exportProperty ol.easing.upAndDown
|
||||
@exportProperty ol.easing.elastic
|
||||
@exportProperty ol.easing.bounce
|
||||
+54
-31
@@ -1,36 +1,6 @@
|
||||
goog.provide('ol.easing');
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.linear = function(t) {
|
||||
return t;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.upAndDown = function(t) {
|
||||
if (t < 0.5) {
|
||||
return goog.fx.easing.inAndOut(2 * t);
|
||||
} else {
|
||||
return 1 - goog.fx.easing.inAndOut(2 * (t - 0.5));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* from https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.elastic = function(t) {
|
||||
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
|
||||
};
|
||||
goog.require('goog.fx.easing');
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,3 +28,56 @@ ol.easing.bounce = function(t) {
|
||||
}
|
||||
return l;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.easeIn = goog.fx.easing.easeIn;
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.easeOut = goog.fx.easing.easeOut;
|
||||
|
||||
|
||||
/**
|
||||
* from https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.elastic = function(t) {
|
||||
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.inAndOut = goog.fx.easing.inAndOut;
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.linear = function(t) {
|
||||
return t;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} t Input between 0 and 1.
|
||||
* @return {number} Output between 0 and 1.
|
||||
*/
|
||||
ol.easing.upAndDown = function(t) {
|
||||
if (t < 0.5) {
|
||||
return ol.easing.inAndOut(2 * t);
|
||||
} else {
|
||||
return 1 - ol.easing.inAndOut(2 * (t - 0.5));
|
||||
}
|
||||
};
|
||||
+87
-17
@@ -22,7 +22,9 @@ ol.GeolocationProperty = {
|
||||
HEADING: 'heading',
|
||||
POSITION: 'position',
|
||||
PROJECTION: 'projection',
|
||||
SPEED: 'speed'
|
||||
SPEED: 'speed',
|
||||
TRACKING: 'tracking',
|
||||
TRACKING_OPTIONS: 'trackingOptions'
|
||||
};
|
||||
|
||||
|
||||
@@ -30,9 +32,8 @@ ol.GeolocationProperty = {
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Object}
|
||||
* @param {GeolocationPositionOptions=} opt_positionOptions PositionOptions.
|
||||
*/
|
||||
ol.Geolocation = function(opt_positionOptions) {
|
||||
ol.Geolocation = function() {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
@@ -43,20 +44,20 @@ ol.Geolocation = function(opt_positionOptions) {
|
||||
*/
|
||||
this.position_ = null;
|
||||
|
||||
if (ol.Geolocation.SUPPORTED) {
|
||||
goog.events.listen(
|
||||
this, ol.Object.getChangedEventType(ol.GeolocationProperty.PROJECTION),
|
||||
this.handleProjectionChanged_, false, this);
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.watchId_;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.watchId_ = navigator.geolocation.watchPosition(
|
||||
goog.bind(this.positionChange_, this),
|
||||
goog.bind(this.positionError_, this),
|
||||
opt_positionOptions);
|
||||
}
|
||||
this.setTracking(false);
|
||||
|
||||
goog.events.listen(
|
||||
this, ol.Object.getChangedEventType(ol.GeolocationProperty.PROJECTION),
|
||||
this.handleProjectionChanged_, false, this);
|
||||
goog.events.listen(
|
||||
this, ol.Object.getChangedEventType(ol.GeolocationProperty.TRACKING),
|
||||
this.handleTrackingChanged_, false, this);
|
||||
};
|
||||
goog.inherits(ol.Geolocation, ol.Object);
|
||||
|
||||
@@ -65,7 +66,7 @@ goog.inherits(ol.Geolocation, ol.Object);
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.Geolocation.prototype.disposeInternal = function() {
|
||||
navigator.geolocation.clearWatch(this.watchId_);
|
||||
this.setTracking(false);
|
||||
goog.base(this, 'disposeInternal');
|
||||
};
|
||||
|
||||
@@ -88,6 +89,25 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ol.Geolocation.prototype.handleTrackingChanged_ = function() {
|
||||
if (ol.Geolocation.SUPPORTED) {
|
||||
var tracking = this.getTracking();
|
||||
if (tracking && !goog.isDef(this.watchId_)) {
|
||||
this.watchId_ = navigator.geolocation.watchPosition(
|
||||
goog.bind(this.positionChange_, this),
|
||||
goog.bind(this.positionError_, this),
|
||||
this.getTrackingOptions());
|
||||
} else if (!tracking && goog.isDef(this.watchId_)) {
|
||||
navigator.geolocation.clearWatch(this.watchId_);
|
||||
this.watchId_ = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {boolean} Is supported.
|
||||
@@ -220,6 +240,32 @@ goog.exportProperty(
|
||||
ol.Geolocation.prototype.getSpeed);
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean|undefined} tracking.
|
||||
*/
|
||||
ol.Geolocation.prototype.getTracking = function() {
|
||||
return /** @type {boolean} */ (
|
||||
this.get(ol.GeolocationProperty.TRACKING));
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Geolocation.prototype,
|
||||
'getTracking',
|
||||
ol.Geolocation.prototype.getTracking);
|
||||
|
||||
|
||||
/**
|
||||
* @return {GeolocationPositionOptions|undefined} tracking options.
|
||||
*/
|
||||
ol.Geolocation.prototype.getTrackingOptions = function() {
|
||||
return /** @type {GeolocationPositionOptions} */ (
|
||||
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Geolocation.prototype,
|
||||
'getTrackingOptions',
|
||||
ol.Geolocation.prototype.getTrackingOptions);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Projection} projection Projection.
|
||||
*/
|
||||
@@ -232,6 +278,30 @@ goog.exportProperty(
|
||||
ol.Geolocation.prototype.setProjection);
|
||||
|
||||
|
||||
/**
|
||||
* @param {boolean} tracking Enable or disable tracking.
|
||||
*/
|
||||
ol.Geolocation.prototype.setTracking = function(tracking) {
|
||||
this.set(ol.GeolocationProperty.TRACKING, tracking);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Geolocation.prototype,
|
||||
'setTracking',
|
||||
ol.Geolocation.prototype.setTracking);
|
||||
|
||||
|
||||
/**
|
||||
* @param {GeolocationPositionOptions} options Tracking options.
|
||||
*/
|
||||
ol.Geolocation.prototype.setTrackingOptions = function(options) {
|
||||
this.set(ol.GeolocationProperty.TRACKING_OPTIONS, options);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Geolocation.prototype,
|
||||
'setTrackingOptions',
|
||||
ol.Geolocation.prototype.setTrackingOptions);
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Array.<number>} input Input coordinate values.
|
||||
|
||||
+3
-2
@@ -13,12 +13,13 @@ goog.require('ol.TileState');
|
||||
* @constructor
|
||||
* @extends {ol.Tile}
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.TileState} state State.
|
||||
* @param {string} src Image source URI.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
*/
|
||||
ol.ImageTile = function(tileCoord, src, crossOrigin) {
|
||||
ol.ImageTile = function(tileCoord, state, src, crossOrigin) {
|
||||
|
||||
goog.base(this, tileCoord);
|
||||
goog.base(this, tileCoord, state);
|
||||
|
||||
/**
|
||||
* Image URI
|
||||
|
||||
@@ -72,10 +72,8 @@ ol.interaction.defaults = function(opt_options, opt_interactions) {
|
||||
|
||||
var keyboard = goog.isDef(options.keyboard) ?
|
||||
options.keyboard : true;
|
||||
var keyboardPanOffset = goog.isDef(options.keyboardPanOffset) ?
|
||||
options.keyboardPanOffset : 80;
|
||||
if (keyboard) {
|
||||
interactions.push(new ol.interaction.KeyboardPan(keyboardPanOffset));
|
||||
interactions.push(new ol.interaction.KeyboardPan());
|
||||
interactions.push(new ol.interaction.KeyboardZoom());
|
||||
}
|
||||
|
||||
|
||||
@@ -9,21 +9,29 @@ goog.require('ol.View2D');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Pan duration.
|
||||
*/
|
||||
ol.interaction.KEYBOARD_PAN_DURATION = 100;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Interaction}
|
||||
* @param {number} pixelDelta Pixel delta.
|
||||
* @param {ol.interaction.KeyboardPanOptions=} opt_options Options.
|
||||
*/
|
||||
ol.interaction.KeyboardPan = function(pixelDelta) {
|
||||
ol.interaction.KeyboardPan = function(opt_options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.pixelDelta_ = pixelDelta;
|
||||
this.delta_ = goog.isDef(options.delta) ? options.delta : 128;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
||||
@@ -47,22 +55,21 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(view instanceof ol.View2D);
|
||||
var resolution = view.getResolution();
|
||||
var delta;
|
||||
var mapUnitsDelta = resolution * this.pixelDelta_;
|
||||
var rotation = view.getRotation();
|
||||
var mapUnitsDelta = resolution * this.delta_;
|
||||
var deltaX = 0, deltaY = 0;
|
||||
if (keyCode == goog.events.KeyCodes.DOWN) {
|
||||
delta = new ol.Coordinate(0, -mapUnitsDelta);
|
||||
deltaY = -mapUnitsDelta;
|
||||
} else if (keyCode == goog.events.KeyCodes.LEFT) {
|
||||
delta = new ol.Coordinate(-mapUnitsDelta, 0);
|
||||
deltaX = -mapUnitsDelta;
|
||||
} else if (keyCode == goog.events.KeyCodes.RIGHT) {
|
||||
delta = new ol.Coordinate(mapUnitsDelta, 0);
|
||||
deltaX = mapUnitsDelta;
|
||||
} else {
|
||||
goog.asserts.assert(keyCode == goog.events.KeyCodes.UP);
|
||||
delta = new ol.Coordinate(0, mapUnitsDelta);
|
||||
deltaY = mapUnitsDelta;
|
||||
}
|
||||
var oldCenter = view.getCenter();
|
||||
var newCenter = new ol.Coordinate(
|
||||
oldCenter.x + delta.x, oldCenter.y + delta.y);
|
||||
view.setCenter(newCenter);
|
||||
var delta = new ol.Coordinate(deltaX, deltaY);
|
||||
delta.rotate(rotation);
|
||||
view.pan(map, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
||||
keyEvent.preventDefault();
|
||||
mapBrowserEvent.preventDefault();
|
||||
}
|
||||
|
||||
@@ -16,10 +16,21 @@ ol.interaction.KEYBOARD_ZOOM_DURATION = 100;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.interaction.KeyboardZoomOptions=} opt_options Options.
|
||||
* @extends {ol.interaction.Interaction}
|
||||
*/
|
||||
ol.interaction.KeyboardZoom = function() {
|
||||
ol.interaction.KeyboardZoom = function(opt_options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.delta_ = goog.isDef(options.delta) ? options.delta : 1;
|
||||
|
||||
};
|
||||
goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction);
|
||||
|
||||
@@ -35,7 +46,7 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
var charCode = keyEvent.charCode;
|
||||
if (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var delta = (charCode == '+'.charCodeAt(0)) ? 4 : -4;
|
||||
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
|
||||
map.requestRenderFrame();
|
||||
// FIXME works for View2D only
|
||||
var view = map.getView();
|
||||
|
||||
+15
-3
@@ -242,6 +242,12 @@ ol.Map = function(mapOptions) {
|
||||
goog.events.listen(this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
|
||||
this.handleBrowserWindowResize, false, this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Coordinate}
|
||||
*/
|
||||
this.focus_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<ol.PreRenderFunction>}
|
||||
@@ -487,9 +493,10 @@ ol.Map.prototype.getTilePriority = function(tile, tileSourceKey, tileCenter) {
|
||||
if (!frameState.wantedTiles[tileSourceKey][coordKey]) {
|
||||
return ol.TileQueue.DROP;
|
||||
}
|
||||
var center = frameState.view2DState.center;
|
||||
var deltaX = tileCenter.x - center.x;
|
||||
var deltaY = tileCenter.y - center.y;
|
||||
var focus = goog.isNull(this.focus_) ?
|
||||
frameState.view2DState.center : this.focus_;
|
||||
var deltaX = tileCenter.x - focus.x;
|
||||
var deltaY = tileCenter.y - focus.y;
|
||||
return deltaX * deltaX + deltaY * deltaY;
|
||||
};
|
||||
|
||||
@@ -502,6 +509,11 @@ ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
||||
var type = opt_type || browserEvent.type;
|
||||
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
|
||||
this.handleMapBrowserEvent(mapBrowserEvent);
|
||||
if (type == goog.events.EventType.MOUSEOUT) {
|
||||
this.focus_ = null;
|
||||
} else {
|
||||
this.focus_ = mapBrowserEvent.getCoordinate();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -152,10 +152,6 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
|
||||
|
||||
tileCoord = new ol.TileCoord(z, x, y);
|
||||
tile = tileSource.getTile(tileCoord, tileGrid, projection);
|
||||
if (goog.isNull(tile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.IDLE) {
|
||||
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
|
||||
@@ -163,7 +159,8 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
|
||||
frameState.tileQueue.enqueue(tile, tileSourceKey, tileCenter);
|
||||
} else if (tileState == ol.TileState.LOADING) {
|
||||
this.listenToTileChange(tile);
|
||||
} else if (tileState == ol.TileState.LOADED) {
|
||||
} else if (tileState == ol.TileState.LOADED ||
|
||||
tileState == ol.TileState.EMPTY) {
|
||||
tilesToDrawByZ[z][tileCoord.toString()] = tile;
|
||||
continue;
|
||||
} else if (tileState == ol.TileState.ERROR) {
|
||||
@@ -198,10 +195,13 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
|
||||
if (this.renderedTiles_[index] != tile) {
|
||||
x = tileSize.width * (tile.tileCoord.x - tileRange.minX);
|
||||
y = tileSize.height * (tileRange.maxY - tile.tileCoord.y);
|
||||
if (!opaque) {
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.EMPTY || !opaque) {
|
||||
context.clearRect(x, y, tileSize.width, tileSize.height);
|
||||
}
|
||||
context.drawImage(tile.getImage(), x, y);
|
||||
if (tileState == ol.TileState.LOADED) {
|
||||
context.drawImage(tile.getImage(), x, y);
|
||||
}
|
||||
this.renderedTiles_[index] = tile;
|
||||
}
|
||||
}
|
||||
@@ -214,10 +214,13 @@ ol.renderer.canvas.TileLayer.prototype.renderFrame =
|
||||
y = (origin.y - tileExtent.maxY) / tileResolution;
|
||||
width = scale * tileSize.width;
|
||||
height = scale * tileSize.height;
|
||||
if (!opaque) {
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.EMPTY || !opaque) {
|
||||
context.clearRect(x, y, width, height);
|
||||
}
|
||||
context.drawImage(tile.getImage(), x, y, width, height);
|
||||
if (tileState == ol.TileState.LOADED) {
|
||||
context.drawImage(tile.getImage(), x, y, width, height);
|
||||
}
|
||||
interimTileRange =
|
||||
tileGrid.getTileRangeForExtentAndZ(tileExtent, z);
|
||||
minX = Math.max(interimTileRange.minX, tileRange.minX);
|
||||
|
||||
@@ -110,10 +110,6 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
|
||||
|
||||
tileCoord = new ol.TileCoord(z, x, y);
|
||||
tile = tileSource.getTile(tileCoord, tileGrid, projection);
|
||||
if (goog.isNull(tile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.IDLE) {
|
||||
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
|
||||
@@ -124,7 +120,8 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
|
||||
} else if (tileState == ol.TileState.LOADED) {
|
||||
tilesToDrawByZ[z][tileCoord.toString()] = tile;
|
||||
continue;
|
||||
} else if (tileState == ol.TileState.ERROR) {
|
||||
} else if (tileState == ol.TileState.ERROR ||
|
||||
tileState == ol.TileState.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ ol.renderer.webgl.Map = function(container, map) {
|
||||
goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.LOST,
|
||||
this.handleWebGLContextLost, false, this);
|
||||
goog.events.listen(this.canvas_, ol.webgl.WebGLContextEventType.RESTORED,
|
||||
this.handleWebGLContextResourced, false, this);
|
||||
this.handleWebGLContextRestored, false, this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -433,9 +433,9 @@ ol.renderer.webgl.Map.prototype.handleWebGLContextLost = function(event) {
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
ol.renderer.webgl.Map.prototype.handleWebGLContextResourced = function() {
|
||||
ol.renderer.webgl.Map.prototype.handleWebGLContextRestored = function() {
|
||||
if (goog.DEBUG) {
|
||||
this.logger.info('WebGLContextResourced');
|
||||
this.logger.info('WebGLContextRestored');
|
||||
}
|
||||
this.initializeGL_();
|
||||
this.getMap().render();
|
||||
|
||||
@@ -385,10 +385,6 @@ ol.renderer.webgl.TileLayer.prototype.renderFrame =
|
||||
|
||||
tileCoord = new ol.TileCoord(z, x, y);
|
||||
tile = tileSource.getTile(tileCoord, tileGrid, projection);
|
||||
if (goog.isNull(tile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.IDLE) {
|
||||
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
|
||||
@@ -407,7 +403,8 @@ ol.renderer.webgl.TileLayer.prototype.renderFrame =
|
||||
priority = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
tilesToLoad.enqueue(priority, tile);
|
||||
}
|
||||
} else if (tileState == ol.TileState.ERROR) {
|
||||
} else if (tileState == ol.TileState.ERROR ||
|
||||
tileState == ol.TileState.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
@exportSymbol ol.source.BingMaps
|
||||
@exportClass ol.source.BingMaps ol.source.BingMapsOptions
|
||||
@@ -19,9 +19,7 @@ goog.require('ol.tilegrid.TileGrid');
|
||||
*/
|
||||
ol.DebugTile_ = function(tileCoord, tileGrid) {
|
||||
|
||||
goog.base(this, tileCoord);
|
||||
|
||||
this.state = ol.TileState.LOADED;
|
||||
goog.base(this, tileCoord, ol.TileState.LOADED);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -127,7 +125,7 @@ ol.source.DebugTileSource.prototype.expireCache = function(usedTiles) {
|
||||
ol.source.DebugTileSource.prototype.getTile = function(tileCoord) {
|
||||
var key = tileCoord.toString();
|
||||
if (this.tileCache_.containsKey(key)) {
|
||||
return /** @type {ol.DebugTile_} */ (this.tileCache_.get(key));
|
||||
return /** @type {!ol.DebugTile_} */ (this.tileCache_.get(key));
|
||||
} else {
|
||||
var tile = new ol.DebugTile_(tileCoord, this.tileGrid);
|
||||
this.tileCache_.set(key, tile);
|
||||
|
||||
@@ -7,6 +7,7 @@ goog.require('ol.ImageTile');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCache');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.TileUrlFunctionType');
|
||||
goog.require('ol.source.TileSource');
|
||||
@@ -89,18 +90,17 @@ ol.source.ImageTileSource.prototype.getTile =
|
||||
function(tileCoord, tileGrid, projection) {
|
||||
var key = tileCoord.toString();
|
||||
if (this.tileCache_.containsKey(key)) {
|
||||
return /** @type {ol.Tile} */ (this.tileCache_.get(key));
|
||||
return /** @type {!ol.Tile} */ (this.tileCache_.get(key));
|
||||
} else {
|
||||
goog.asserts.assert(tileGrid);
|
||||
goog.asserts.assert(projection);
|
||||
var tileUrl = this.tileUrlFunction(tileCoord, tileGrid, projection);
|
||||
var tile;
|
||||
if (goog.isDef(tileUrl)) {
|
||||
tile = new ol.ImageTile(tileCoord, tileUrl, this.crossOrigin_);
|
||||
this.tileCache_.set(key, tile);
|
||||
} else {
|
||||
tile = null;
|
||||
}
|
||||
var tile = new ol.ImageTile(
|
||||
tileCoord,
|
||||
goog.isDef(tileUrl) ? ol.TileState.IDLE : ol.TileState.EMPTY,
|
||||
goog.isDef(tileUrl) ? tileUrl : '',
|
||||
this.crossOrigin_);
|
||||
this.tileCache_.set(key, tile);
|
||||
return tile;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
@exportSymbol ol.source.SingleImageWMS
|
||||
@exportClass ol.source.SingleImageWMS ol.source.SingleImageWMSOptions
|
||||
@@ -1 +1 @@
|
||||
@exportSymbol ol.source.Stamen
|
||||
@exportClass ol.source.Stamen ol.source.StamenOptions
|
||||
@@ -1 +1 @@
|
||||
@exportSymbol ol.source.StaticImage
|
||||
@exportClass ol.source.StaticImage ol.source.StaticImageOptions
|
||||
@@ -1 +1 @@
|
||||
@exportSymbol ol.source.TiledWMS
|
||||
@exportClass ol.source.TiledWMS ol.source.TiledWMSOptions
|
||||
@@ -1 +1 @@
|
||||
@exportSymbol ol.source.TileJSON
|
||||
@exportClass ol.source.TileJSON ol.source.TileJSONOptions
|
||||
@@ -21,12 +21,6 @@ goog.require('ol.source.ImageTileSource');
|
||||
goog.require('ol.tilegrid.XYZ');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{uri: string}}
|
||||
*/
|
||||
ol.source.TileJSONOptions;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<TileJSON>}
|
||||
|
||||
@@ -125,7 +125,7 @@ ol.source.TileSource.prototype.getResolutions = function() {
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.tilegrid.TileGrid=} opt_tileGrid Tile grid.
|
||||
* @param {ol.Projection=} opt_projection Projection.
|
||||
* @return {ol.Tile} Tile.
|
||||
* @return {!ol.Tile} Tile.
|
||||
*/
|
||||
ol.source.TileSource.prototype.getTile = goog.abstractMethod;
|
||||
|
||||
|
||||
+5
-3
@@ -16,7 +16,8 @@ ol.TileState = {
|
||||
IDLE: 0,
|
||||
LOADING: 1,
|
||||
LOADED: 2,
|
||||
ERROR: 3
|
||||
ERROR: 3,
|
||||
EMPTY: 4
|
||||
};
|
||||
|
||||
|
||||
@@ -25,8 +26,9 @@ ol.TileState = {
|
||||
* @constructor
|
||||
* @extends {goog.events.EventTarget}
|
||||
* @param {ol.TileCoord} tileCoord Tile coordinate.
|
||||
* @param {ol.TileState} state State.
|
||||
*/
|
||||
ol.Tile = function(tileCoord) {
|
||||
ol.Tile = function(tileCoord, state) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
@@ -39,7 +41,7 @@ ol.Tile = function(tileCoord) {
|
||||
* @protected
|
||||
* @type {ol.TileState}
|
||||
*/
|
||||
this.state = ol.TileState.IDLE;
|
||||
this.state = state;
|
||||
|
||||
};
|
||||
goog.inherits(ol.Tile, goog.events.EventTarget);
|
||||
|
||||
+27
-5
@@ -4,7 +4,6 @@
|
||||
goog.provide('ol.View2D');
|
||||
goog.provide('ol.View2DProperty');
|
||||
|
||||
goog.require('goog.fx.easing');
|
||||
goog.require('ol.Constraints');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
@@ -16,6 +15,7 @@ goog.require('ol.RotationConstraint');
|
||||
goog.require('ol.Size');
|
||||
goog.require('ol.View');
|
||||
goog.require('ol.animation');
|
||||
goog.require('ol.easing');
|
||||
goog.require('ol.projection');
|
||||
|
||||
|
||||
@@ -255,6 +255,28 @@ goog.exportProperty(
|
||||
ol.View2D.prototype.setRotation);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.Coordinate} delta Delta.
|
||||
* @param {number=} opt_duration Duration.
|
||||
*/
|
||||
ol.View2D.prototype.pan = function(map, delta, opt_duration) {
|
||||
var currentCenter = this.getCenter();
|
||||
if (goog.isDef(currentCenter)) {
|
||||
if (goog.isDef(opt_duration)) {
|
||||
map.requestRenderFrame();
|
||||
map.addPreRenderFunction(ol.animation.pan({
|
||||
source: currentCenter,
|
||||
duration: opt_duration,
|
||||
easing: ol.easing.linear
|
||||
}));
|
||||
}
|
||||
this.setCenter(new ol.Coordinate(
|
||||
currentCenter.x + delta.x, currentCenter.y + delta.y));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {number|undefined} rotation Rotation.
|
||||
@@ -285,13 +307,13 @@ ol.View2D.prototype.rotateWithoutConstraints =
|
||||
map.addPreRenderFunction(ol.animation.rotate({
|
||||
rotation: currentRotation,
|
||||
duration: opt_duration,
|
||||
easing: goog.fx.easing.easeOut
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
if (goog.isDef(opt_anchor)) {
|
||||
map.addPreRenderFunction(ol.animation.pan({
|
||||
source: currentCenter,
|
||||
duration: opt_duration,
|
||||
easing: goog.fx.easing.easeOut
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -359,13 +381,13 @@ ol.View2D.prototype.zoomWithoutConstraints =
|
||||
map.addPreRenderFunction(ol.animation.zoom({
|
||||
resolution: currentResolution,
|
||||
duration: opt_duration,
|
||||
easing: goog.fx.easing.easeOut
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
if (goog.isDef(opt_anchor)) {
|
||||
map.addPreRenderFunction(ol.animation.pan({
|
||||
source: currentCenter,
|
||||
duration: opt_duration,
|
||||
easing: goog.fx.easing.easeOut
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,11 @@ With PhantomJS installed, and assuming phantomjs is in the PATH:
|
||||
|
||||
(Works with PhantomJS 1.6.1, untested with other versions.)
|
||||
|
||||
This command can also be run by doing `make test` at the root of ol3.
|
||||
This command can also be run by doing `./build.py test` at the root of ol3.
|
||||
|
||||
Make sure that the polvr web server is running (`./build.py serve`), otherwise
|
||||
you will most likely see something like `0 specs, 0 failures in 0.001s.`.
|
||||
|
||||
Tip for TDD'ers: to make PhantomJS run the test suite continuously each time
|
||||
a spec file is changed you can use nosier (http://pypi.python.org/pypi/nosier)
|
||||
and do `nosier -p test -p src "make test"`.
|
||||
and do `nosier -p test -p src "./build.py test"`.
|
||||
@@ -220,12 +220,9 @@ goog.inherits(ol.test.source.MockTileSource, ol.source.TileSource);
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.test.source.MockTileSource.prototype.getTile = function(tileCoord) {
|
||||
var tile = new ol.Tile(tileCoord);
|
||||
var key = tileCoord.toString();
|
||||
if (this.loaded_[key]) {
|
||||
tile.state = ol.TileState.LOADED;
|
||||
}
|
||||
return tile;
|
||||
var tileState = this.loaded_[key] ? ol.TileState.LOADED : ol.TileState.IDLE;
|
||||
return new ol.Tile(tileCoord, tileState);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user