Compare commits
36 Commits
r3.0.0-alp
...
r3.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
757ccf148b | ||
|
|
3e4d39b228 | ||
|
|
d7e838274e | ||
|
|
2cc5c7a776 | ||
|
|
daa03b5ef7 | ||
|
|
42abdb308a | ||
|
|
17f0d01e9f | ||
|
|
f72784dc38 | ||
|
|
44a9c181aa | ||
|
|
ccf6aa10ac | ||
|
|
a10d142752 | ||
|
|
461d85dfc3 | ||
|
|
087b4d04a6 | ||
|
|
3af5e530ca | ||
|
|
d9f554e10d | ||
|
|
d482b66af3 | ||
|
|
7efff5c3cf | ||
|
|
d0e198df93 | ||
|
|
e6efa741d2 | ||
|
|
552853a3b8 | ||
|
|
0cf4024194 | ||
|
|
a071c3521c | ||
|
|
6ae4b28db8 | ||
|
|
e1f8863bd2 | ||
|
|
1c3369a3f6 | ||
|
|
f2ce4db85a | ||
|
|
949edb694e | ||
|
|
7ebacba720 | ||
|
|
12338783cc | ||
|
|
82c791f9f5 | ||
|
|
e1a2c72587 | ||
|
|
dc246cd45b | ||
|
|
04bab7e436 | ||
|
|
6fc4aa68b6 | ||
|
|
99ba5a0da8 | ||
|
|
e292d8fa12 |
@@ -2,8 +2,8 @@
|
||||
|
||||
[](http://travis-ci.org/#!/openlayers/ol3)
|
||||
|
||||
Welcome to OpenLayers 3!
|
||||
Welcome to [OpenLayers 3](http://ol3js.org/)!
|
||||
|
||||
To see OpenLayers 3 in action you can look at the live examples on
|
||||
http://openlayers.github.io/ol3/master/examples/. If you want to contribute
|
||||
to OpenLayers 3 please read the [CONTRIBUTING](CONTRIBUTING.md) page.
|
||||
Check out the [hosted examples](http://ol3js.org/en/master/examples/) or poke around the evolving [API docs](http://ol3js.org/en/master/apidoc/).
|
||||
|
||||
Please see our guide on [contributing](CONTRIBUTING.md) if you're interested in getting involved.
|
||||
|
||||
42
build.py
42
build.py
@@ -574,20 +574,6 @@ def plovr_jar(t):
|
||||
t.info('downloaded %r', t.name)
|
||||
|
||||
|
||||
@target('gh-pages', 'host-examples', 'doc', phony=True)
|
||||
def gh_pages(t):
|
||||
with t.tempdir() as tempdir:
|
||||
t.run('%(GIT)s', 'clone', '--branch', 'gh-pages',
|
||||
'git@github.com:openlayers/ol3.git', tempdir)
|
||||
with t.chdir(tempdir):
|
||||
t.rm_rf('%(BRANCH)s')
|
||||
t.cp_r('build/gh-pages/%(BRANCH)s', tempdir + '/%(BRANCH)s')
|
||||
with t.chdir(tempdir):
|
||||
t.run('%(GIT)s', 'add', '--all', '%(BRANCH)s')
|
||||
t.run('%(GIT)s', 'commit', '--message', 'Updated')
|
||||
t.run('%(GIT)s', 'push', 'origin', 'gh-pages')
|
||||
|
||||
|
||||
virtual('doc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
|
||||
|
||||
|
||||
@@ -596,7 +582,7 @@ virtual('doc', 'build/jsdoc-%(BRANCH)s-timestamp' % vars(variables))
|
||||
SRC, SHADER_SRC, ifind('doc/template'))
|
||||
def jsdoc_BRANCH_timestamp(t):
|
||||
t.run('%(JSDOC)s', '-c', 'doc/conf.json', 'src', 'doc/index.md',
|
||||
'-d', 'build/gh-pages/%(BRANCH)s/apidoc')
|
||||
'-d', 'build/hosted/%(BRANCH)s/apidoc')
|
||||
t.touch()
|
||||
|
||||
|
||||
@@ -634,15 +620,15 @@ def split_example_file(example, dst_dir):
|
||||
|
||||
@target('host-resources', phony=True)
|
||||
def host_resources(t):
|
||||
resources_dir = 'build/gh-pages/%(BRANCH)s/resources'
|
||||
resources_dir = 'build/hosted/%(BRANCH)s/resources'
|
||||
t.rm_rf(resources_dir)
|
||||
t.cp_r('resources', resources_dir)
|
||||
|
||||
|
||||
@target('host-examples', 'build', 'host-resources', 'examples', phony=True)
|
||||
def host_examples(t):
|
||||
examples_dir = 'build/gh-pages/%(BRANCH)s/examples'
|
||||
build_dir = 'build/gh-pages/%(BRANCH)s/build'
|
||||
examples_dir = 'build/hosted/%(BRANCH)s/examples'
|
||||
build_dir = 'build/hosted/%(BRANCH)s/build'
|
||||
t.rm_rf(examples_dir)
|
||||
t.makedirs(examples_dir)
|
||||
t.rm_rf(build_dir)
|
||||
@@ -657,25 +643,25 @@ def host_examples(t):
|
||||
t.cp('examples/index.html', 'examples/example-list.js',
|
||||
'examples/example-list.xml', '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'):
|
||||
t.rm_rf('build/hosted/%(BRANCH)s/closure-library')
|
||||
t.makedirs('build/hosted/%(BRANCH)s/closure-library')
|
||||
with t.chdir('build/hosted/%(BRANCH)s/closure-library'):
|
||||
t.run('%(JAR)s', 'xf', '../../../../' + PLOVR_JAR, 'closure')
|
||||
t.run('%(JAR)s', 'xf', '../../../../' + PLOVR_JAR, 'third_party')
|
||||
t.rm_rf('build/gh-pages/%(BRANCH)s/ol')
|
||||
t.makedirs('build/gh-pages/%(BRANCH)s/ol')
|
||||
t.cp_r('src/ol', 'build/gh-pages/%(BRANCH)s/ol/ol')
|
||||
t.rm_rf('build/hosted/%(BRANCH)s/ol')
|
||||
t.makedirs('build/hosted/%(BRANCH)s/ol')
|
||||
t.cp_r('src/ol', 'build/hosted/%(BRANCH)s/ol/ol')
|
||||
t.run('%(PYTHON)s', 'bin/closure/depswriter.py',
|
||||
'--root_with_prefix', 'src ../../../ol',
|
||||
'--root', 'build/gh-pages/%(BRANCH)s/closure-library/closure/goog',
|
||||
'--root_with_prefix', 'build/gh-pages/%(BRANCH)s/closure-library/'
|
||||
'--root', 'build/hosted/%(BRANCH)s/closure-library/closure/goog',
|
||||
'--root_with_prefix', 'build/hosted/%(BRANCH)s/closure-library/'
|
||||
'third_party ../../third_party',
|
||||
'--output_file', 'build/gh-pages/%(BRANCH)s/build/ol-deps.js')
|
||||
'--output_file', 'build/hosted/%(BRANCH)s/build/ol-deps.js')
|
||||
|
||||
|
||||
@target('check-examples', 'host-examples', phony=True)
|
||||
def check_examples(t):
|
||||
examples = ['build/gh-pages/%(BRANCH)s/' + e for e in EXAMPLES]
|
||||
examples = ['build/hosted/%(BRANCH)s/' + e for e in EXAMPLES]
|
||||
all_examples = \
|
||||
[e + '?mode=raw' for e in examples] + \
|
||||
[e + '?mode=whitespace' for e in examples] + \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Finding your way round
|
||||
----------------------
|
||||
Finding your way around
|
||||
-----------------------
|
||||
See the class list to the right and especially take a look at {@link ol.Map} and {@link ol.layer.Layer} because those are the central objects.
|
||||
|
||||
In general every use of OpenLayers starts by initializing a map, then adding the required layers. Controls and interactions can be added to change the behavior of the map.
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Animation example</h4>
|
||||
<p id="shortdesc">Demonstrates animated pan, zoom, and rotation.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Bing Maps example</h4>
|
||||
<p id="shortdesc">Example of a Bing Maps layer.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Brightness/contrast example</h4>
|
||||
<p id="shortdesc">Example of brightness/contrast control on the client (WebGL only).</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Canvas tiles example</h4>
|
||||
<p id="shortdesc">Renders tiles with coordinates for debugging.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Custom controls</h4>
|
||||
<p id="shortdesc">This example shows how to create custom controls.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Device orientation example</h4>
|
||||
<label class="checkbox" for="track">
|
||||
<input id="track" type="checkbox"/>track changes
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Drag rotate and zoom example</h4>
|
||||
<p id="shortdesc">A single interaction to drag, rotate, and zoom.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">EPSG:4326 example</h4>
|
||||
<p id="shortdesc">Example of a map in EPSG:4326.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Export map example</h4>
|
||||
<p id="shortdesc">Example of exporting a map as a JPEG or PNG image.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Full screen drag rotate and zoom example</h4>
|
||||
<p id="shortdesc">Example of drag rotate and zoom control with full screen effect.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Full screen control example</h4>
|
||||
<p id="shortdesc">Example of a full screen control.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -44,13 +44,21 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Geolocation example</h4>
|
||||
<label class="checkbox" for="track">
|
||||
<input id="track" type="checkbox"/>track position
|
||||
</label>
|
||||
<p>position accuracy : <code id="accuracy"></code></p>
|
||||
<p>altitude : <code id="altitude"></code></p>
|
||||
<p>altitude accuracy : <code id="altitudeAccuracy"></code></p>
|
||||
<p>heading : <code id="heading"></code></p>
|
||||
<p>speed : <code id="speed"></code></p>
|
||||
|
||||
<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 class="span4 pull-right">
|
||||
|
||||
@@ -3,6 +3,7 @@ goog.require('ol.Map');
|
||||
goog.require('ol.Overlay');
|
||||
goog.require('ol.RendererHints');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.dom.Input');
|
||||
goog.require('ol.layer.TileLayer');
|
||||
goog.require('ol.source.OSM');
|
||||
|
||||
@@ -24,6 +25,17 @@ var map = new ol.Map({
|
||||
var geolocation = new ol.Geolocation();
|
||||
geolocation.bindTo('projection', map.getView());
|
||||
|
||||
var track = new ol.dom.Input(document.getElementById('track'));
|
||||
track.bindTo('checked', geolocation, 'tracking');
|
||||
|
||||
geolocation.on('change', function() {
|
||||
$('#accuracy').text(geolocation.getAccuracy() + ' [m]');
|
||||
$('#altitude').text(geolocation.getAltitude() + ' [m]');
|
||||
$('#altitudeAccuracy').text(geolocation.getAltitudeAccuracy() + ' [m]');
|
||||
$('#heading').text(geolocation.getHeading() + ' [rad]');
|
||||
$('#speed').text(geolocation.getSpeed() + ' [m/s]');
|
||||
});
|
||||
|
||||
var marker = new ol.Overlay({
|
||||
map: map,
|
||||
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0))
|
||||
@@ -41,8 +53,3 @@ geolocation.on('error', function(error) {
|
||||
info.innerHTML = error.message;
|
||||
info.style.display = '';
|
||||
});
|
||||
|
||||
|
||||
$('#locate').click(function() {
|
||||
geolocation.setTracking(true);
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">GML example</h4>
|
||||
<p id="shortdesc">Example of using the GML parser.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</div>
|
||||
<div id="tags">GPX</div>
|
||||
</div>
|
||||
<div class="span4 pull-right">
|
||||
<div class="span4 offset4">
|
||||
<div id="info" class="alert alert-success">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Hue/saturation example</h4>
|
||||
<p id="shortdesc">Example of hue/saturation control on the client (WebGL only).</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Timezones in KML</h4>
|
||||
<p id="shortdesc">Demonstrates rendering timezones from KML.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</div>
|
||||
<div id="tags">KML</div>
|
||||
</div>
|
||||
<div class="span4 pull-right">
|
||||
<div class="span4 offset4">
|
||||
<div id="info" class="alert alert-success">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* * hostname - the current hostname (window.location.hostname)
|
||||
* * port - 9810
|
||||
* * mode - ADVANCED
|
||||
* * mode - RAW
|
||||
* * id - id param in loader.js query string; defaults to 'ol' if not set
|
||||
*
|
||||
* Usage:
|
||||
@@ -20,7 +20,7 @@
|
||||
var params = {
|
||||
hostname: window.location.hostname,
|
||||
port: '9810',
|
||||
mode: 'ADVANCED',
|
||||
mode: 'RAW',
|
||||
id: 'ol'
|
||||
};
|
||||
if (window.location.protocol === 'file:' && !params.hostname) {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Localized OpenStreetMap example</h4>
|
||||
<p id="shortdesc">Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">MapQuest example</h4>
|
||||
<p id="shortdesc">Example of a MapQuest map.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -34,22 +34,13 @@
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span6">
|
||||
<h4 id="title">Mouse position example</h4>
|
||||
<p id="shortdesc">Example of a mouse position control, outside the map.</p>
|
||||
<div id="docs">
|
||||
<p>See the <a href="mouse-position.js" target="_blank">mouse-position.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">mouse-position, openstreetmap</div>
|
||||
</div>
|
||||
<div class="span8 pull-right">
|
||||
<div id="mouse-position"> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<form>
|
||||
<label>Projection </label>
|
||||
<select id="projection">
|
||||
@@ -60,6 +51,7 @@
|
||||
<input id="precision" type="number" min="0" max="12" value="4"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="span6" id="mouse-position"> </div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Overlay example</h4>
|
||||
<p id="shortdesc">Demonstrates overlays.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Preload example</h4>
|
||||
<p id="shortdesc">Example of tile preloading.</p>
|
||||
<div id="docs">
|
||||
<p>Low resolution tiles for the map are preloaded, the map on the right does not use any preloading. Try zooming out and panning to see the difference.</p>
|
||||
<p>The map on the left preloads low resolution tiles. The map on the right does not use any preloading. Try zooming out and panning to see the difference.</p>
|
||||
<p>See the <a href="preload.js" target="_blank">preload.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">preload, bing</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Rotation example</h4>
|
||||
<p id="shortdesc">Example of a rotated map.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Scale line example</h4>
|
||||
<p id="shortdesc">Example of a scale line.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Semi-transparent layer example</h4>
|
||||
<p id="shortdesc">Example of a map with a semi-transparent layer.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Side-by-side example</h4>
|
||||
<p id="shortdesc">The three maps, one WebGL, one Canvas, one DOM, share the same center, resolution, rotation and layers.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Simple example</h4>
|
||||
<p id="shortdesc">Example of a simple map.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Stamen example</h4>
|
||||
<p id="shortdesc">Example of a Stamen tile source. Two layers are composed: the watercolor base layer with the terrain labels.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Style with rules example</h4>
|
||||
<p id="shortdesc">Draws features with rule based styles.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span6">
|
||||
<div class="span12">
|
||||
<h4 id="title">Teleport example</h4>
|
||||
<p id="shortdesc">Example of moving a map from one target to another.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Ten thousand points example</h4>
|
||||
<p id="shortdesc">Example of a map with ten thousand points.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">TileJSON example</h4>
|
||||
<p id="shortdesc">Example of a TileJSON layer.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</div>
|
||||
<div id="tags">vector, geojson, style</div>
|
||||
</div>
|
||||
<div class="span4 pull-right">
|
||||
<div class="span4 offset4">
|
||||
<div id="info" class="alert alert-success">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Tiled WMS with Proj4js projection example</h4>
|
||||
<p id="shortdesc">Example of two tiled WMS layers (Pixelmap 1:1'000'000 and national parks) using the projection EPSG:21781.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">WMS without client projection example</h4>
|
||||
<p id="shortdesc">Example of two WMS layers using the projection EPSG:21781, which is unknown to the client.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Single image WMS with custom projection example</h4>
|
||||
<p id="shortdesc">Example of two single image WMS layers.</p>
|
||||
<div id="docs">
|
||||
<p id="shortdesc">Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
|
||||
<p>Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
|
||||
<p>See the <a href="wms-single-image-custom-proj.js" target="_blank">wms-single-image-custom-proj.js source</a> to see how this is done.</p>
|
||||
</div>
|
||||
<div id="tags">wms, single image, projection</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Single image WMS example</h4>
|
||||
<p id="shortdesc">Example of a single image WMS layer.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">Tiled WMS example</h4>
|
||||
<p id="shortdesc">Example of a tiled WMS layer.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">WMTS from capabilities example</h4>
|
||||
<p id="shortdesc">Example of a WMTS source built from a WMTS getCapabilities response.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">WMTS example</h4>
|
||||
<p id="shortdesc">Example of a WMTS source.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span4">
|
||||
<div class="span12">
|
||||
<h4 id="title">ZoomSlider control</h4>
|
||||
<p id="shortdesc">Example of various ZoomSlider controls.</p>
|
||||
<div id="docs">
|
||||
|
||||
@@ -88,21 +88,33 @@
|
||||
/**
|
||||
* Object literal with config options for the view.
|
||||
* @typedef {Object} ol.View2DOptions
|
||||
* @property {ol.Coordinate|undefined} center The view center in map projection.
|
||||
* @property {number|undefined} maxResolution The maximum resolution in map
|
||||
* units per pixel.
|
||||
* @property {number|undefined} maxZoom The maximum zoom level for this view.
|
||||
* Zoom level 0 uses the `maxResolution`; subsequent zoom levels are
|
||||
* calculated by dividing the previous resolution by `zoomFactor`.
|
||||
* @property {ol.ProjectionLike} projection The map projection.
|
||||
* @property {ol.Coordinate|undefined} center The initial center for the view.
|
||||
* The coordinate system for the center is specified with the `projection`
|
||||
* option.
|
||||
* @property {number|undefined} maxResolution The maximum resolution used to
|
||||
* determine the resolution constraint. It is used together with `maxZoom`
|
||||
* and `zoomFactor`. If unspecified it is calculated in such a way that the
|
||||
* projection's validity extent fits in a 256x256 px tile. If the projection
|
||||
* is Spherical Mercator (the default) then `maxResolution` defaults to
|
||||
* 40075016.68557849 / 256 = 156543.03392804097.
|
||||
* @property {number|undefined} maxZoom The maximum zoom level used to determine
|
||||
* the resolution constraint. It is used together with `maxResolution` and
|
||||
* `zoomFactor`. Default is 28.
|
||||
* @property {ol.ProjectionLike} projection The projection. Default is
|
||||
* `EPSG:3857` (Spherical Mercator).
|
||||
* @property {number|undefined} resolution The initial resolution for the view.
|
||||
* @property {Array.<number>|undefined} resolutions The resolutions for this
|
||||
* view. If configured, this is equivalent to specifying `maxResolution` and
|
||||
* `maxZoom`.
|
||||
* @property {number|undefined} rotation Initial rotation of the view.
|
||||
* @property {number|undefined} zoom Initial zoom level of the view.
|
||||
* @property {number|undefined} zoomFactor Factor to calculate resolutions for
|
||||
* zoom levels. Default is 2.
|
||||
* The units are `projection` units per pixel (e.g. meters per pixel).
|
||||
* @property {Array.<number>|undefined} resolutions Resolutions to determine the
|
||||
* resolution constraint. If set the `maxResolution`, `maxZoom` and
|
||||
* `zoomFactor` options are ignored.
|
||||
* @property {number|undefined} rotation The initial rotation for the view
|
||||
* in radians (positive rotation clockwise).
|
||||
* @property {number|undefined} zoom Zoom level used to calculate the initial
|
||||
* resolution for the view. The initial resolution is determined using the
|
||||
* `ol.View2D#constrainResolution` method.
|
||||
* @property {number|undefined} zoomFactor The zoom factor used to determine the
|
||||
* resolution constraint. It is together with `maxResolution` and `maxZoom`.
|
||||
* Default is 2.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -139,7 +151,7 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.AttributionOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {string|undefined} className CSS class name. Default is 'ol-attribution'.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {Element|undefined} target Target.
|
||||
*/
|
||||
@@ -164,7 +176,7 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.FullScreenOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {string|undefined} className CSS class name. Default is 'ol-full-screen'.
|
||||
* @property {boolean|undefined} keys Full keyboard access.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {Element|undefined} target Target.
|
||||
@@ -172,25 +184,26 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.LogoOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {string|undefined} className CSS class name. Default is 'ol-logo'.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {Element|undefined} target Target.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.MousePositionOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {string|undefined} className CSS class name. Default is 'ol-mouse-position'.
|
||||
* @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate
|
||||
* format.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {ol.ProjectionLike} projection Projection.
|
||||
* @property {Element|undefined} target Target.
|
||||
* @property {string|undefined} undefinedHTML Markup for undefined coordinates.
|
||||
* Default is '' (empty string).
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.ScaleLineOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {string|undefined} className CSS Class name. Default is 'ol-scale-line'.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {number|undefined} minWidth Minimum width in pixels.
|
||||
* @property {Element|undefined} target Target.
|
||||
@@ -199,15 +212,15 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.ZoomOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {number|undefined} delta Delta.
|
||||
* @property {string|undefined} className CSS class name. Default is 'ol-zoom'.
|
||||
* @property {number|undefined} delta The zoom delta applied on each click.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {Element|undefined} target Target.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.control.ZoomSliderOptions
|
||||
* @property {string|undefined} className Class name.
|
||||
* @property {string|undefined} className CSS class name.
|
||||
* @property {ol.Map|undefined} map Map.
|
||||
* @property {number|undefined} maxResolution Maximum resolution.
|
||||
* @property {number|undefined} minResolution Minimum resolution.
|
||||
|
||||
@@ -33,6 +33,8 @@ ol.control.Zoom = function(opt_options) {
|
||||
|
||||
var className = goog.isDef(options.className) ? options.className : 'ol-zoom';
|
||||
|
||||
var delta = goog.isDef(options.delta) ? options.delta : 1;
|
||||
|
||||
var inElement = goog.dom.createDom(goog.dom.TagName.A, {
|
||||
'href': '#zoomIn',
|
||||
'class': className + '-in'
|
||||
@@ -40,7 +42,7 @@ ol.control.Zoom = function(opt_options) {
|
||||
goog.events.listen(inElement, [
|
||||
goog.events.EventType.TOUCHEND,
|
||||
goog.events.EventType.CLICK
|
||||
], this.handleIn_, false, this);
|
||||
], goog.partial(ol.control.Zoom.prototype.zoomByDelta_, delta), false, this);
|
||||
|
||||
var outElement = goog.dom.createDom(goog.dom.TagName.A, {
|
||||
'href': '#zoomOut',
|
||||
@@ -49,7 +51,7 @@ ol.control.Zoom = function(opt_options) {
|
||||
goog.events.listen(outElement, [
|
||||
goog.events.EventType.TOUCHEND,
|
||||
goog.events.EventType.CLICK
|
||||
], this.handleOut_, false, this);
|
||||
], goog.partial(ol.control.Zoom.prototype.zoomByDelta_, -delta), false, this);
|
||||
|
||||
var cssClasses = className + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, cssClasses, inElement,
|
||||
@@ -61,46 +63,17 @@ ol.control.Zoom = function(opt_options) {
|
||||
target: options.target
|
||||
});
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.delta_ = goog.isDef(options.delta) ? options.delta : 1;
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.Zoom, ol.control.Control);
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} delta Zoom delta.
|
||||
* @param {goog.events.BrowserEvent} browserEvent The browser event to handle.
|
||||
* @private
|
||||
*/
|
||||
ol.control.Zoom.prototype.handleIn_ = function(browserEvent) {
|
||||
// prevent #zoomIn anchor from getting appended to the url
|
||||
browserEvent.preventDefault();
|
||||
var map = this.getMap();
|
||||
map.requestRenderFrame();
|
||||
// FIXME works for View2D only
|
||||
var view = map.getView().getView2D();
|
||||
var currentResolution = view.getResolution();
|
||||
if (goog.isDef(currentResolution)) {
|
||||
map.addPreRenderFunction(ol.animation.zoom({
|
||||
resolution: currentResolution,
|
||||
duration: ol.control.ZOOM_DURATION,
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
}
|
||||
var resolution = view.constrainResolution(currentResolution, this.delta_);
|
||||
view.setResolution(resolution);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {goog.events.BrowserEvent} browserEvent The browser event to handle.
|
||||
* @private
|
||||
*/
|
||||
ol.control.Zoom.prototype.handleOut_ = function(browserEvent) {
|
||||
// prevent #zoomOut anchor from getting appended to the url
|
||||
ol.control.Zoom.prototype.zoomByDelta_ = function(delta, browserEvent) {
|
||||
// prevent the anchor from getting appended to the url
|
||||
browserEvent.preventDefault();
|
||||
var map = this.getMap();
|
||||
// FIXME works for View2D only
|
||||
@@ -112,7 +85,7 @@ ol.control.Zoom.prototype.handleOut_ = function(browserEvent) {
|
||||
duration: ol.control.ZOOM_DURATION,
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
var newResolution = view.constrainResolution(currentResolution, delta);
|
||||
view.setResolution(newResolution);
|
||||
}
|
||||
var resolution = view.constrainResolution(currentResolution, -this.delta_);
|
||||
view.setResolution(resolution);
|
||||
};
|
||||
|
||||
@@ -62,6 +62,13 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
*/
|
||||
this.direction_ = ol.control.ZoomSlider.direction.VERTICAL;
|
||||
|
||||
/**
|
||||
* Whether the slider is initialized.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
this.sliderInitialized_ = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<?number>}
|
||||
@@ -107,11 +114,8 @@ ol.control.ZoomSlider.direction = {
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
this.initSlider_();
|
||||
var resolution = map.getView().getView2D().getResolution();
|
||||
if (goog.isDef(resolution)) {
|
||||
this.currentResolution_ = resolution;
|
||||
this.positionThumbForResolution_(resolution);
|
||||
if (!goog.isNull(map)) {
|
||||
map.render();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -147,6 +151,7 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
limits = new goog.math.Rect(0, 0, 0, h);
|
||||
}
|
||||
this.dragger_.setLimits(limits);
|
||||
this.sliderInitialized_ = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -154,6 +159,14 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleMapPostrender = function(mapEvent) {
|
||||
if (goog.isNull(mapEvent.frameState)) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(
|
||||
goog.isDefAndNotNull(mapEvent.frameState.view2DState));
|
||||
if (!this.sliderInitialized_) {
|
||||
this.initSlider_();
|
||||
}
|
||||
var res = mapEvent.frameState.view2DState.resolution;
|
||||
if (res !== this.currentResolution_) {
|
||||
this.currentResolution_ = res;
|
||||
|
||||
@@ -27,6 +27,42 @@ ol.geom.LinearRing = function(coordinates, opt_shared) {
|
||||
goog.inherits(ol.geom.LinearRing, ol.geom.LineString);
|
||||
|
||||
|
||||
/**
|
||||
* Determine if a vertex array representing a linear ring is in clockwise
|
||||
* order.
|
||||
*
|
||||
* This method comes from Green's Theorem and was mentioned in an answer to a
|
||||
* a Stack Overflow question (http://tinyurl.com/clockwise-method).
|
||||
*
|
||||
* Note that calculating the cross product for each pair of edges could be
|
||||
* avoided by first finding the lowest, rightmost vertex. See OGR's
|
||||
* implementation for an example of this.
|
||||
* https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp
|
||||
*
|
||||
* @param {ol.geom.VertexArray} coordinates Linear ring coordinates.
|
||||
* @return {boolean} The coordinates are in clockwise order.
|
||||
*/
|
||||
ol.geom.LinearRing.isClockwise = function(coordinates) {
|
||||
var length = coordinates.length;
|
||||
var edge = 0;
|
||||
|
||||
var last = coordinates[length - 1];
|
||||
var x1 = last[0];
|
||||
var y1 = last[1];
|
||||
|
||||
var x2, y2, coord;
|
||||
for (var i = 0; i < length; ++i) {
|
||||
coord = coordinates[i];
|
||||
x2 = coord[0];
|
||||
y2 = coord[1];
|
||||
edge += (x2 - x1) * (y2 + y1);
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
return edge > 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,12 @@ goog.require('ol.geom.VertexArray');
|
||||
|
||||
|
||||
/**
|
||||
* Create a polygon from an array of vertex arrays. Coordinates for the
|
||||
* exterior ring will be forced to clockwise order. Coordinates for any
|
||||
* interior rings will be forced to counter-clockwise order. In cases where
|
||||
* the opposite winding order occurs in the passed vertex arrays, they will
|
||||
* be modified in place.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.geom.Geometry}
|
||||
* @param {Array.<ol.geom.VertexArray>} coordinates Array of rings. First
|
||||
@@ -40,8 +46,21 @@ ol.geom.Polygon = function(coordinates, opt_shared) {
|
||||
* @type {Array.<ol.geom.LinearRing>}
|
||||
*/
|
||||
this.rings = new Array(numRings);
|
||||
var ringCoords;
|
||||
for (var i = 0; i < numRings; ++i) {
|
||||
this.rings[i] = new ol.geom.LinearRing(coordinates[i], vertices);
|
||||
ringCoords = coordinates[i];
|
||||
if (i === 0) {
|
||||
// force exterior ring to be clockwise
|
||||
if (!ol.geom.LinearRing.isClockwise(ringCoords)) {
|
||||
ringCoords.reverse();
|
||||
}
|
||||
} else {
|
||||
// force interior rings to be counter-clockwise
|
||||
if (ol.geom.LinearRing.isClockwise(ringCoords)) {
|
||||
ringCoords.reverse();
|
||||
}
|
||||
}
|
||||
this.rings[i] = new ol.geom.LinearRing(ringCoords, vertices);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK &&
|
||||
mapBrowserEvent.isMouseActionButton()) {
|
||||
@@ -52,6 +53,7 @@ ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor,
|
||||
ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -95,8 +95,9 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var map = mapBrowserEvent.map;
|
||||
if (!map.isDef()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
var stopEvent = false;
|
||||
var view = map.getView();
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DOWN) {
|
||||
@@ -132,7 +133,8 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||
this.dragging_ = true;
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,9 @@ ol.interaction.Interaction = function() {
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} Whether the map browser event should continue
|
||||
* through the chain of interactions. false means stop, true
|
||||
* means continue.
|
||||
*/
|
||||
ol.interaction.Interaction.prototype.handleMapBrowserEvent =
|
||||
goog.abstractMethod;
|
||||
|
||||
@@ -52,6 +52,7 @@ goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
(mapBrowserEvent.browserEvent);
|
||||
@@ -81,7 +82,8 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Interaction.pan(
|
||||
map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -49,6 +49,7 @@ goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
(mapBrowserEvent.browserEvent);
|
||||
@@ -63,7 +64,8 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, delta, undefined,
|
||||
ol.interaction.KEYBOARD_ZOOM_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ goog.inherits(ol.interaction.MouseWheelZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type ==
|
||||
goog.events.MouseWheelHandler.EventType.MOUSEWHEEL) {
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -93,8 +93,9 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
goog.bind(this.doZoom_, this, map), timeLeft);
|
||||
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -126,4 +126,5 @@ ol.interaction.Touch.prototype.handleMapBrowserEvent =
|
||||
}
|
||||
this.handled_ = handled;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -672,8 +672,8 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
if (this.dispatchEvent(mapBrowserEvent) !== false) {
|
||||
for (i = interactionsArray.length - 1; i >= 0; i--) {
|
||||
var interaction = interactionsArray[i];
|
||||
interaction.handleMapBrowserEvent(mapBrowserEvent);
|
||||
if (mapBrowserEvent.otherInteractionsStopped) {
|
||||
var cont = interaction.handleMapBrowserEvent(mapBrowserEvent);
|
||||
if (!cont) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,6 @@ ol.MapBrowserEvent = function(type, map, browserEvent, opt_frameState) {
|
||||
*/
|
||||
this.coordinate_ = null;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.otherInteractionsStopped = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Pixel}
|
||||
@@ -114,14 +109,6 @@ ol.MapBrowserEvent.prototype.preventDefault = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Stop the interaction chain.
|
||||
*/
|
||||
ol.MapBrowserEvent.prototype.stopOtherInteractions = function() {
|
||||
this.otherInteractionsStopped = true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Prevents further propagation of the current event.
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation
|
||||
|
||||
@@ -763,6 +763,10 @@ ol.parser.KML = function(opt_options) {
|
||||
return node;
|
||||
},
|
||||
'Polygon': function(geometry) {
|
||||
/**
|
||||
* KML doesn't specify the winding order of coordinates in linear
|
||||
* rings. So we keep them as they are in the geometries.
|
||||
*/
|
||||
var node = this.createElementNS('Polygon');
|
||||
var coordinates = geometry.getCoordinates();
|
||||
this.writeNode('outerBoundaryIs', coordinates[0], null, node);
|
||||
|
||||
@@ -67,9 +67,17 @@ ol.parser.ogc.GML_v2 = function(opt_options) {
|
||||
'Polygon': function(geometry) {
|
||||
var node = this.createElementNS('gml:Polygon');
|
||||
var coordinates = geometry.getCoordinates();
|
||||
this.writeNode('outerBoundaryIs', coordinates[0], null, node);
|
||||
/**
|
||||
* Though there continues to be ambiguity around this, GML references
|
||||
* ISO 19107, which says polygons have counter-clockwise exterior rings
|
||||
* and clockwise interior rings. The ambiguity comes because the
|
||||
* the Simple Feature Access - SQL spec (ISO 19125-2) says that no
|
||||
* winding order is enforced. Anyway, we write out counter-clockwise
|
||||
* exterior and clockwise interior here but accept either when reading.
|
||||
*/
|
||||
this.writeNode('outerBoundaryIs', coordinates[0].reverse(), null, node);
|
||||
for (var i = 1; i < coordinates.length; ++i) {
|
||||
this.writeNode('innerBoundaryIs', coordinates[i], null, node);
|
||||
this.writeNode('innerBoundaryIs', coordinates[i].reverse(), null, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
@@ -298,18 +298,26 @@ ol.parser.ogc.GML_v3 = function(opt_options) {
|
||||
var node = this.createElementNS('gml:PolygonPatch');
|
||||
node.setAttribute('interpolation', 'planar');
|
||||
var coordinates = geometry.getCoordinates();
|
||||
this.writeNode('exterior', coordinates[0], null, node);
|
||||
this.writeNode('exterior', coordinates[0].reverse(), null, node);
|
||||
for (var i = 1, len = coordinates.length; i < len; ++i) {
|
||||
this.writeNode('interior', coordinates[i], null, node);
|
||||
this.writeNode('interior', coordinates[i].reverse(), null, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
'Polygon': function(geometry) {
|
||||
var node = this.createElementNS('gml:Polygon');
|
||||
var coordinates = geometry.getCoordinates();
|
||||
this.writeNode('exterior', coordinates[0], null, node);
|
||||
/**
|
||||
* Though there continues to be ambiguity around this, GML references
|
||||
* ISO 19107, which says polygons have counter-clockwise exterior rings
|
||||
* and clockwise interior rings. The ambiguity comes because the
|
||||
* the Simple Feature Access - SQL spec (ISO 19125-2) says that no
|
||||
* winding order is enforced. Anyway, we write out counter-clockwise
|
||||
* exterior and clockwise interior here but accept either when reading.
|
||||
*/
|
||||
this.writeNode('exterior', coordinates[0].reverse(), null, node);
|
||||
for (var i = 1, len = coordinates.length; i < len; ++i) {
|
||||
this.writeNode('interior', coordinates[i], null, node);
|
||||
this.writeNode('interior', coordinates[i].reverse(), null, node);
|
||||
}
|
||||
return node;
|
||||
},
|
||||
|
||||
@@ -11,33 +11,6 @@ goog.require('ol.array');
|
||||
ol.ResolutionConstraintType;
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} power Power.
|
||||
* @param {number} maxResolution Maximum resolution.
|
||||
* @param {number=} opt_minResolution Minimum resolution.
|
||||
* @return {ol.ResolutionConstraintType} Zoom function.
|
||||
*/
|
||||
ol.ResolutionConstraint.createContinuous =
|
||||
function(power, maxResolution, opt_minResolution) {
|
||||
var minResolution = opt_minResolution || 0;
|
||||
return (
|
||||
/**
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number} delta Delta.
|
||||
* @param {number} direction Direction.
|
||||
* @return {number|undefined} Resolution.
|
||||
*/
|
||||
function(resolution, delta, direction) {
|
||||
if (goog.isDef(resolution)) {
|
||||
resolution /= Math.pow(power, delta);
|
||||
return goog.math.clamp(resolution, minResolution, maxResolution);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} resolutions Resolutions.
|
||||
* @return {ol.ResolutionConstraintType} Zoom function.
|
||||
|
||||
@@ -4,3 +4,5 @@
|
||||
@exportProperty ol.View2D.prototype.constrainRotation
|
||||
@exportProperty ol.View2D.prototype.fitExtent
|
||||
@exportProperty ol.View2D.prototype.getView2D
|
||||
@exportProperty ol.View2D.prototype.getZoom
|
||||
@exportProperty ol.View2D.prototype.setZoom
|
||||
|
||||
101
src/ol/view2d.js
101
src/ol/view2d.js
@@ -32,13 +32,51 @@ ol.View2DProperty = {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new View2D, a View2D manages properties such as center,
|
||||
* projection, resolution and rotation.
|
||||
* @class
|
||||
* An ol.View2D object represents a simple 2D view of the map.
|
||||
*
|
||||
* Example:
|
||||
* This is the object to act upon to change the center, resolution,
|
||||
* and rotation of the map.
|
||||
*
|
||||
* // to get the current extent
|
||||
* map.getView().getView2D().calculateExtent(map.getSize())
|
||||
* ### The view states
|
||||
*
|
||||
* An `ol.View2D` is determined by three states: `center`, `resolution`,
|
||||
* and `rotation`. To each state corresponds a getter and a setter. E.g.
|
||||
* `getCenter` and `setCenter` for the `center` state.
|
||||
*
|
||||
* An `ol.View2D` has a `projection`. The projection determines the
|
||||
* coordinate system of the center, and its units determine the units of the
|
||||
* resolution (projection units per pixel). The default projection is
|
||||
* Spherical Mercator (EPSG:3857).
|
||||
*
|
||||
* ### The constraints
|
||||
*
|
||||
* `setCenter`, `setResolution` and `setRotation` can be used to change the
|
||||
* states of the view. Any value can be passed to the setters. And the value
|
||||
* that is passed to a setter will effectively be the value set in the view,
|
||||
* and returned by the corresponding getter.
|
||||
*
|
||||
* But an `ol.View2D` object also has a *resolution constraint* and a
|
||||
* *rotation constraint*. There's currently no *center constraint*, but
|
||||
* this may change in the future.
|
||||
*
|
||||
* As said above no constraints are applied when the setters are used to set
|
||||
* new states for the view. Applying constraints is done explicitly through
|
||||
* the use of the `constrain*` functions (`constrainResolution` and
|
||||
* `constrainRotation`).
|
||||
*
|
||||
* The main users of the constraints are the interactions and the
|
||||
* controls. For example, double-clicking on the map changes the view to
|
||||
* the "next" resolution. And releasing the fingers after pinch-zooming
|
||||
* snaps to the closest resolution (with an animation).
|
||||
*
|
||||
* So the *resolution constraint* snaps to specific resolutions. It is
|
||||
* determined by the following options: `resolutions`, `maxResolution`,
|
||||
* `maxZoom`, and `zoomFactor`. If `resolutions` is set, the other three
|
||||
* options are ignored. See {@link ol.View2DOptions} for more information.
|
||||
*
|
||||
* The *rotation constaint* is currently not configurable. It snaps the
|
||||
* rotation value to zero when approaching the horizontal.
|
||||
*
|
||||
* @constructor
|
||||
* @implements {ol.IView2D}
|
||||
@@ -59,21 +97,22 @@ ol.View2D = function(opt_options) {
|
||||
values[ol.View2DProperty.PROJECTION] = ol.proj.createProjection(
|
||||
options.projection, 'EPSG:3857');
|
||||
|
||||
var parts = ol.View2D.createResolutionConstraint_(options);
|
||||
var resolutionConstraintInfo = ol.View2D.createResolutionConstraint_(
|
||||
options);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.maxResolution_ = parts[1];
|
||||
this.maxResolution_ = resolutionConstraintInfo.maxResolution;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.minResolution_ = parts[2];
|
||||
this.minResolution_ = resolutionConstraintInfo.minResolution;
|
||||
|
||||
var resolutionConstraint = parts[0];
|
||||
var resolutionConstraint = resolutionConstraintInfo.constraint;
|
||||
var rotationConstraint = ol.View2D.createRotationConstraint_(options);
|
||||
|
||||
/**
|
||||
@@ -86,7 +125,7 @@ ol.View2D = function(opt_options) {
|
||||
if (goog.isDef(options.resolution)) {
|
||||
values[ol.View2DProperty.RESOLUTION] = options.resolution;
|
||||
} else if (goog.isDef(options.zoom)) {
|
||||
values[ol.View2DProperty.RESOLUTION] = resolutionConstraint(
|
||||
values[ol.View2DProperty.RESOLUTION] = this.constrainResolution(
|
||||
this.maxResolution_, options.zoom);
|
||||
}
|
||||
values[ol.View2DProperty.ROTATION] =
|
||||
@@ -324,6 +363,31 @@ ol.View2D.prototype.getView3D = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the current zoom level. Return undefined if the current
|
||||
* resolution is undefined or not a "constrained resolution".
|
||||
* @return {number|undefined} Zoom.
|
||||
*/
|
||||
ol.View2D.prototype.getZoom = function() {
|
||||
var zoom;
|
||||
var resolution = this.getResolution();
|
||||
|
||||
if (goog.isDef(resolution)) {
|
||||
var res, z = 0;
|
||||
do {
|
||||
res = this.constrainResolution(this.maxResolution_, z);
|
||||
if (res == resolution) {
|
||||
zoom = z;
|
||||
break;
|
||||
}
|
||||
++z;
|
||||
} while (res > this.minResolution_);
|
||||
}
|
||||
|
||||
return zoom;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fit the given extent based on the given map size.
|
||||
* @param {ol.Extent} extent Extent.
|
||||
@@ -398,11 +462,21 @@ goog.exportProperty(
|
||||
ol.View2D.prototype.setRotation);
|
||||
|
||||
|
||||
/**
|
||||
* Zoom to a specific zoom level.
|
||||
* @param {number} zoom Zoom level.
|
||||
*/
|
||||
ol.View2D.prototype.setZoom = function(zoom) {
|
||||
var resolution = this.constrainResolution(this.maxResolution_, zoom, 0);
|
||||
this.setResolution(resolution);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {ol.View2DOptions} options View2D options.
|
||||
* @return {Array} Array of three elements: the resolution constraint,
|
||||
* maxResolution, and minResolution.
|
||||
* @return {{constraint: ol.ResolutionConstraintType, maxResolution: number,
|
||||
* minResolution: number}}
|
||||
*/
|
||||
ol.View2D.createResolutionConstraint_ = function(options) {
|
||||
var resolutionConstraint;
|
||||
@@ -440,7 +514,8 @@ ol.View2D.createResolutionConstraint_ = function(options) {
|
||||
resolutionConstraint = ol.ResolutionConstraint.createSnapToPower(
|
||||
zoomFactor, maxResolution, maxZoom);
|
||||
}
|
||||
return [resolutionConstraint, maxResolution, minResolution];
|
||||
return {constraint: resolutionConstraint, maxResolution: maxResolution,
|
||||
minResolution: minResolution};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ describe('ol.control.ZoomSlider', function() {
|
||||
control.element.style.width = '1000px';
|
||||
control.element.style.height = '10px';
|
||||
control.setMap(map);
|
||||
control.initSlider_();
|
||||
|
||||
var horizontal = ol.control.ZoomSlider.direction.HORIZONTAL;
|
||||
expect(control.direction_).to.be(horizontal);
|
||||
|
||||
@@ -108,4 +108,39 @@ describe('ol.geom.LinearRing', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.LinearRing.isClockwise()', function() {
|
||||
|
||||
var isClockwise = ol.geom.LinearRing.isClockwise;
|
||||
|
||||
it('returns true for clockwise coordinates', function() {
|
||||
var coordinates = [
|
||||
[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]
|
||||
];
|
||||
expect(isClockwise(coordinates)).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false for counter-clockwise coordinates', function() {
|
||||
var coordinates = [
|
||||
[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]
|
||||
];
|
||||
expect(isClockwise(coordinates)).to.be(false);
|
||||
});
|
||||
|
||||
it('returns true for mostly clockwise, self-intersecting ring', function() {
|
||||
var coordinates = [
|
||||
[0, 0], [0, 1], [1.5, 1], [1.5, 1.5], [1, 1.5], [1, 0], [0, 0]
|
||||
];
|
||||
expect(isClockwise(coordinates)).to.be(true);
|
||||
});
|
||||
|
||||
it('returns false for mostly counter-clockwise, intersecting', function() {
|
||||
var coordinates = [
|
||||
[0, 0], [1, 0], [1, 1.5], [1.5, 1.5], [1.5, 1], [0, 1], [0, 0]
|
||||
];
|
||||
expect(isClockwise(coordinates)).to.be(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
goog.require('ol.geom.LinearRing');
|
||||
|
||||
@@ -44,6 +44,28 @@ describe('ol.geom.Polygon', function() {
|
||||
expect(poly.rings[2]).to.be.a(ol.geom.LinearRing);
|
||||
});
|
||||
|
||||
var isClockwise = ol.geom.LinearRing.isClockwise;
|
||||
|
||||
it('forces exterior ring to be clockwise', function() {
|
||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
expect(isClockwise(outer)).to.be(false);
|
||||
|
||||
var poly = new ol.geom.Polygon([outer]);
|
||||
var ring = poly.rings[0];
|
||||
expect(isClockwise(ring.getCoordinates())).to.be(true);
|
||||
});
|
||||
|
||||
it('forces interior ring to be counter-clockwise', function() {
|
||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
var inner = [[2, 2], [2, 8], [8, 8], [8, 2], [2, 2]];
|
||||
expect(isClockwise(inner)).to.be(true);
|
||||
|
||||
var poly = new ol.geom.Polygon([outer, inner]);
|
||||
var ring = poly.rings[1];
|
||||
expect(isClockwise(ring.getCoordinates())).to.be(false);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('#dimension', function() {
|
||||
|
||||
@@ -1,34 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
||||
<Document>
|
||||
<name>Polygon.kml</name>
|
||||
<open>0</open>
|
||||
<Placemark id="KML.Polygon">
|
||||
<name>hollow box</name>
|
||||
<Polygon>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
-122.366278,37.818844,30
|
||||
-122.365248,37.819267,30
|
||||
-122.36564,37.819861,30
|
||||
-122.366669,37.819429,30
|
||||
-122.366278,37.818844,30
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
<innerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>
|
||||
-122.366212,37.818977,30
|
||||
-122.365424,37.819294,30
|
||||
-122.365704,37.819731,30
|
||||
-122.366488,37.819402,30
|
||||
-122.366212,37.818977,30
|
||||
</coordinates>
|
||||
</LinearRing>
|
||||
</innerBoundaryIs>
|
||||
</Polygon>
|
||||
</Placemark>
|
||||
</Document>
|
||||
<Document>
|
||||
<name>Polygon.kml</name>
|
||||
<open>0</open>
|
||||
<Placemark id="KML.Polygon">
|
||||
<name>hollow box</name>
|
||||
<Polygon>
|
||||
<outerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>-30,-20,0 -30,20,0 30,20,0 30,-20,0 -30,-20,0</coordinates>
|
||||
</LinearRing>
|
||||
</outerBoundaryIs>
|
||||
<innerBoundaryIs>
|
||||
<LinearRing>
|
||||
<coordinates>-15,-10,0 15,-10,0 15,10,0 -15,10,0 -15,-10,0</coordinates>
|
||||
</LinearRing>
|
||||
</innerBoundaryIs>
|
||||
</Polygon>
|
||||
</Placemark>
|
||||
</Document>
|
||||
</kml>
|
||||
@@ -145,14 +145,6 @@ describe('ol.parser.gml_v2', function() {
|
||||
delete parser.srsName;
|
||||
expect(obj.geometry.type).to.eql('polygon');
|
||||
done();
|
||||
expect(obj.geometry.coordinates.length).to.eql(3);
|
||||
expect(obj.geometry.coordinates[0].length).to.eql(4);
|
||||
expect(obj.geometry.coordinates[0]).to.eql([[1, 2], [3, 4],
|
||||
[5, 6], [1, 2]]);
|
||||
expect(obj.geometry.coordinates[1]).to.eql([[2, 3], [4, 5],
|
||||
[6, 7], [2, 3]]);
|
||||
expect(obj.geometry.coordinates[2]).to.eql([[3, 4], [5, 6],
|
||||
[7, 8], [3, 4]]);
|
||||
});
|
||||
});
|
||||
it('MultiPolygon read correctly from coord', function(done) {
|
||||
|
||||
@@ -247,14 +247,6 @@ describe('ol.parser.gml_v3', function() {
|
||||
delete parser.srsName;
|
||||
expect(goog.dom.xml.loadXml(parser.serialize(node))).to.xmleql(xml);
|
||||
expect(obj.geometry.type).to.eql('polygon');
|
||||
expect(obj.geometry.coordinates.length).to.eql(3);
|
||||
expect(obj.geometry.coordinates[0].length).to.eql(4);
|
||||
expect(obj.geometry.coordinates[0]).to.eql([[1, 2], [3, 4],
|
||||
[5, 6], [1, 2]]);
|
||||
expect(obj.geometry.coordinates[1]).to.eql([[2, 3], [4, 5],
|
||||
[6, 7], [2, 3]]);
|
||||
expect(obj.geometry.coordinates[2]).to.eql([[3, 4], [5, 6],
|
||||
[7, 8], [3, 4]]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -268,14 +260,6 @@ describe('ol.parser.gml_v3', function() {
|
||||
[geom]).firstChild;
|
||||
expect(goog.dom.xml.loadXml(p.serialize(node))).to.xmleql(xml);
|
||||
expect(obj.geometry.type).to.eql('polygon');
|
||||
expect(obj.geometry.coordinates.length).to.eql(3);
|
||||
expect(obj.geometry.coordinates[0].length).to.eql(4);
|
||||
expect(obj.geometry.coordinates[0]).to.eql([[1, 2], [3, 4],
|
||||
[5, 6], [1, 2]]);
|
||||
expect(obj.geometry.coordinates[1]).to.eql([[2, 3], [4, 5],
|
||||
[6, 7], [2, 3]]);
|
||||
expect(obj.geometry.coordinates[2]).to.eql([[3, 4], [5, 6],
|
||||
[7, 8], [3, 4]]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,17 +13,17 @@
|
||||
<gml:Polygon srsName="foo">
|
||||
<gml:outerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,2 3,4 1,2</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:outerBoundaryIs>
|
||||
<gml:innerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">2,3 4,5 6,7 2,3</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">2,3 2,5 4,5 2,3</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:innerBoundaryIs>
|
||||
<gml:innerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">3,4 5,6 7,8 3,4</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">3,4 3,6 5,6 3,4</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:innerBoundaryIs>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>3</gml:X>
|
||||
<gml:Y>4</gml:Y>
|
||||
<gml:Y>2</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>5</gml:X>
|
||||
<gml:Y>6</gml:Y>
|
||||
<gml:X>3</gml:X>
|
||||
<gml:Y>4</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>1</gml:X>
|
||||
@@ -28,12 +28,12 @@
|
||||
<gml:Y>3</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>4</gml:X>
|
||||
<gml:X>2</gml:X>
|
||||
<gml:Y>5</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>6</gml:X>
|
||||
<gml:Y>7</gml:Y>
|
||||
<gml:X>4</gml:X>
|
||||
<gml:Y>5</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>2</gml:X>
|
||||
@@ -48,12 +48,12 @@
|
||||
<gml:Y>4</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>5</gml:X>
|
||||
<gml:X>3</gml:X>
|
||||
<gml:Y>6</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>7</gml:X>
|
||||
<gml:Y>8</gml:Y>
|
||||
<gml:X>5</gml:X>
|
||||
<gml:Y>6</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>3</gml:X>
|
||||
@@ -73,11 +73,11 @@
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>3</gml:X>
|
||||
<gml:Y>4</gml:Y>
|
||||
<gml:Y>2</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>5</gml:X>
|
||||
<gml:Y>6</gml:Y>
|
||||
<gml:X>3</gml:X>
|
||||
<gml:Y>4</gml:Y>
|
||||
</gml:coord>
|
||||
<gml:coord>
|
||||
<gml:X>1</gml:X>
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
<gml:Polygon>
|
||||
<gml:outerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,2 3,4 1,2</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:outerBoundaryIs>
|
||||
<gml:innerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">2,3 4,5 6,7 2,3</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">2,3 2,5 4,5 2,3</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:innerBoundaryIs>
|
||||
<gml:innerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">3,4 5,6 7,8 3,4</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">3,4 3,6 5,6 3,4</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:innerBoundaryIs>
|
||||
</gml:Polygon>
|
||||
@@ -22,7 +22,7 @@
|
||||
<gml:Polygon>
|
||||
<gml:outerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,2 3,4 1,2</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:outerBoundaryIs>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="foo">
|
||||
<gml:outerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,4 5,6 1,2</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 5,2 5,6 1,2</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:outerBoundaryIs>
|
||||
<gml:innerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">2,3 4,5 6,7 2,3</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">2,3 2,5 4,5 2,3</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:innerBoundaryIs>
|
||||
<gml:innerBoundaryIs>
|
||||
<gml:LinearRing>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">3,4 5,6 7,8 3,4</gml:coordinates>
|
||||
<gml:coordinates decimal="." cs="," ts=" ">3,4 3,6 5,6 3,4</gml:coordinates>
|
||||
</gml:LinearRing>
|
||||
</gml:innerBoundaryIs>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -3,24 +3,24 @@
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:Polygon>
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:Polygon>
|
||||
@@ -22,7 +22,7 @@
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -3,24 +3,24 @@
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:Polygon>
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:Polygon>
|
||||
@@ -22,7 +22,7 @@
|
||||
<gml:Polygon>
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
<gml:PolygonPatch interpolation="planar">
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:PolygonPatch>
|
||||
@@ -28,7 +28,7 @@
|
||||
<gml:PolygonPatch interpolation="planar">
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
</gml:PolygonPatch>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="foo">
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:Polygon>
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
<gml:PolygonPatch interpolation="planar">
|
||||
<gml:exterior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>1 2 3 4 5 6 1 2</gml:posList>
|
||||
<gml:posList>1 2 3 2 3 4 1 2</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:exterior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>2 3 4 5 6 7 2 3</gml:posList>
|
||||
<gml:posList>2 3 2 5 4 5 2 3</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
<gml:interior>
|
||||
<gml:LinearRing>
|
||||
<gml:posList>3 4 5 6 7 8 3 4</gml:posList>
|
||||
<gml:posList>3 4 3 6 5 6 3 4</gml:posList>
|
||||
</gml:LinearRing>
|
||||
</gml:interior>
|
||||
</gml:PolygonPatch>
|
||||
|
||||
@@ -80,7 +80,9 @@ describe('ol.parser.WKT', function() {
|
||||
expect(geom.rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
|
||||
expect(parser.write(geom)).to.eql(wkt);
|
||||
wkt = 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,35 35,30 20,20 30))';
|
||||
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
wkt = 'POLYGON((35 10,10 20,15 40,45 45,35 10),(20 30,30 20,35 35,20 30))';
|
||||
geom = parser.read(wkt);
|
||||
expect(geom.getType()).to.eql(ol.geom.GeometryType.POLYGON);
|
||||
expect(geom.rings.length).to.eql(2);
|
||||
@@ -89,8 +91,9 @@ describe('ol.parser.WKT', function() {
|
||||
expect(geom.rings[0].getCoordinates()).to.eql(
|
||||
[[35, 10], [10, 20], [15, 40], [45, 45], [35, 10]]);
|
||||
expect(geom.rings[1].getCoordinates()).to.eql(
|
||||
[[20, 30], [35, 35], [30, 20], [20, 30]]);
|
||||
[[20, 30], [30, 20], [35, 35], [20, 30]]);
|
||||
expect(parser.write(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
wkt = 'POLYGON ( (30 10, 10 20, 20 40, 40 40, 30 10) )';
|
||||
geom = parser.read(wkt);
|
||||
@@ -102,7 +105,8 @@ describe('ol.parser.WKT', function() {
|
||||
});
|
||||
|
||||
it('MultiPolygon read / written correctly', function() {
|
||||
var wkt = 'MULTIPOLYGON(((40 40,20 45,45 30,40 40)),' +
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
var wkt = 'MULTIPOLYGON(((40 40,45 30,20 45,40 40)),' +
|
||||
'((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)))';
|
||||
var geom = parser.read(wkt);
|
||||
expect(geom.getType()).to.eql(ol.geom.GeometryType.MULTIPOLYGON);
|
||||
@@ -112,16 +116,17 @@ describe('ol.parser.WKT', function() {
|
||||
expect(geom.components[0].rings.length).to.eql(1);
|
||||
expect(geom.components[1].rings.length).to.eql(2);
|
||||
expect(geom.components[0].rings[0].getCoordinates()).to.eql(
|
||||
[[40, 40], [20, 45], [45, 30], [40, 40]]);
|
||||
[[40, 40], [45, 30], [20, 45], [40, 40]]);
|
||||
expect(geom.components[1].rings[0].getCoordinates()).to.eql(
|
||||
[[20, 35], [45, 20], [30, 5], [10, 10], [10, 30], [20, 35]]);
|
||||
expect(geom.components[1].rings[1].getCoordinates()).to.eql(
|
||||
[[30, 20], [20, 25], [20, 15], [30, 20]]);
|
||||
expect(parser.write(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
wkt = 'MULTIPOLYGON( ( (40 40, 20 45, 45 30, 40 40) ), ' +
|
||||
'( (20 35, 45 20, 30 5, 10 10, 10 30, 20 35 ), ( 30 20, 20 25, ' +
|
||||
'20 15, 30 20 ) ) )';
|
||||
wkt = 'MULTIPOLYGON( ( ( 40 40,45 30, 20 45 ,40 40 )) ,' +
|
||||
'( (20 35, 45 20,30 5,10 10,10 30,20 35), ' +
|
||||
'( 30 20, 20 25,20 15 ,30 20 ) ))';
|
||||
geom = parser.read(wkt);
|
||||
expect(geom.getType()).to.eql(ol.geom.GeometryType.MULTIPOLYGON);
|
||||
expect(geom.components.length).to.eql(2);
|
||||
@@ -130,7 +135,7 @@ describe('ol.parser.WKT', function() {
|
||||
expect(geom.components[0].rings.length).to.eql(1);
|
||||
expect(geom.components[1].rings.length).to.eql(2);
|
||||
expect(geom.components[0].rings[0].getCoordinates()).to.eql(
|
||||
[[40, 40], [20, 45], [45, 30], [40, 40]]);
|
||||
[[40, 40], [45, 30], [20, 45], [40, 40]]);
|
||||
expect(geom.components[1].rings[0].getCoordinates()).to.eql(
|
||||
[[20, 35], [45, 20], [30, 5], [10, 10], [10, 30], [20, 35]]);
|
||||
expect(geom.components[1].rings[1].getCoordinates()).to.eql(
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('ol.View2D', function() {
|
||||
describe('with no options', function() {
|
||||
it('gives a correct resolution constraint function', function() {
|
||||
var options = {};
|
||||
var fn = ol.View2D.createResolutionConstraint_(options)[0];
|
||||
var fn = ol.View2D.createResolutionConstraint_(options).constraint;
|
||||
expect(fn(156543.03392804097, 0, 0))
|
||||
.to.roughlyEqual(156543.03392804097, 1e-9);
|
||||
expect(fn(78271.51696402048, 0, 0))
|
||||
@@ -24,12 +24,12 @@ describe('ol.View2D', function() {
|
||||
maxZoom: 3,
|
||||
zoomFactor: 3
|
||||
};
|
||||
var parts = ol.View2D.createResolutionConstraint_(options);
|
||||
var maxResolution = parts[1];
|
||||
var info = ol.View2D.createResolutionConstraint_(options);
|
||||
var maxResolution = info.maxResolution;
|
||||
expect(maxResolution).to.eql(81);
|
||||
var minResolution = parts[2];
|
||||
var minResolution = info.minResolution;
|
||||
expect(minResolution).to.eql(3);
|
||||
var fn = parts[0];
|
||||
var fn = info.constraint;
|
||||
expect(fn(82, 0, 0)).to.eql(81);
|
||||
expect(fn(81, 0, 0)).to.eql(81);
|
||||
expect(fn(27, 0, 0)).to.eql(27);
|
||||
@@ -44,12 +44,12 @@ describe('ol.View2D', function() {
|
||||
var options = {
|
||||
resolutions: [97, 76, 65, 54, 0.45]
|
||||
};
|
||||
var parts = ol.View2D.createResolutionConstraint_(options);
|
||||
var maxResolution = parts[1];
|
||||
var info = ol.View2D.createResolutionConstraint_(options);
|
||||
var maxResolution = info.maxResolution;
|
||||
expect(maxResolution).to.eql(97);
|
||||
var minResolution = parts[2];
|
||||
var minResolution = info.minResolution;
|
||||
expect(minResolution).to.eql(0.45);
|
||||
var fn = parts[0];
|
||||
var fn = info.constraint;
|
||||
expect(fn(97, 0, 0)).to.eql(97);
|
||||
expect(fn(76, 0, 0)).to.eql(76);
|
||||
expect(fn(65, 0, 0)).to.eql(65);
|
||||
@@ -70,6 +70,38 @@ describe('ol.View2D', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getZoom', function() {
|
||||
var view;
|
||||
beforeEach(function() {
|
||||
view = new ol.View2D({
|
||||
resolutions: [512, 256, 128, 64, 32, 16]
|
||||
});
|
||||
});
|
||||
|
||||
it('returns correct zoom levels', function() {
|
||||
view.setResolution(undefined);
|
||||
expect(view.getZoom()).to.be(undefined);
|
||||
|
||||
view.setResolution(511);
|
||||
expect(view.getZoom()).to.be(undefined);
|
||||
|
||||
view.setResolution(512);
|
||||
expect(view.getZoom()).to.be(0);
|
||||
|
||||
view.setResolution(64);
|
||||
expect(view.getZoom()).to.be(3);
|
||||
|
||||
view.setResolution(65);
|
||||
expect(view.getZoom()).to.be(undefined);
|
||||
|
||||
view.setResolution(16);
|
||||
expect(view.getZoom()).to.be(5);
|
||||
|
||||
view.setResolution(15);
|
||||
expect(view.getZoom()).to.be(undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
goog.require('ol.View2D');
|
||||
|
||||
Reference in New Issue
Block a user