Conflicts:
	tests/list-tests.html
This commit is contained in:
Marc Jansen
2012-08-17 22:46:06 +02:00
78 changed files with 1733 additions and 315 deletions
+21 -1
View File
@@ -60,6 +60,15 @@ def build(config_file = None, output_file = None, options = None):
print "\nAbnormal termination." print "\nAbnormal termination."
sys.exit("ERROR: %s" % E) sys.exit("ERROR: %s" % E)
if options.amdname:
options.amdname = "'" + options.amdname + "',"
else:
options.amdname = ""
if options.amd == 'pre':
print "\nAdding AMD function."
merged = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, merged)
print "Compressing using %s" % use_compressor print "Compressing using %s" % use_compressor
if use_compressor == "jsmin": if use_compressor == "jsmin":
minimized = jsmin.jsmin(merged) minimized = jsmin.jsmin(merged)
@@ -101,6 +110,14 @@ def build(config_file = None, output_file = None, options = None):
else: # fallback else: # fallback
minimized = merged minimized = merged
if options.amd == 'post':
print "\nAdding AMD function."
minimized = "define(%sfunction(){%sreturn OpenLayers;});" % (options.amdname, minimized)
if options.status:
print "\nAdding status file."
minimized = "// status: " + file(options.status).read() + minimized
print "\nAdding license file." print "\nAdding license file."
minimized = file("license.txt").read() + minimized minimized = file("license.txt").read() + minimized
@@ -111,7 +128,10 @@ def build(config_file = None, output_file = None, options = None):
if __name__ == '__main__': if __name__ == '__main__':
opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'") opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'")
opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin', 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin") opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin' (default), 'minimize', 'closure_ws', 'closure', or 'none'", default="jsmin")
opt.add_option("-s", "--status", dest="status", help="name of a file whose contents will be added as a comment at the front of the output file. For example, when building from a git repo, you can save the output of 'git describe --tags' in this file. Default is no file.", default=False)
opt.add_option("--amd", dest="amd", help="output should be AMD module; wrap merged files in define function; can be either 'pre' (before compilation) or 'post' (after compilation). Wrapping the OpenLayers var in a function means the filesize can be reduced by the closure compiler using 'pre', but be aware that a few functions depend on the OpenLayers variable being present. Either option can be used with jsmin or minimize compression. Default false, not AMD.", default=False)
opt.add_option("--amdname", dest="amdname", help="only useful with amd option. Name of AMD module. Default no name, anonymous module.", default=False)
(options, args) = opt.parse_args() (options, args) = opt.parse_args()
if not len(args): if not len(args):
build(options=options) build(options=options)
+4 -2
View File
@@ -8,10 +8,12 @@ var map = new OpenLayers.Map({
div: "map", div: "map",
layers: [ layers: [
new OpenLayers.Layer.XYZ("OSM (with buffer)", urls, { new OpenLayers.Layer.XYZ("OSM (with buffer)", urls, {
transitionEffect: "resize", buffer: 2, sphericalMercator: true transitionEffect: "resize", buffer: 2, sphericalMercator: true,
attribution: "Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
}), }),
new OpenLayers.Layer.XYZ("OSM (without buffer)", urls, { new OpenLayers.Layer.XYZ("OSM (without buffer)", urls, {
transitionEffect: "resize", buffer: 0, sphericalMercator: true transitionEffect: "resize", buffer: 0, sphericalMercator: true,
attribution: "Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>"
}) })
], ],
controls: [ controls: [
+4 -3
View File
@@ -29,12 +29,13 @@ function init() {
var fid, points = [], feature; var fid, points = [], feature;
for (var i=0, len=e.features.length; i<len; i++) { for (var i=0, len=e.features.length; i<len; i++) {
feature = e.features[i]; feature = e.features[i];
if (feature.fid !== fid || i === len-1) { if ((fid && feature.fid !== fid) || i === len-1) {
fid = feature.fid;
this.addNodes(points, {silent: true}); this.addNodes(points, {silent: true});
points = []; points = [];
} else {
points.push(feature);
} }
points.push(feature); fid = feature.fid;
} }
return false; return false;
} }
+2 -2
View File
@@ -11,7 +11,7 @@ var map = new OpenLayers.Map({
"http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png" "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"
], ],
{ {
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>", attribution: "Data, imagery and map information provided by <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a>, <a href='http://www.openstreetmap.org/' target='_blank'>Open Street Map</a> and contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/' target='_blank'>CC-BY-SA</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize" transitionEffect: "resize"
} }
), ),
@@ -24,7 +24,7 @@ var map = new OpenLayers.Map({
"http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.png" "http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.png"
], ],
{ {
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>", attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a>. Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency. <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize" transitionEffect: "resize"
} }
) )
+1 -1
View File
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="style.mobile.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.mobile.css" type="text/css">
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<script src="../lib/OpenLayers.js?mobile"></script> <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-drawing.js"></script> <script src="mobile-drawing.js"></script>
+1 -1
View File
@@ -8,7 +8,7 @@
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css">
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<link rel="stylesheet" href="style.mobile.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.mobile.css" type="text/css">
<link rel="stylesheet" href="style.mobile-jq.css" type="text/css"> <link rel="stylesheet" href="style.mobile-jq.css" type="text/css">
<script src="../lib/OpenLayers.js?mobile"></script> <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-base.js"></script> <script src="mobile-base.js"></script>
+1 -1
View File
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="style.mobile.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.mobile.css" type="text/css">
<script src="../lib/OpenLayers.js?mobile"></script> <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-layers.js"></script> <script src="mobile-layers.js"></script>
<style> <style>
+1 -1
View File
@@ -6,7 +6,7 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<title>Mobile Navigation Example</title> <title>Mobile Navigation Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.mobile.css" type="text/css" /> <link rel="stylesheet" href="../theme/default/style.mobile.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="../lib/OpenLayers.js?mobile"></script> <script type="text/javascript" src="../lib/OpenLayers.js?mobile"></script>
<script type="text/javascript" src="mobile-navigation.js"></script> <script type="text/javascript" src="mobile-navigation.js"></script>
+1 -1
View File
@@ -6,7 +6,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>OpenLayers with Sencha Touch</title> <title>OpenLayers with Sencha Touch</title>
<script src="../lib/OpenLayers.js?mobile"></script> <script src="../lib/OpenLayers.js?mobile"></script>
<link rel="stylesheet" href="style.mobile.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.mobile.css" type="text/css">
<link rel="stylesheet" href="http://cdn.sencha.io/touch/1.1.0/resources/css/sencha-touch.css"> <link rel="stylesheet" href="http://cdn.sencha.io/touch/1.1.0/resources/css/sencha-touch.css">
<script src="http://cdn.sencha.io/touch/1.1.0/sencha-touch.js"></script> <script src="http://cdn.sencha.io/touch/1.1.0/sencha-touch.js"></script>
<script src="mobile-sencha.js"></script> <script src="mobile-sencha.js"></script>
+3 -3
View File
@@ -163,13 +163,13 @@ var map;
var doc = request.responseText, var doc = request.responseText,
caps = format.read(doc); caps = format.read(doc);
fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults( fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"fmzk", requestEncoding:"REST", transitionEffect:"resize"}, defaults {layer:"fmzk", transitionEffect:"resize"}, defaults
)); ));
aerial = format.createLayer(caps, OpenLayers.Util.applyDefaults( aerial = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"lb", requestEncoding:"REST", transitionEffect:"resize"}, defaults {layer:"lb", transitionEffect:"resize"}, defaults
)); ));
labels = format.createLayer(caps, OpenLayers.Util.applyDefaults( labels = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"beschriftung", requestEncoding:"REST", className:"nofade", isBaseLayer: false}, {layer:"beschriftung", className:"nofade", isBaseLayer: false},
defaults defaults
)); ));
map.addLayers([fmzk, aerial, labels]); map.addLayers([fmzk, aerial, labels]);
+1 -1
View File
@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="style.mobile.css" type="text/css"> <link rel="stylesheet" href="../theme/default/style.mobile.css" type="text/css">
<script src="../lib/OpenLayers.js?mobile"></script> <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile.js"></script> <script src="mobile.js"></script>
<style> <style>
+32
View File
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers OSM and Google Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="../lib/OpenLayers.js"></script>
<script src="osm-marker-popup.js"></script>
</head>
<body onload="init()">
<h1 id="title">OSM with Marker and Popup</h1>
<p id="shortdesc">
Demonstrate use of an OSM layer with a marker and a popup.
</p>
<div id="tags">
openstreetmap osm marker popup
</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
A common use case for OpenLayers is to display a marker at a
location on the map, and add some information in a popup. It
is also easy to add a tooltip with a short description.
See the <a href="osm-marker-popup.js" target="_blank">
osm-marker-popup.js source</a> to see how this is done.
</p>
</div>
</body>
</html>
+39
View File
@@ -0,0 +1,39 @@
var map;
function init() {
// The overlay layer for our marker, with a simple diamond as symbol
var overlay = new OpenLayers.Layer.Vector('Overlay', {
styleMap: new OpenLayers.StyleMap({
externalGraphic: '../img/marker.png',
graphicWidth: 20, graphicHeight: 24, graphicYOffset: -24,
title: '${tooltip}'
})
});
// The location of our marker and popup. We usually think in geographic
// coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
var myLocation = new OpenLayers.Geometry.Point(10.2, 48.9)
.transform('EPSG:4326', 'EPSG:3857');
// We add the marker with a tooltip text to the overlay
overlay.addFeatures([
new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
]);
// A popup with some information about our location
var popup = new OpenLayers.Popup.FramedCloud("Popup",
myLocation.getBounds().getCenterLonLat(), null,
'<a target="_blank" href="http://openlayers.org/">We</a> ' +
'could be here.<br>Or elsewhere.', null,
true // <-- true if we want a close (X) button, false otherwise
);
// Finally we create the map
map = new OpenLayers.Map({
div: "map", projection: "EPSG:3857",
layers: [new OpenLayers.Layer.OSM(), overlay],
center: myLocation.getBounds().getCenterLonLat(), zoom: 15
});
// and add the popup to it.
map.addPopup(popup);
}
+2 -4
View File
@@ -37,10 +37,8 @@
function init() { function init() {
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map');
var base = new OpenLayers.Layer.WMS("OpenLayers WMS", var base = new OpenLayers.Layer.WMS("OpenLayers WMS",
["http://t3.tilecache.osgeo.org/wms-c/Basic.py", "http://vmap0.tiles.osgeo.org/wms/vmap0",
"http://t2.tilecache.osgeo.org/wms-c/Basic.py", {layers: 'basic'}
"http://t1.tilecache.osgeo.org/wms-c/Basic.py"],
{layers: 'satellite'}
); );
var style = new OpenLayers.Style({ var style = new OpenLayers.Style({
+2 -1
View File
@@ -22,7 +22,8 @@
<div id="docs"> <div id="docs">
<p> <p>
This example shows the basic use of a vector layer with the This example shows the basic use of a vector layer with the
WFS protocol. WFS protocol, and shows how to switch between a WMS and a vector
layer at a certain scale.
</p> </p>
<p> <p>
See the <a href="wfs-states.js" target="_blank">wfs-states.js See the <a href="wfs-states.js" target="_blank">wfs-states.js
+6
View File
@@ -13,7 +13,13 @@ function init() {
"http://vmap0.tiles.osgeo.org/wms/vmap0", "http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: "basic"} {layers: "basic"}
), ),
new OpenLayers.Layer.WMS("States WMS",
"http://demo.opengeo.org/geoserver/wms",
{layers: "topp:states", format: "image/png", transparent: true},
{maxScale: 15000000}
),
new OpenLayers.Layer.Vector("States", { new OpenLayers.Layer.Vector("States", {
minScale: 15000000,
strategies: [new OpenLayers.Strategy.BBOX()], strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({ protocol: new OpenLayers.Protocol.WFS({
url: "http://demo.opengeo.org/geoserver/wfs", url: "http://demo.opengeo.org/geoserver/wfs",
-1
View File
@@ -55,5 +55,4 @@ function init() {
map.addLayer(osm); map.addLayer(osm);
map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(-13677832, 5213272), 13); map.setCenter(new OpenLayers.LonLat(-13677832, 5213272), 13);
} }
+2 -1
View File
@@ -132,6 +132,7 @@
jsFiles = [ jsFiles = [
"OpenLayers/BaseTypes/Class.js", "OpenLayers/BaseTypes/Class.js",
"OpenLayers/Util.js", "OpenLayers/Util.js",
"OpenLayers/Util/vendorPrefix.js",
"OpenLayers/Animation.js", "OpenLayers/Animation.js",
"OpenLayers/BaseTypes.js", "OpenLayers/BaseTypes.js",
"OpenLayers/BaseTypes/Bounds.js", "OpenLayers/BaseTypes/Bounds.js",
@@ -414,4 +415,4 @@
/** /**
* Constant: VERSION_NUMBER * Constant: VERSION_NUMBER
*/ */
OpenLayers.VERSION_NUMBER="Release 2.12-rc5"; OpenLayers.VERSION_NUMBER="Release 2.13 dev";
+4 -10
View File
@@ -5,6 +5,7 @@
* full text of the license. * full text of the license.
* *
* @requires OpenLayers/SingleFile.js * @requires OpenLayers/SingleFile.js
* @requires OpenLayers/Util/vendorPrefix.js
*/ */
/** /**
@@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
* Property: isNative * Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available * {Boolean} true if a native requestAnimationFrame function is available
*/ */
var isNative = !!(window.requestAnimationFrame || var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
window.webkitRequestAnimationFrame || var isNative = !!(requestAnimationFrame);
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame);
/** /**
* Function: requestFrame * Function: requestFrame
@@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
* element - {DOMElement} Optional element that visually bounds the animation. * element - {DOMElement} Optional element that visually bounds the animation.
*/ */
var requestFrame = (function() { var requestFrame = (function() {
var request = window.requestAnimationFrame || var request = window[requestAnimationFrame] ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback, element) { function(callback, element) {
window.setTimeout(callback, 16); window.setTimeout(callback, 16);
}; };
@@ -75,6 +75,14 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
*/ */
defaultKeyPress: function (evt) { defaultKeyPress: function (evt) {
var size, handled = true; var size, handled = true;
if((typeof evt.target) != 'undefined' &&
(evt.target.tagName == 'INPUT' ||
evt.target.tagName == 'TEXTAREA' ||
evt.target.tagName == 'SELECT')) {
return;
}
switch(evt.keyCode) { switch(evt.keyCode) {
case OpenLayers.Event.KEY_LEFT: case OpenLayers.Event.KEY_LEFT:
this.map.pan(-this.slideFactor, 0); this.map.pan(-this.slideFactor, 0);
+3
View File
@@ -7,6 +7,9 @@
* @requires OpenLayers/Control.js * @requires OpenLayers/Control.js
* @requires OpenLayers/BaseTypes.js * @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Events/buttonclick.js * @requires OpenLayers/Events/buttonclick.js
* @requires OpenLayers/Map.js
* @requires OpenLayers/Handler/Click.js
* @requires OpenLayers/Handler/Drag.js
*/ */
/** /**
+9 -3
View File
@@ -99,6 +99,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.un({ this.map.events.un({
"changebaselayer": this.redraw, "changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this scope: this
}); });
@@ -116,7 +117,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
*/ */
setMap: function(map) { setMap: function(map) {
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments); OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
this.map.events.register("changebaselayer", this, this.redraw); this.map.events.on({
"changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this
});
}, },
/** /**
@@ -189,6 +194,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
_addZoomBar:function(centered) { _addZoomBar:function(centered) {
var imgLocation = OpenLayers.Util.getImageLocation("slider.png"); var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
var id = this.id + "_" + this.map.id; var id = this.id + "_" + this.map.id;
var minZoom = this.map.getMinZoom();
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom(); var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
var slider = OpenLayers.Util.createAlphaImageDiv(id, var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1, zoomsToEnd * this.zoomStopHeight), centered.add(-1, zoomsToEnd * this.zoomStopHeight),
@@ -211,7 +217,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
var sz = { var sz = {
w: this.zoomStopWidth, w: this.zoomStopWidth,
h: this.zoomStopHeight * this.map.getNumZoomLevels() h: this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom)
}; };
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png"); var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
var div = null; var div = null;
@@ -242,7 +248,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.register("zoomend", this, this.moveZoomBar); this.map.events.register("zoomend", this, this.moveZoomBar);
centered = centered.add(0, centered = centered.add(0,
this.zoomStopHeight * this.map.getNumZoomLevels()); this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom));
return centered; return centered;
}, },
+5 -2
View File
@@ -4,6 +4,7 @@
* full text of the license. */ * full text of the license. */
/** /**
* @requires OpenLayers/Util/vendorPrefix.js
* @requires OpenLayers/Handler/Pinch.js * @requires OpenLayers/Handler/Pinch.js
*/ */
@@ -162,8 +163,10 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
*/ */
applyTransform: function(transform) { applyTransform: function(transform) {
var style = this.map.layerContainerDiv.style; var style = this.map.layerContainerDiv.style;
style['-webkit-transform'] = transform; var transformProperty = OpenLayers.Util.vendorPrefix.style("transform");
style['-moz-transform'] = transform; if (transformProperty) {
style[transformProperty] = transform;
}
}, },
/** /**
+1 -1
View File
@@ -124,7 +124,7 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, {
* objects below. If the items in the targets list are vector layers * objects below. If the items in the targets list are vector layers
* (instead of configuration objects), the defaults from the <defaults> * (instead of configuration objects), the defaults from the <defaults>
* property will apply. The editable layer itself may be a target * property will apply. The editable layer itself may be a target
* layer - allowing newly created or edited features to be snapped to * layer, allowing newly created or edited features to be snapped to
* existing features from the same layer. If no targets are provided * existing features from the same layer. If no targets are provided
* the layer given in the constructor (as <layer>) will become the * the layer given in the constructor (as <layer>) will become the
* initial target. * initial target.
+1 -1
View File
@@ -240,7 +240,7 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, {
var deactivated = OpenLayers.Control.prototype.deactivate.call(this); var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
if(deactivated) { if(deactivated) {
if(this.source && this.source.events) { if(this.source && this.source.events) {
this.layer.events.un({ this.source.events.un({
sketchcomplete: this.onSketchComplete, sketchcomplete: this.onSketchComplete,
afterfeaturemodified: this.afterFeatureModified, afterfeaturemodified: this.afterFeatureModified,
scope: this scope: this
+2 -2
View File
@@ -37,9 +37,9 @@ OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIProperty: zoomOutText * APIProperty: zoomOutText
* {String} * {String}
* Text for zoom-out link. Default is "-". * Text for zoom-out link. Default is "\u2212".
*/ */
zoomOutText: "-", zoomOutText: "\u2212",
/** /**
* APIProperty: zoomOutId * APIProperty: zoomOutId
+10 -2
View File
@@ -41,10 +41,18 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
/** /**
* APIProperty: alwaysZoom * APIProperty: alwaysZoom
* {Boolean} Always zoom in/out, when box drawed * {Boolean} Always zoom in/out when box drawn, even if the zoom level does
* not change.
*/ */
alwaysZoom: false, alwaysZoom: false,
/**
* APIProperty: zoomOnClick
* {Boolean} Should we zoom when no box was dragged, i.e. the user only
* clicked? Default is true.
*/
zoomOnClick: true,
/** /**
* Method: draw * Method: draw
*/ */
@@ -93,7 +101,7 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){ if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
this.map.zoomTo(lastZoom + (this.out ? -1 : 1)); this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
} }
} else { // it's a pixel } else if (this.zoomOnClick) { // it's a pixel
if (!this.out) { if (!this.out) {
this.map.setCenter(this.map.getLonLatFromPixel(position), this.map.setCenter(this.map.getLonLatFromPixel(position),
this.map.getZoom() + 1); this.map.getZoom() + 1);
+17 -5
View File
@@ -167,11 +167,7 @@ OpenLayers.Event = {
stop: function(event, allowDefault) { stop: function(event, allowDefault) {
if (!allowDefault) { if (!allowDefault) {
if (event.preventDefault) { OpenLayers.Event.preventDefault(event);
event.preventDefault();
} else {
event.returnValue = false;
}
} }
if (event.stopPropagation) { if (event.stopPropagation) {
@@ -181,6 +177,22 @@ OpenLayers.Event = {
} }
}, },
/**
* Method: preventDefault
* Cancels the event if it is cancelable, without stopping further
* propagation of the event.
*
* Parameters:
* event - {Event}
*/
preventDefault: function(event) {
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
},
/** /**
* Method: findElement * Method: findElement
* *
+21
View File
@@ -122,6 +122,26 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
return button; return button;
}, },
/**
* Method: ignore
* Check for event target elements that should be ignored by OpenLayers.
*
* Parameters:
* element - {DOMElement} The event target.
*/
ignore: function(element) {
var depth = 3,
ignore = false;
do {
if (element.nodeName.toLowerCase() === 'a') {
ignore = true;
break;
}
element = element.parentNode;
} while (--depth > 0 && element);
return ignore;
},
/** /**
* Method: buttonClick * Method: buttonClick
* Check if a button was clicked, and fire the buttonclick event * Check if a button was clicked, and fire the buttonclick event
@@ -170,6 +190,7 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
propagate = false; propagate = false;
} }
} else { } else {
propagate = !this.ignore(OpenLayers.Event.element(evt));
delete this.startEvt; delete this.startEvt;
} }
} }
+10
View File
@@ -241,6 +241,9 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
*/ */
readers: { readers: {
"gml": { "gml": {
"_inherit": function(node, obj, container) {
// To be implemented by version specific parsers
},
"featureMember": function(node, obj) { "featureMember": function(node, obj) {
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
}, },
@@ -309,6 +312,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"MultiPoint": function(node, container) { "MultiPoint": function(node, container) {
var obj = {components: []}; var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
container.components = [ container.components = [
new OpenLayers.Geometry.MultiPoint(obj.components) new OpenLayers.Geometry.MultiPoint(obj.components)
@@ -319,6 +323,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"LineString": function(node, container) { "LineString": function(node, container) {
var obj = {}; var obj = {};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
if(!container.components) { if(!container.components) {
container.components = []; container.components = [];
@@ -329,6 +334,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"MultiLineString": function(node, container) { "MultiLineString": function(node, container) {
var obj = {components: []}; var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
container.components = [ container.components = [
new OpenLayers.Geometry.MultiLineString(obj.components) new OpenLayers.Geometry.MultiLineString(obj.components)
@@ -339,6 +345,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"Polygon": function(node, container) { "Polygon": function(node, container) {
var obj = {outer: null, inner: []}; var obj = {outer: null, inner: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
obj.inner.unshift(obj.outer); obj.inner.unshift(obj.outer);
if(!container.components) { if(!container.components) {
@@ -350,6 +357,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"LinearRing": function(node, obj) { "LinearRing": function(node, obj) {
var container = {}; var container = {};
this.readers.gml._inherit.apply(this, [node, container]);
this.readChildNodes(node, container); this.readChildNodes(node, container);
obj.components = [new OpenLayers.Geometry.LinearRing( obj.components = [new OpenLayers.Geometry.LinearRing(
container.points container.points
@@ -357,6 +365,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"MultiPolygon": function(node, container) { "MultiPolygon": function(node, container) {
var obj = {components: []}; var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
container.components = [ container.components = [
new OpenLayers.Geometry.MultiPolygon(obj.components) new OpenLayers.Geometry.MultiPolygon(obj.components)
@@ -367,6 +376,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}, },
"GeometryCollection": function(node, container) { "GeometryCollection": function(node, container) {
var obj = {components: []}; var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
container.components = [ container.components = [
new OpenLayers.Geometry.Collection(obj.components) new OpenLayers.Geometry.Collection(obj.components)
+14 -1
View File
@@ -90,11 +90,20 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
*/ */
readers: { readers: {
"gml": OpenLayers.Util.applyDefaults({ "gml": OpenLayers.Util.applyDefaults({
"_inherit": function(node, obj, container) {
// SRSReferenceGroup attributes
var dim = parseInt(node.getAttribute("srsDimension"), 10) ||
(container && container.srsDimension);
if (dim) {
obj.srsDimension = dim;
}
},
"featureMembers": function(node, obj) { "featureMembers": function(node, obj) {
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
}, },
"Curve": function(node, container) { "Curve": function(node, container) {
var obj = {points: []}; var obj = {points: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
if(!container.components) { if(!container.components) {
container.components = []; container.components = [];
@@ -135,7 +144,9 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
this.regExes.trimSpace, "" this.regExes.trimSpace, ""
); );
var coords = str.split(this.regExes.splitSpace); var coords = str.split(this.regExes.splitSpace);
var dim = parseInt(node.getAttribute("dimension")) || 2; // The "dimension" attribute is from the GML 3.0.1 spec.
var dim = obj.srsDimension ||
parseInt(node.getAttribute("srsDimension") || node.getAttribute("dimension"), 10) || 2;
var j, x, y, z; var j, x, y, z;
var numPoints = coords.length / dim; var numPoints = coords.length / dim;
var points = new Array(numPoints); var points = new Array(numPoints);
@@ -172,6 +183,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
}, },
"MultiCurve": function(node, container) { "MultiCurve": function(node, container) {
var obj = {components: []}; var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
if(obj.components.length > 0) { if(obj.components.length > 0) {
container.components = [ container.components = [
@@ -184,6 +196,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
}, },
"MultiSurface": function(node, container) { "MultiSurface": function(node, container) {
var obj = {components: []}; var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
if(obj.components.length > 0) { if(obj.components.length > 0) {
container.components = [ container.components = [
@@ -5,6 +5,7 @@
/** /**
* @requires OpenLayers/Format/XML.js * @requires OpenLayers/Format/XML.js
* @requires OpenLayers/Format/OGCExceptionReport.js
*/ */
/** /**
@@ -187,8 +188,13 @@ OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class(
data = data.documentElement; data = data.documentElement;
} }
var schema = {}; var schema = {};
this.readNode(data, schema); if (data.nodeName.split(":").pop() === 'ExceptionReport') {
// an exception must have occurred, so parse it
var parser = new OpenLayers.Format.OGCExceptionReport();
schema.error = parser.read(data);
} else {
this.readNode(data, schema);
}
return schema; return schema;
}, },
+93 -30
View File
@@ -68,7 +68,12 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
* *
* Required config properties: * Required config properties:
* layer - {String} The layer identifier. * layer - {String} The layer identifier.
* matrixSet - {String} The matrix set identifier. *
* Optional config properties:
* matrixSet - {String} The matrix set identifier, required if there is
* more than one matrix set in the layer capabilities.
* style - {String} The name of the style
* param - {Object} The dimensions values eg: {"Year": "2012"}
* *
* Returns: * Returns:
* {<OpenLayers.Layer.WMTS>} A properly configured WMTS layer. Throws an * {<OpenLayers.Layer.WMTS>} A properly configured WMTS layer. Throws an
@@ -79,18 +84,11 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
var layer; var layer;
// confirm required properties are supplied in config // confirm required properties are supplied in config
var required = { if (!('layer' in config)) {
layer: true, throw new Error("Missing property 'layer' in configuration.");
matrixSet: true
};
for (var prop in required) {
if (!(prop in config)) {
throw new Error("Missing property '" + prop + "' in layer configuration.");
}
} }
var contents = capabilities.contents; var contents = capabilities.contents;
var matrixSet = contents.tileMatrixSets[config.matrixSet];
// find the layer definition with the given identifier // find the layer definition with the given identifier
var layers = contents.layers; var layers = contents.layers;
@@ -101,30 +99,95 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
break; break;
} }
} }
if (!layerDef) {
throw new Error("Layer not found");
}
if (layerDef && matrixSet) { // find the matrixSet definition
// get the default style for the layer var matrixSet;
var style; if (config.matrixSet) {
for (var i=0, ii=layerDef.styles.length; i<ii; ++i) { matrixSet = contents.tileMatrixSets[config.matrixSet];
style = layerDef.styles[i]; } else if (layerDef.tileMatrixSetLinks.length == 1) {
if (style.isDefault) { matrixSet = contents.tileMatrixSets[
break; layerDef.tileMatrixSetLinks[0].tileMatrixSet];
}
if (!matrixSet) {
throw new Error("matrixSet not found");
}
// get the default style for the layer
var style;
for (var i=0, ii=layerDef.styles.length; i<ii; ++i) {
style = layerDef.styles[i];
if (style.isDefault) {
break;
}
}
var requestEncoding = config.requestEncoding;
if (!requestEncoding) {
requestEncoding = "KVP";
if (capabilities.operationsMetadata.GetTile.dcp.http) {
var http = capabilities.operationsMetadata.GetTile.dcp.http;
// Get first get method
if (http.get[0].constraints) {
var constraints = http.get[0].constraints;
if (!constraints.GetEncoding.allowedValues.KVP &&
constraints.GetEncoding.allowedValues.REST) {
requestEncoding = "REST";
}
} }
} }
layer = new OpenLayers.Layer.WMTS(
OpenLayers.Util.applyDefaults(config, {
url: config.requestEncoding === "REST" && layerDef.resourceUrl ?
layerDef.resourceUrl.tile.template :
capabilities.operationsMetadata.GetTile.dcp.http.get[0].url,
name: layerDef.title,
style: style.identifier,
matrixIds: matrixSet.matrixIds,
tileFullExtent: matrixSet.bounds
})
);
} }
return layer;
var dimensions = [];
var params = config.params || {};
// to don't overwrite the changes in the applyDefaults
delete config.params;
for (var id = 0, ld = layerDef.dimensions.length ; id < ld ; id++) {
var dimension = layerDef.dimensions[id];
dimensions.push(dimension.identifier);
if (!params.hasOwnProperty(dimension.identifier)) {
params[dimension.identifier] = dimension['default'];
}
}
var projection = config.projection || matrixSet.supportedCRS.replace(
/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3");
var units = config.units ||
(projection === "EPSG:4326" ? "degrees" : "m");
var resolutions = [];
if (config.isBaseLayer !== false) {
for (var mid in matrixSet.matrixIds) {
if (matrixSet.matrixIds.hasOwnProperty(mid)) {
resolutions.push(
matrixSet.matrixIds[mid].scaleDenominator * 0.28E-3 /
OpenLayers.METERS_PER_INCH /
OpenLayers.INCHES_PER_UNIT[units]);
}
}
}
return new OpenLayers.Layer.WMTS(
OpenLayers.Util.applyDefaults(config, {
url: requestEncoding === "REST" && layerDef.resourceUrl ?
layerDef.resourceUrl.tile.template :
capabilities.operationsMetadata.GetTile.dcp.http.get[0].url,
requestEncoding: requestEncoding,
name: layerDef.title,
style: style.identifier,
matrixIds: matrixSet.matrixIds,
matrixSet: matrixSet.identifier,
projection: projection,
units: units,
resolutions: config.isBaseLayer === false ? undefined :
resolutions,
tileFullExtent: matrixSet.bounds,
dimensions: dimensions,
params: params
})
);
}, },
CLASS_NAME: "OpenLayers.Format.WMTSCapabilities" CLASS_NAME: "OpenLayers.Format.WMTSCapabilities"
@@ -127,6 +127,10 @@ OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(
output.complexOutput = {}; output.complexOutput = {};
this.readChildNodes(node, output.complexOutput); this.readChildNodes(node, output.complexOutput);
}, },
"LiteralOutput": function(node, output) {
output.literalOutput = {};
this.readChildNodes(node, output.literalOutput);
},
"Input": function(node, dataInputs) { "Input": function(node, dataInputs) {
var input = { var input = {
maxOccurs: parseInt(node.getAttribute("maxOccurs")), maxOccurs: parseInt(node.getAttribute("maxOccurs")),
+136 -4
View File
@@ -93,6 +93,28 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
return OpenLayers.Format.XML.prototype.write.apply(this, [node]); return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
}, },
/**
* APIMethod: read
* Parse a WPS Execute and return an object with its information.
*
* Parameters:
* data - {String} or {DOMElement} data to read/parse.
*
* Returns:
* {Object}
*/
read: function(data) {
if(typeof data == "string") {
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
}
if(data && data.nodeType == 9) {
data = data.documentElement;
}
var info = {};
this.readNode(data, info);
return info;
},
/** /**
* Property: writers * Property: writers
* As a compliment to the readers property, this structure contains public * As a compliment to the readers property, this structure contains public
@@ -131,15 +153,20 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
status: responseDocument.status status: responseDocument.status
} }
}); });
if (responseDocument.output) { if (responseDocument.outputs) {
this.writeNode("wps:Output", responseDocument.output, node); for (var i = 0, len = responseDocument.outputs.length; i < len; i++) {
this.writeNode("wps:Output", responseDocument.outputs[i], node);
}
} }
return node; return node;
}, },
"Output": function(output) { "Output": function(output) {
var node = this.createElementNSPlus("wps:Output", { var node = this.createElementNSPlus("wps:Output", {
attributes: { attributes: {
asReference: output.asReference asReference: output.asReference,
mimeType: output.mimeType,
encoding: output.encoding,
schema: output.schema
} }
}); });
this.writeNode("ows:Identifier", output.identifier, node); this.writeNode("ows:Identifier", output.identifier, node);
@@ -150,7 +177,9 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
"RawDataOutput": function(rawDataOutput) { "RawDataOutput": function(rawDataOutput) {
var node = this.createElementNSPlus("wps:RawDataOutput", { var node = this.createElementNSPlus("wps:RawDataOutput", {
attributes: { attributes: {
mimeType: rawDataOutput.mimeType mimeType: rawDataOutput.mimeType,
encoding: rawDataOutput.encoding,
schema: rawDataOutput.schema
} }
}); });
this.writeNode("ows:Identifier", rawDataOutput.identifier, node); this.writeNode("ows:Identifier", rawDataOutput.identifier, node);
@@ -186,6 +215,8 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
this.writeNode("wps:LiteralData", data.literalData, node); this.writeNode("wps:LiteralData", data.literalData, node);
} else if (data.complexData) { } else if (data.complexData) {
this.writeNode("wps:ComplexData", data.complexData, node); this.writeNode("wps:ComplexData", data.complexData, node);
} else if (data.boundingBoxData) {
this.writeNode("ows:BoundingBox", data.boundingBoxData, node);
} }
return node; return node;
}, },
@@ -257,6 +288,107 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows "ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows
}, },
/**
* Property: readers
* Contains public functions, grouped by namespace prefix, that will
* be applied when a namespaced node is found matching the function
* name. The function will be applied in the scope of this parser
* with two arguments: the node being read and a context object passed
* from the parent.
*/
readers: {
"wps": {
"ExecuteResponse": function(node, obj) {
obj.executeResponse = {
lang: node.getAttribute("lang"),
statusLocation: node.getAttribute("statusLocation"),
serviceInstance: node.getAttribute("serviceInstance"),
service: node.getAttribute("service")
};
this.readChildNodes(node, obj.executeResponse);
},
"Process":function(node,obj) {
obj.process = {};
this.readChildNodes(node, obj.process);
},
"Status":function(node,obj) {
obj.status = {
creationTime: node.getAttribute("creationTime")
};
this.readChildNodes(node, obj.status);
},
"ProcessSucceeded": function(node,obj) {
obj.processSucceeded = true;
},
"ProcessOutputs": function(node, processDescription) {
processDescription.processOutputs = [];
this.readChildNodes(node, processDescription.processOutputs);
},
"Output": function(node, processOutputs) {
var output = {};
this.readChildNodes(node, output);
processOutputs.push(output);
},
"Reference": function(node, output) {
output.reference = {
href: node.getAttribute("href"),
mimeType: node.getAttribute("mimeType"),
encoding: node.getAttribute("encoding"),
schema: node.getAttribute("schema")
};
},
"Data": function(node, output) {
output.data = {};
this.readChildNodes(node, output);
},
"LiteralData": function(node, output) {
output.literalData = {
dataType: node.getAttribute("dataType"),
uom: node.getAttribute("uom"),
value: this.getChildValue(node)
};
},
"ComplexData": function(node, output) {
output.complexData = {
mimeType: node.getAttribute("mimeType"),
schema: node.getAttribute("schema"),
encoding: node.getAttribute("encoding"),
value: ""
};
// try to get *some* value, ignore the empty text values
if (this.isSimpleContent(node)) {
var child;
for(child=node.firstChild; child; child=child.nextSibling) {
switch(child.nodeType) {
case 3: // text node
case 4: // cdata section
output.complexData.value += child.nodeValue;
}
}
}
else {
for(child=node.firstChild; child; child=child.nextSibling) {
if (child.nodeType == 1) {
output.complexData.value = child;
}
}
}
},
"BoundingBox": function(node, output) {
output.boundingBoxData = {
dimensions: node.getAttribute("dimensions"),
crs: node.getAttribute("crs")
};
this.readChildNodes(node, output.boundingBoxData);
}
},
// TODO: we should add Exception parsing here
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
},
CLASS_NAME: "OpenLayers.Format.WPSExecute" CLASS_NAME: "OpenLayers.Format.WPSExecute"
}); });
+2 -1
View File
@@ -172,7 +172,8 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
this.down(evt); this.down(evt);
this.callback("down", [evt.xy]); this.callback("down", [evt.xy]);
OpenLayers.Event.stop(evt); // prevent document dragging
OpenLayers.Event.preventDefault(evt);
if(!this.oldOnselectstart) { if(!this.oldOnselectstart) {
this.oldOnselectstart = document.onselectstart ? this.oldOnselectstart = document.onselectstart ?
+1 -1
View File
@@ -103,7 +103,7 @@ OpenLayers.Handler.Pinch = OpenLayers.Class(OpenLayers.Handler, {
this.last = null; this.last = null;
} }
// prevent document dragging // prevent document dragging
OpenLayers.Event.stop(evt); OpenLayers.Event.preventDefault(evt);
return propagate; return propagate;
}, },
+3 -1
View File
@@ -87,7 +87,9 @@ OpenLayers.Layer = OpenLayers.Class({
* *
* Supported map event types: * Supported map event types:
* loadstart - Triggered when layer loading starts. * loadstart - Triggered when layer loading starts.
* loadend - Triggered when layer loading ends. * loadend - Triggered when layer loading ends. When using Fixed or BBOX
* strategies, the event object includes a *response* property holding
* an OpenLayers.Protocol.Response object.
* visibilitychanged - Triggered when layer visibility is changed. * visibilitychanged - Triggered when layer visibility is changed.
* move - Triggered when layer moves (triggered with every mousemove * move - Triggered when layer moves (triggered with every mousemove
* during a drag). * during a drag).
+1 -1
View File
@@ -13,7 +13,7 @@
* This Layer reads from UTFGrid tiled data sources. Since UTFGrids are * This Layer reads from UTFGrid tiled data sources. Since UTFGrids are
* essentially JSON-based ASCII art with attached attributes, they are not * essentially JSON-based ASCII art with attached attributes, they are not
* visibly rendered. In order to use them in the map, you must add a * visibly rendered. In order to use them in the map, you must add a
* <OpenLayers.Control.UTFGrid> ontrol as well. * <OpenLayers.Control.UTFGrid> control as well.
* *
* Example: * Example:
* *
+1
View File
@@ -106,6 +106,7 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
* *
* Matrix properties: * Matrix properties:
* identifier - {String} The matrix identifier (required). * identifier - {String} The matrix identifier (required).
* scaleDenominator - {Number} The matrix scale denominator.
* topLeftCorner - {<OpenLayers.LonLat>} The top left corner of the * topLeftCorner - {<OpenLayers.LonLat>} The top left corner of the
* matrix. Must be provided if different than the layer <tileOrigin>. * matrix. Must be provided if different than the layer <tileOrigin>.
* tileWidth - {Number} The tile width for the matrix. Must be provided * tileWidth - {Number} The tile width for the matrix. Must be provided
+10 -5
View File
@@ -105,6 +105,7 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
initializeZoomify: function( size ) { initializeZoomify: function( size ) {
var imageSize = size.clone(); var imageSize = size.clone();
this.size = size.clone();
var tiles = new OpenLayers.Size( var tiles = new OpenLayers.Size(
Math.ceil( imageSize.w / this.standardTileSize ), Math.ceil( imageSize.w / this.standardTileSize ),
Math.ceil( imageSize.h / this.standardTileSize ) Math.ceil( imageSize.h / this.standardTileSize )
@@ -132,14 +133,18 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
this.tierImageSize.reverse(); this.tierImageSize.reverse();
this.numberOfTiers = this.tierSizeInTiles.length; this.numberOfTiers = this.tierSizeInTiles.length;
var resolutions = [1];
this.tileCountUpToTier = [0]; this.tileCountUpToTier = [0];
for (var i = 1; i < this.numberOfTiers; i++) { for (var i = 1; i < this.numberOfTiers; i++) {
resolutions.unshift(Math.pow(2, i));
this.tileCountUpToTier.push( this.tileCountUpToTier.push(
this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h + this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h +
this.tileCountUpToTier[i-1] this.tileCountUpToTier[i-1]
); );
} }
if (!this.serverResolutions) {
this.serverResolutions = resolutions;
}
}, },
/** /**
@@ -195,10 +200,10 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
*/ */
getURL: function (bounds) { getURL: function (bounds) {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
var res = this.map.getResolution(); var res = this.getServerResolution();
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w)); var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h)); var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom(); var z = this.getZoomForResolution( res );
var tileIndex = x + y * this.tierSizeInTiles[z].w + this.tileCountUpToTier[z]; var tileIndex = x + y * this.tierSizeInTiles[z].w + this.tileCountUpToTier[z];
var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) + var path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
@@ -219,10 +224,10 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
getImageSize: function() { getImageSize: function() {
if (arguments.length > 0) { if (arguments.length > 0) {
var bounds = this.adjustBounds(arguments[0]); var bounds = this.adjustBounds(arguments[0]);
var res = this.map.getResolution(); var res = this.getServerResolution();
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w)); var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h)); var y = Math.round((this.tileOrigin.lat - bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom(); var z = this.getZoomForResolution( res );
var w = this.standardTileSize; var w = this.standardTileSize;
var h = this.standardTileSize; var h = this.standardTileSize;
if (x == this.tierSizeInTiles[z].w -1 ) { if (x == this.tierSizeInTiles[z].w -1 ) {
+49 -25
View File
@@ -83,6 +83,7 @@ OpenLayers.Map = OpenLayers.Class({
* mouseout - triggered after mouseout the map * mouseout - triggered after mouseout the map
* mousemove - triggered after mousemove the map * mousemove - triggered after mousemove the map
* changebaselayer - triggered after the base layer changes * changebaselayer - triggered after the base layer changes
* updatesize - triggered after the <updateSize> method was executed
*/ */
/** /**
@@ -376,6 +377,13 @@ OpenLayers.Map = OpenLayers.Class({
*/ */
fallThrough: true, fallThrough: true,
/**
* APIProperty: autoUpdateSize
* {Boolean} Should OpenLayers automatically update the size of the map
* when the resize event is fired. Default is true.
*/
autoUpdateSize: true,
/** /**
* Property: panTween * Property: panTween
* {<OpenLayers.Tween>} Animated panning tween object, see panTo() * {<OpenLayers.Tween>} Animated panning tween object, see panTo()
@@ -578,15 +586,10 @@ OpenLayers.Map = OpenLayers.Class({
this.events.on(this.eventListeners); this.events.on(this.eventListeners);
} }
// Because Mozilla does not support the "resize" event for elements if (this.autoUpdateSize === true) {
// other than "window", we need to put a hack here. // updateSize on catching the window's resize
if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 9) { // Note that this is ok, as updateSize() does nothing if the
// If IE < 9, register the resize on the div // map's size has not actually changed.
this.events.register("resize", this, this.updateSize);
} else {
// Else updateSize on catching the window's resize
// Note that this is ok, as updateSize() does nothing if the
// map's size has not actually changed.
this.updateSizeDestroy = OpenLayers.Function.bind(this.updateSize, this.updateSizeDestroy = OpenLayers.Function.bind(this.updateSize,
this); this);
OpenLayers.Event.observe(window, 'resize', OpenLayers.Event.observe(window, 'resize',
@@ -746,8 +749,6 @@ OpenLayers.Map = OpenLayers.Class({
if (this.updateSizeDestroy) { if (this.updateSizeDestroy) {
OpenLayers.Event.stopObserving(window, 'resize', OpenLayers.Event.stopObserving(window, 'resize',
this.updateSizeDestroy); this.updateSizeDestroy);
} else {
this.events.unregister("resize", this, this.updateSize);
} }
this.paddingForPopups = null; this.paddingForPopups = null;
@@ -1490,6 +1491,7 @@ OpenLayers.Map = OpenLayers.Class({
} }
} }
this.events.triggerEvent("updatesize");
}, },
/** /**
@@ -1784,19 +1786,43 @@ OpenLayers.Map = OpenLayers.Class({
* <baseLayer>'s maxExtent. * <baseLayer>'s maxExtent.
*/ */
adjustZoom: function(zoom) { adjustZoom: function(zoom) {
var resolution, resolutions = this.baseLayer.resolutions, if (this.baseLayer && this.baseLayer.wrapDateLine) {
maxResolution = this.getMaxExtent().getWidth() / this.size.w; var resolution, resolutions = this.baseLayer.resolutions,
if (this.getResolutionForZoom(zoom) > maxResolution) { maxResolution = this.getMaxExtent().getWidth() / this.size.w;
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) { if (this.getResolutionForZoom(zoom) > maxResolution) {
if (resolutions[i] <= maxResolution) { if (this.fractionalZoom) {
zoom = i; zoom = this.getZoomForResolution(maxResolution);
break; } else {
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) {
if (resolutions[i] <= maxResolution) {
zoom = i;
break;
}
}
} }
} }
} }
return zoom; return zoom;
}, },
/**
* APIMethod: getMinZoom
* Returns the minimum zoom level for the current map view. If the base
* layer is configured with <wrapDateLine> set to true, this will be the
* first zoom level that shows no more than one world width in the current
* map viewport. Components that rely on this value (e.g. zoom sliders)
* should also listen to the map's "updatesize" event and call this method
* in the "updatesize" listener.
*
* Returns:
* {Number} Minimum zoom level that shows a map not wider than its
* <baseLayer>'s maxExtent. This is an Integer value, unless the map is
* configured with <fractionalZoom> set to true.
*/
getMinZoom: function() {
return this.adjustZoom(0);
},
/** /**
* Method: moveTo * Method: moveTo
* *
@@ -1818,13 +1844,11 @@ OpenLayers.Map = OpenLayers.Class({
zoom = Math.round(zoom); zoom = Math.round(zoom);
} }
} }
if (this.baseLayer.wrapDateLine) { var requestedZoom = zoom;
var requestedZoom = zoom; zoom = this.adjustZoom(zoom);
zoom = this.adjustZoom(zoom); if (zoom !== requestedZoom) {
if (zoom !== requestedZoom) { // zoom was adjusted, so keep old lonlat to avoid panning
// zoom was adjusted, so keep old lonlat to avoid panning lonlat = this.getCenter();
lonlat = this.getCenter();
}
} }
// dragging is false by default // dragging is false by default
var dragging = options.dragging || this.dragging; var dragging = options.dragging || this.dragging;
+1 -1
View File
@@ -694,7 +694,7 @@ OpenLayers.Popup = OpenLayers.Class({
} }
OpenLayers.Event.stopObserving( OpenLayers.Event.stopObserving(
this.img, "load", this.img._onImageLoad this.img, "load", this.img._onImgLoad
); );
}; };
+2 -2
View File
@@ -62,7 +62,7 @@ OpenLayers.Projection = OpenLayers.Class({
initialize: function(projCode, options) { initialize: function(projCode, options) {
OpenLayers.Util.extend(this, options); OpenLayers.Util.extend(this, options);
this.projCode = projCode; this.projCode = projCode;
if (window.Proj4js) { if (typeof Proj4js == "object") {
this.proj = new Proj4js.Proj(projCode); this.proj = new Proj4js.Proj(projCode);
} }
}, },
@@ -115,7 +115,7 @@ OpenLayers.Projection = OpenLayers.Class({
if (!(p instanceof OpenLayers.Projection)) { if (!(p instanceof OpenLayers.Projection)) {
p = new OpenLayers.Projection(p); p = new OpenLayers.Projection(p);
} }
if (window.Proj4js && this.proj.defData && p.proj.defData) { if ((typeof Proj4js == "object") && this.proj.defData && p.proj.defData) {
equals = this.proj.defData.replace(this.titleRegEx, "") == equals = this.proj.defData.replace(this.titleRegEx, "") ==
p.proj.defData.replace(this.titleRegEx, ""); p.proj.defData.replace(this.titleRegEx, "");
} else if (p.getCode) { } else if (p.getCode) {
+3 -2
View File
@@ -284,7 +284,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
node.setAttributeNS(null, "height", height); node.setAttributeNS(null, "height", height);
node.setAttributeNS(this.xlinkns, "href", style.externalGraphic); node.setAttributeNS(this.xlinkns, "href", style.externalGraphic);
node.setAttributeNS(null, "style", "opacity: "+opacity); node.setAttributeNS(null, "style", "opacity: "+opacity);
node.onclick = OpenLayers.Renderer.SVG.preventDefault; node.onclick = OpenLayers.Event.preventDefault;
} else if (this.isComplexSymbol(style.graphicName)) { } else if (this.isComplexSymbol(style.graphicName)) {
// the symbol viewBox is three times as large as the symbol // the symbol viewBox is three times as large as the symbol
var offset = style.pointRadius * 3; var offset = style.pointRadius * 3;
@@ -1000,9 +1000,10 @@ OpenLayers.Renderer.SVG.LABEL_VFACTOR = {
/** /**
* Function: OpenLayers.Renderer.SVG.preventDefault * Function: OpenLayers.Renderer.SVG.preventDefault
* *Deprecated*. Use <OpenLayers.Event.preventDefault> method instead.
* Used to prevent default events (especially opening images in a new tab on * Used to prevent default events (especially opening images in a new tab on
* ctrl-click) from being executed for externalGraphic symbols * ctrl-click) from being executed for externalGraphic symbols
*/ */
OpenLayers.Renderer.SVG.preventDefault = function(e) { OpenLayers.Renderer.SVG.preventDefault = function(e) {
e.preventDefault && e.preventDefault(); OpenLayers.Event.preventDefault(e);
}; };
+1 -1
View File
@@ -7,7 +7,7 @@ var OpenLayers = {
/** /**
* Constant: VERSION_NUMBER * Constant: VERSION_NUMBER
*/ */
VERSION_NUMBER: "Release 2.12-rc5", VERSION_NUMBER: "Release 2.13 dev",
/** /**
* Constant: singleFile * Constant: singleFile
+1 -1
View File
@@ -278,7 +278,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
this.layer.addFeatures(features); this.layer.addFeatures(features);
} }
this.response = null; this.response = null;
this.layer.events.triggerEvent("loadend"); this.layer.events.triggerEvent("loadend", {response: resp});
}, },
CLASS_NAME: "OpenLayers.Strategy.BBOX" CLASS_NAME: "OpenLayers.Strategy.BBOX"
+3 -2
View File
@@ -106,7 +106,8 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, {
* *
* Parameters: * Parameters:
* mapProjection - {<OpenLayers.Projection>} the map projection * mapProjection - {<OpenLayers.Projection>} the map projection
* resp - {Object} options to pass to protocol read. * resp - {<OpenLayers.Protocol.Response>} The response object passed
* by the protocol.
*/ */
merge: function(mapProjection, resp) { merge: function(mapProjection, resp) {
var layer = this.layer; var layer = this.layer;
@@ -124,7 +125,7 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, {
} }
layer.addFeatures(features); layer.addFeatures(features);
} }
layer.events.triggerEvent("loadend"); layer.events.triggerEvent("loadend", {response: resp});
}, },
CLASS_NAME: "OpenLayers.Strategy.Fixed" CLASS_NAME: "OpenLayers.Strategy.Fixed"
+37 -20
View File
@@ -1536,6 +1536,33 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
var containerElement = (options && options.containerElement) var containerElement = (options && options.containerElement)
? options.containerElement : document.body; ? options.containerElement : document.body;
// Opera and IE7 can't handle a node with position:aboslute if it inherits
// position:absolute from a parent.
var parentHasPositionAbsolute = false;
var superContainer = null;
var parent = containerElement;
while (parent && parent.tagName.toLowerCase()!="body") {
var parentPosition = OpenLayers.Element.getStyle(parent, "position");
if(parentPosition == "absolute") {
parentHasPositionAbsolute = true;
break;
} else if (parentPosition && parentPosition != "static") {
break;
}
parent = parent.parentNode;
}
if(parentHasPositionAbsolute && (containerElement.clientHeight === 0 ||
containerElement.clientWidth === 0) ){
superContainer = document.createElement("div");
superContainer.style.visibility = "hidden";
superContainer.style.position = "absolute";
superContainer.style.overflow = "visible";
superContainer.style.width = document.body.clientWidth + "px";
superContainer.style.height = document.body.clientHeight + "px";
superContainer.appendChild(container);
}
container.style.position = "absolute";
//fix a dimension, if specified. //fix a dimension, if specified.
if (size) { if (size) {
if (size.w) { if (size.w) {
@@ -1569,25 +1596,10 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
container.appendChild(content); container.appendChild(content);
// append container to body for rendering // append container to body for rendering
containerElement.appendChild(container); if (superContainer) {
containerElement.appendChild(superContainer);
// Opera and IE7 can't handle a node with position:aboslute if it inherits } else {
// position:absolute from a parent. containerElement.appendChild(container);
var parentHasPositionAbsolute = false;
var parent = container.parentNode;
while (parent && parent.tagName.toLowerCase()!="body") {
var parentPosition = OpenLayers.Element.getStyle(parent, "position");
if(parentPosition == "absolute") {
parentHasPositionAbsolute = true;
break;
} else if (parentPosition && parentPosition != "static") {
break;
}
parent = parent.parentNode;
}
if(!parentHasPositionAbsolute) {
container.style.position = "absolute";
} }
// calculate scroll width of content and add corners and shadow width // calculate scroll width of content and add corners and shadow width
@@ -1604,7 +1616,12 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
// remove elements // remove elements
container.removeChild(content); container.removeChild(content);
containerElement.removeChild(container); if (superContainer) {
superContainer.removeChild(container);
containerElement.removeChild(superContainer);
} else {
containerElement.removeChild(container);
}
return new OpenLayers.Size(w, h); return new OpenLayers.Size(w, h);
}; };
+131
View File
@@ -0,0 +1,131 @@
/**
* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the 2-clause BSD license.
* See license.txt in the OpenLayers distribution or repository for the
* full text of the license.
*
* @requires OpenLayers/SingleFile.js
*/
OpenLayers.Util = OpenLayers.Util || {};
/**
* Namespace: OpenLayers.Util.vendorPrefix
* A collection of utility functions to detect vendor prefixed features
*/
OpenLayers.Util.vendorPrefix = (function() {
"use strict";
var VENDOR_PREFIXES = ["", "O", "ms", "Moz", "Webkit"],
divStyle = document.createElement("div").style,
cssCache = {},
jsCache = {};
/**
* Function: domToCss
* Converts a upper camel case DOM style property name to a CSS property
* i.e. transformOrigin -> transform-origin
* or WebkitTransformOrigin -> -webkit-transform-origin
*
* Parameters:
* prefixedDom - {String} The property to convert
*
* Returns:
* {String} The CSS property
*/
function domToCss(prefixedDom) {
if (!prefixedDom) { return null; }
return prefixedDom.
replace(/([A-Z])/g, function(c) { return "-" + c.toLowerCase(); }).
replace(/^ms-/, "-ms-");
}
/**
* APIMethod: css
* Detect which property is used for a CSS property
*
* Parameters:
* property - {String} The standard (unprefixed) CSS property name
*
* Returns:
* {String} The standard CSS property, prefixed property or null if not
* supported
*/
function css(property) {
if (cssCache[property] === undefined) {
var domProperty = property.
replace(/(-[\s\S])/g, function(c) { return c.charAt(1).toUpperCase(); });
var prefixedDom = style(domProperty);
cssCache[property] = domToCss(prefixedDom);
}
return cssCache[property];
}
/**
* APIMethod: js
* Detect which property is used for a JS property/method
*
* Parameters:
* obj - {Object} The object to test on
* property - {String} The standard (unprefixed) JS property name
*
* Returns:
* {String} The standard JS property, prefixed property or null if not
* supported
*/
function js(obj, property) {
if (jsCache[property] === undefined) {
var tmpProp,
i = 0,
l = VENDOR_PREFIXES.length,
prefix,
isStyleObj = (typeof obj.cssText !== "undefined");
jsCache[property] = null;
for(; i<l; i++) {
prefix = VENDOR_PREFIXES[i];
if(prefix) {
if (!isStyleObj) {
// js prefix should be lower-case, while style
// properties have upper case on first character
prefix = prefix.toLowerCase();
}
tmpProp = prefix + property.charAt(0).toUpperCase() + property.slice(1);
} else {
tmpProp = property;
}
if(obj[tmpProp] !== undefined) {
jsCache[property] = tmpProp;
break;
}
}
}
return jsCache[property];
}
/**
* APIMethod: style
* Detect which property is used for a DOM style property
*
* Parameters:
* property - {String} The standard (unprefixed) style property name
*
* Returns:
* {String} The standard style property, prefixed property or null if not
* supported
*/
function style(property) {
return js(divStyle, property);
}
return {
css: css,
js: js,
style: style,
// used for testing
cssCache: cssCache,
jsCache: jsCache
};
}());
+24 -1
View File
@@ -25,6 +25,16 @@ Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/254 * https://github.com/openlayers/openlayers/pull/254
* https://github.com/openlayers/openlayers/pull/261 * https://github.com/openlayers/openlayers/pull/261
## style.mobile.css
The theme/default directory now includes a mobile-specific CSS file, namely
style.mobile.css. The OpenLayers mobile examples use this file. To use it
in your mobile pages use tags like this:
<link rel="stylesheet" href="openlayers/theme/default/style.mobile.css" type="text/css">
(This file used to be in the examples/ directory).
## Sensible projection defaults ## Sensible projection defaults
The geographic and web mercator projections define default values for the maxExtent, and units. This simplifies the map and layer configuration. The geographic and web mercator projections define default values for the maxExtent, and units. This simplifies the map and layer configuration.
@@ -72,7 +82,7 @@ The displaying of tiles can now be animated, using CSS3 transitions. Transitions
People can override this rule to use other transition settings. To remove tile animation entirely use: People can override this rule to use other transition settings. To remove tile animation entirely use:
.olLayerGridTile .olTileImage { .olLayerGrid .olTileImage {
-webkit-transition: none; -webkit-transition: none;
-moz-transition: none; -moz-transition: none;
-o-transition: all 0 none; -o-transition: all 0 none;
@@ -85,6 +95,19 @@ Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/127 * https://github.com/openlayers/openlayers/pull/127
Note: Issue #511 has reported that tile animation causes flickering/blinking in
the iOS native browser. Forcing the browser to use hardware-accelerated
animations fixed the issue, but #542 has reported that it also considerably
slows down freehand drawing on iOS. If you're experiencing this and want to
disable hardware-accelerated animations you can use the following rule in your
CSS:
@media (-webkit-transform-3d) {
img.olTileImage {
-webkit-transform: none;
}
}
## Tile Queue ## Tile Queue
The tiling code has been overhauled so tile loading in grid layers is now done in a queue. The tiling code has been overhauled so tile loading in grid layers is now done in a queue.
+10
View File
@@ -35,3 +35,13 @@ Corresponding issue/pull requests:
* https://github.com/openlayers/openlayers/pull/423 * https://github.com/openlayers/openlayers/pull/423
# New Options for Build Script
* add the contents of a file as a comment at the front of the build, for example, the output of 'git describe --tags' could be saved as a file and then included
* create build file as an AMD module
run 'build.py -h' for more details
Corresponding issue/pull requests:
* https://github.com/openlayers/openlayers/pull/528
+1
View File
@@ -6,6 +6,7 @@
// dependencies for tests // dependencies for tests
var OpenLayers = [ var OpenLayers = [
"OpenLayers/Util/vendorPrefix.js",
"OpenLayers/Animation.js" "OpenLayers/Animation.js"
]; ];
+25
View File
@@ -34,6 +34,31 @@
t.eq( control2.div.style.top, "100px", "2nd control div is located correctly"); t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
} }
function test_draw(t) {
t.plan(3);
map = new OpenLayers.Map('map', {controls:[]});
var layer = new OpenLayers.Layer.WMS("Test Layer",
"http://octo.metacarta.com/cgi-bin/mapserv?",
{map: "/mapdata/vmap_wms.map", layers: "basic"});
map.addLayer(layer);
map.zoomToMaxExtent();
control = new OpenLayers.Control.PanZoomBar();
map.addControl(control);
t.eq(control.zoombarDiv.style.height, '176px', "Bar's height is correct.");
map.baseLayer.wrapDateLine = true;
control.redraw();
t.eq(control.zoombarDiv.style.height, '154px', "Bar's height is correct after minZoom restriction.");
map.div.style.width = "512px";
map.updateSize();
t.eq(control.zoombarDiv.style.height, '165px', "Bar's height is correct after resize and minZoom restriction.");
map.div.style.width = "1024px";
map.destroy();
}
function test_Control_PanZoomBar_clearDiv(t) { function test_Control_PanZoomBar_clearDiv(t) {
t.plan(2); t.plan(2);
map = new OpenLayers.Map('map', {controls:[]}); map = new OpenLayers.Map('map', {controls:[]});
+13 -8
View File
@@ -104,13 +104,18 @@
t.plan(7); t.plan(7);
var layer = new OpenLayers.Layer.Vector("foo", { var layer1 = new OpenLayers.Layer.Vector("foo", {
maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10), maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
isBaseLayer: true isBaseLayer: true
}); });
var control = new OpenLayers.Control.Split({layer: layer}); var layer2 = new OpenLayers.Layer.Vector("bar", {
maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
isBaseLayer: false
});
var control = new OpenLayers.Control.Split({layer: layer1});
var map = new OpenLayers.Map("map"); var map = new OpenLayers.Map("map");
map.addLayer(layer); map.addLayer(layer1);
map.addLayer(layer2);
map.zoomToMaxExtent(); map.zoomToMaxExtent();
map.addControl(control); map.addControl(control);
@@ -124,17 +129,17 @@
t.eq(control.handler.active, false, "sketch handler deactivated"); t.eq(control.handler.active, false, "sketch handler deactivated");
// set a source layer // set a source layer
control.setSource(layer); control.setSource(layer2);
// activate and check that listeners are registered // activate and check that listeners are registered
control.activate(); control.activate();
t.ok(layer.events.listeners.sketchcomplete, "sketchcomplete listener registered"); t.ok(layer2.events.listeners.sketchcomplete, "sketchcomplete listener registered");
t.ok(layer.events.listeners.afterfeaturemodified, "afterfeaturemodified listener registered"); t.ok(layer2.events.listeners.afterfeaturemodified, "afterfeaturemodified listener registered");
// deactivate and confirm no draw related events // deactivate and confirm no draw related events
control.deactivate(); control.deactivate();
t.eq(layer.events.listeners.sketchcomplete.length, 0, "no sketchcomplete listeners"); t.eq(layer2.events.listeners.sketchcomplete.length, 0, "no sketchcomplete listeners");
t.eq(layer.events.listeners.afterfeaturemodified.length, 0, "no afterfeaturemodified listeners"); t.eq(layer2.events.listeners.afterfeaturemodified.length, 0, "no afterfeaturemodified listeners");
map.destroy(); map.destroy();
} }
+52
View File
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_constructor(t) {
t.plan(4);
var control = new OpenLayers.Control.ZoomBox();
t.ok(control instanceof OpenLayers.Control, "instance of Control");
t.ok(control instanceof OpenLayers.Control.ZoomBox, "instance of ZoomBox");
t.eq(control.displayClass, "olControlZoomBox", "displayClass");
control.destroy();
control = new OpenLayers.Control.ZoomBox({
zoomOnClick: false
});
t.eq(control.zoomOnClick, false, "zoomOnClick");
control.destroy();
}
function test_zoomBox(t) {
t.plan(4);
var map = new OpenLayers.Map("map", {
layers: [new OpenLayers.Layer("", {isBaseLayer: true})],
center: [0, 0],
zoom: 1
});
var control = new OpenLayers.Control.ZoomBox();
map.addControl(control);
control.zoomBox(new OpenLayers.Pixel(50, 60));
t.eq(map.getZoom(), 2, "zoomed on click");
control.zoomOnClick = false;
control.zoomBox(new OpenLayers.Pixel(-50, -60));
t.eq(map.getZoom(), 2, "not zoomed with zoomOnClick set to false");
map.zoomToMaxExtent();
control.zoomBox(new OpenLayers.Bounds(128, 64, 256, 128));
t.eq(map.getCenter().toShortString(), "-45, 22.5", "centered to box center");
t.eq(map.getZoom(), 3, "zoomed to box extent");
map.destroy();
}
</script>
</head>
<body>
<div id="map" style="width: 512px; height: 256px;"/>
</body>
</html>
+34
View File
@@ -63,6 +63,40 @@
events.destroy(); events.destroy();
} }
function test_ignore(t) {
t.plan(5);
// set up
events = new OpenLayers.Events({}, element);
buttonClick = new OpenLayers.Events.buttonclick(events);
var link = document.createElement('a'),
span1 = document.createElement('span'),
span2 = document.createElement('span'),
span3 = document.createElement('span');
link.appendChild(span1);
span1.appendChild(span2);
span2.appendChild(span3);
t.eq(buttonClick.ignore(link), true,
'ignore returns true when element is a link');
t.eq(buttonClick.ignore(span1), true,
'ignore returns true when element is link descendant level 1');
t.eq(buttonClick.ignore(span2), true,
'ignore returns true when element is link descendant level 2');
t.eq(buttonClick.ignore(span3), false,
'ignore returns false when element is link descendant level 3');
t.eq(buttonClick.ignore(element), false,
'ignore returns false when element is not a link');
// tear down
buttonClick.destroy();
events.destroy();
}
function test_ButtonClick_buttonClick(t) { function test_ButtonClick_buttonClick(t) {
t.plan(27); t.plan(27);
events = new OpenLayers.Events({}, element); events = new OpenLayers.Events({}, element);
+7 -2
View File
@@ -201,11 +201,16 @@ var cases = {
"v2/box-coord.xml": new OpenLayers.Bounds(1, 2, 3, 4), "v2/box-coord.xml": new OpenLayers.Bounds(1, 2, 3, 4),
"v2/box-coordinates.xml": new OpenLayers.Bounds(1, 2, 3, 4) "v2/box-coordinates.xml": new OpenLayers.Bounds(1, 2, 3, 4),
"v3/linestring3d.xml": new OpenLayers.Geometry.LineString([
new OpenLayers.Geometry.Point(1, 2, 3),
new OpenLayers.Geometry.Point(4, 5, 6)
])
}; };
// cases for v3 use the same geometries // some cases for v3 use the same geometries
OpenLayers.Util.extend(cases, { OpenLayers.Util.extend(cases, {
"v3/point.xml": cases["v2/point-coordinates.xml"], "v3/point.xml": cases["v2/point-coordinates.xml"],
"v3/linestring.xml": cases["v2/linestring-coordinates.xml"], "v3/linestring.xml": cases["v2/linestring-coordinates.xml"],
+7 -2
View File
@@ -10,8 +10,8 @@
"v2/linestring-coord.xml", "v2/linestring-coordinates.xml", "v2/linestring-coord.xml", "v2/linestring-coordinates.xml",
"v2/multipoint-coord.xml", "v2/multipoint-coordinates.xml", "v2/multipoint-coord.xml", "v2/multipoint-coordinates.xml",
"v2/multilinestring-coord.xml", "v2/multilinestring-coordinates.xml", "v2/multilinestring-coord.xml", "v2/multilinestring-coordinates.xml",
"v3/point.xml", "v3/linestring.xml", "v3/curve.xml", "v3/point.xml", "v3/linestring.xml", "v3/linestring3d.xml",
"v3/polygon.xml", "v3/surface.xml", "v3/curve.xml", "v3/polygon.xml", "v3/surface.xml",
"v3/multipoint-singular.xml", "v3/multipoint-plural.xml", "v3/multipoint-singular.xml", "v3/multipoint-plural.xml",
"v3/multilinestring-singular.xml", "v3/multilinestring-plural.xml", "v3/multilinestring-singular.xml", "v3/multilinestring-plural.xml",
"v3/multicurve-singular.xml", "v3/multicurve-curve.xml", "v3/multicurve-singular.xml", "v3/multicurve-curve.xml",
@@ -332,6 +332,11 @@
<gml:posList>1 2 3 4</gml:posList> <gml:posList>1 2 3 4</gml:posList>
</gml:LineString> </gml:LineString>
--></div> --></div>
<div id="v3/linestring3d.xml"><!--
<gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo" srsDimension="3">
<gml:posList>1 2 3 4 5 6</gml:posList>
</gml:LineString>
--></div>
<div id="v3/curve.xml"><!-- <div id="v3/curve.xml"><!--
<gml:Curve xmlns:gml="http://www.opengis.net/gml" srsName="foo"> <gml:Curve xmlns:gml="http://www.opengis.net/gml" srsName="foo">
<gml:segments> <gml:segments>
+6
View File
@@ -20,6 +20,10 @@
} }
function test_Format_GPX_read(t) { function test_Format_GPX_read(t) {
t.plan(7); t.plan(7);
var origDefaultPrecision = OpenLayers.Util.DEFAULT_PRECISION;
OpenLayers.Util.DEFAULT_PRECISION = 9;
var expected, var expected,
P = OpenLayers.Geometry.Point, P = OpenLayers.Geometry.Point,
LS = OpenLayers.Geometry.LineString; LS = OpenLayers.Geometry.LineString;
@@ -61,6 +65,8 @@
new P(-19493.373203291227, 6684644.845706556) new P(-19493.373203291227, 6684644.845706556)
]); ]);
t.geom_eq(features[1].geometry, expected, "transformed route feature correctly created"); t.geom_eq(features[1].geometry, expected, "transformed route feature correctly created");
OpenLayers.Util.DEFAULT_PRECISION = origDefaultPrecision;
} }
function test_format_GPX_read_attributes(t) { function test_format_GPX_read_attributes(t) {
t.plan(2); t.plan(2);
+16
View File
@@ -374,6 +374,22 @@
// GeoServer example above // GeoServer example above
} }
function test_read_exception(t) {
t.plan(1);
var text =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<ows:ExceptionReport version="1.0.0"' +
' xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">' +
' <ows:Exception exceptionCode="NoApplicableCode">' +
' <ows:ExceptionText>Could not find type: {http://geonode.org/}_map_4_annotations</ows:ExceptionText>' +
' </ows:Exception>' +
'</ows:ExceptionReport>';
var format = new OpenLayers.Format.WFSDescribeFeatureType();
var obj = format.read(text);
t.ok(!!obj.error, "Error reported correctly");
}
</script> </script>
</head> </head>
<body> <body>
+392 -13
View File
@@ -140,7 +140,7 @@
} }
function test_createLayer(t) { function test_createLayer(t) {
t.plan(7); t.plan(34);
var format = new OpenLayers.Format.WMTSCapabilities(); var format = new OpenLayers.Format.WMTSCapabilities();
@@ -152,9 +152,8 @@
var success = true; var success = true;
try { try {
// incomplete config (missing matrixSet) // incomplete config (missing layer)
layer = format.createLayer(caps, { layer = format.createLayer(caps, {
layer: "coastlines"
}); });
} catch (err) { } catch (err) {
success = false; success = false;
@@ -162,18 +161,26 @@
t.ok(!success, "createLayer throws error if provided incomplete layer config"); t.ok(!success, "createLayer throws error if provided incomplete layer config");
// bogus layer identifier // bogus layer identifier
layer = format.createLayer(caps, { try {
layer: "foo", layer = format.createLayer(caps, {
matrixSet: "BigWorld" layer: "foo",
}); matrixSet: "BigWorld"
t.eq(layer, undefined, "createLayer returns undefined given bad layer identifier"); });
} catch (err) {
success = false;
}
t.ok(!success, "createLayer returns undefined given bad layer identifier");
// bogus matrixSet identifier // bogus matrixSet identifier
layer = format.createLayer(caps, { try {
layer: "coastlines", layer = format.createLayer(caps, {
matrixSet: "TheWorld" layer: "coastlines",
}); matrixSet: "TheWorld"
t.eq(layer, undefined, "createLayer returns undefined given bad matrixSet identifier"); });
} catch (err) {
success = false;
}
t.ok(!success, "createLayer returns undefined given bad matrixSet identifier");
layer = format.createLayer(caps, { layer = format.createLayer(caps, {
layer: "coastlines", layer: "coastlines",
@@ -181,11 +188,104 @@
}); });
t.ok(layer instanceof OpenLayers.Layer.WMTS, "correct instance"); t.ok(layer instanceof OpenLayers.Layer.WMTS, "correct instance");
// autodetect matrixSet
layer = format.createLayer(caps, {
layer: "coastlines"
});
t.ok(layer instanceof OpenLayers.Layer.WMTS, "correct instance, with autodetected matrixSet");
t.eq(layer.matrixIds.length, 2, "correct matrixIds length"); t.eq(layer.matrixIds.length, 2, "correct matrixIds length");
t.eq(layer.name, "Coastlines", "correct layer title"); t.eq(layer.name, "Coastlines", "correct layer title");
t.eq(layer.style, "DarkBlue", "correct style identifier"); t.eq(layer.style, "DarkBlue", "correct style identifier");
t.eq(layer.requestEncoding, "KVP", "correct requestEncoding");
xml = document.getElementById("restsample").firstChild.nodeValue;
doc = new OpenLayers.Format.XML().read(xml);
caps = format.read(doc);
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781"
});
t.ok(layer instanceof OpenLayers.Layer.WMTS, "correct instance");
t.eq(layer.url, "http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png", "correct url");
t.eq(layer.matrixIds.length, 3, "correct matrixIds length");
t.eq(layer.requestEncoding, "REST", "correct requestEncoding");
t.eq(layer.name, "Agglomérations et villes isolées", "correct layer title");
t.eq(layer.style, "ch.are.agglomerationen_isolierte_staedte-2000", "correct style identifier");
t.eq(layer.projection.getCode(), "EPSG:21781", "correct projection");
t.eq(layer.units, "m", "correct untis");
t.eq(layer.resolutions.length, 3, "correct resolutions length");
t.ok((layer.resolutions[0] - 4000) < 1, "correct first resolution");
t.eq(layer.dimensions.length, 1, "correct dimensions length");
t.eq(layer.dimensions[0], "Time", "correct dimensions");
t.eq(layer.params['TIME'], "20090101", "correct params");
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
style: "toto",
params: {"Time": "2012"}
});
t.eq(layer.matrixIds.length, 3, "correct matrixIds length");
t.eq(layer.style, "toto", "correct style identifier");
t.eq(layer.dimensions.length, 1, "correct dimensions length");
t.eq(layer.dimensions[0], "Time", "correct dimensions");
t.eq(layer.params['TIME'], "2012", "correct params");
// test projection and units
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781",
units: 'degrees'
});
t.eq(layer.units, "degrees", "correct units");
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781",
projection: "EPSG:4326"
});
t.eq(layer.projection.getCode(), "EPSG:4326", "correct projection");
t.eq(layer.units, "degrees", "correct units");
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781",
projection: "EPSG:4326",
units: 'm'
});
t.eq(layer.projection.getCode(), "EPSG:4326", "correct projection");
t.eq(layer.units, "m", "correct units");
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781",
projection: "EPSG:900913",
units: 'degrees'
});
t.eq(layer.projection.getCode(), "EPSG:900913", "correct projection");
t.eq(layer.units, "degrees", "correct units");
} }
function test_parse_projection(t) {
t.plan(2);
var format = new OpenLayers.Format.WMTSCapabilities();
var xml = document.getElementById("restsample-alternate-proj1").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
var caps = format.read(doc);
var layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781"
});
t.eq(layer.projection.getCode(), "EPSG:21781", "correct projection");
xml = document.getElementById("restsample-alternate-proj2").firstChild.nodeValue;
doc = new OpenLayers.Format.XML().read(xml);
caps = format.read(doc);
layer = format.createLayer(caps, {
layer: "ch.are.agglomerationen_isolierte_staedte-2000",
matrixSet: "21781"
});
t.eq(layer.projection.getCode(), "EPSG:21781", "correct projection");
}
</script> </script>
</head> </head>
<body> <body>
@@ -354,5 +454,284 @@ http://schemas.opengis.net/wmts/1.0/examples/wmtsGetCapabilities_response.xml
</Themes> </Themes>
</Capabilities> </Capabilities>
--></div> --></div>
<div id="restsample"><!--
<?xml version="1.0" encoding="UTF-8"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
<ows:ServiceIdentification>
<ows:Title>Federal Geodata Infrastructure of Switzerland</ows:Title>
<ows:Abstract>Some Geodata are subject to license and fees</ows:Abstract>
<ows:Keywords>
<ows:Keyword>FGDI</ows:Keyword>
<ows:Keyword>Pixelkarte</ows:Keyword>
<ows:Keyword>Switzerland</ows:Keyword>
</ows:Keywords>
<ows:ServiceType>OGC WMTS</ows:ServiceType>
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
<ows:Fees>yes</ows:Fees>
<ows:AccessConstraints>license</ows:AccessConstraints>
</ows:ServiceIdentification>
<ows:ServiceProvider>
<ows:ProviderName>swisstopo</ows:ProviderName>
<ows:ProviderSite xlink:href="http://www.swisstopo.admin.ch"/>
<ows:ServiceContact>
<ows:IndividualName>David Oesch</ows:IndividualName>
<ows:PositionName></ows:PositionName>
<ows:ContactInfo>
<ows:Phone>
<ows:Voice>+41 (0)31 / 963 21 11</ows:Voice>
<ows:Facsimile>+41 (0)31 / 963 24 59</ows:Facsimile>
</ows:Phone>
<ows:Address>
<ows:DeliveryPoint>swisstopo</ows:DeliveryPoint>
<ows:City>Bern</ows:City>
<ows:AdministrativeArea>BE</ows:AdministrativeArea>
<ows:PostalCode>3084</ows:PostalCode>
<ows:Country>Switzerland</ows:Country>
<ows:ElectronicMailAddress/>
</ows:Address>
</ows:ContactInfo>
</ows:ServiceContact>
</ows:ServiceProvider>
<ows:OperationsMetadata>
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>REST</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetTile">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://wmts.geo.admin.ch/">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>REST</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
</ows:OperationsMetadata>
<Contents>
<Layer>
<ows:Title>Agglomérations et villes isolées</ows:Title>
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions danalyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer lurbanisation, phénomène fondamental structurant lorganisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de lOFS na pas valeur dobligation légale.</ows:Abstract>
<ows:WGS84BoundingBox>
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
</ows:WGS84BoundingBox>
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
<Style>
<ows:Title>Agglomérations et villes isolées</ows:Title>
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
</Style>
<Format>image/png</Format>
<Dimension>
<ows:Identifier>Time</ows:Identifier>
<Default>20090101</Default>
<Value>20090101</Value>
</Dimension>
<TileMatrixSetLink>
<TileMatrixSet>21781</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="image/png" resourceType="tile" template="http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
</Layer>
<TileMatrixSet>
<ows:Identifier>21781</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>14285750.5715</ScaleDenominator>
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>8</ows:Identifier>
<ScaleDenominator>7142875.28575</ScaleDenominator>
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>12</ows:Identifier>
<ScaleDenominator>3571437.64288</ScaleDenominator>
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>2</MatrixWidth>
<MatrixHeight>2</MatrixHeight>
</TileMatrix>
</TileMatrixSet>
</Contents>
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
</Capabilities>
--></div>
<div id="restsample-alternate-proj1"><!--
<?xml version="1.0" encoding="UTF-8"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
<ows:OperationsMetadata>
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>REST</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetTile">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://wmts.geo.admin.ch/">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>REST</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
</ows:OperationsMetadata>
<Contents>
<Layer>
<ows:Title>Agglomérations et villes isolées</ows:Title>
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions danalyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer lurbanisation, phénomène fondamental structurant lorganisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de lOFS na pas valeur dobligation légale.</ows:Abstract>
<ows:WGS84BoundingBox>
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
</ows:WGS84BoundingBox>
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
<Style>
<ows:Title>Agglomérations et villes isolées</ows:Title>
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
</Style>
<Format>image/png</Format>
<Dimension>
<ows:Identifier>Time</ows:Identifier>
<Default>20090101</Default>
<Value>20090101</Value>
</Dimension>
<TileMatrixSetLink>
<TileMatrixSet>21781</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="image/png" resourceType="tile" template="http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
</Layer>
<TileMatrixSet>
<ows:Identifier>21781</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>14285750.5715</ScaleDenominator>
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
</TileMatrixSet>
</Contents>
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
</Capabilities>
--></div>
<div id="restsample-alternate-proj2"><!--
<?xml version="1.0" encoding="UTF-8"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
<ows:OperationsMetadata>
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>REST</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
<ows:Operation name="GetTile">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://wmts.geo.admin.ch/">
<ows:Constraint name="GetEncoding">
<ows:AllowedValues>
<ows:Value>REST</ows:Value>
</ows:AllowedValues>
</ows:Constraint>
</ows:Get>
</ows:HTTP>
</ows:DCP>
</ows:Operation>
</ows:OperationsMetadata>
<Contents>
<Layer>
<ows:Title>Agglomérations et villes isolées</ows:Title>
<ows:Abstract>Les agglomérations et villes isolées (communes non rattachées à une agglomération et comptant au moins 10`000 habitants) font partie des régions danalyse de la statistique suisse. Ce niveau géographique est défini depuis plus de 100 ans, afin de mesurer lurbanisation, phénomène fondamental structurant lorganisation du territoire. Sa fonction principale est de permettre une comparaison spatiale entre des espaces urbains inégalement délimités sur le plan institutionnel. Une version ancienne est appliquée pour la première fois en 1930, puis révisée en 1984 et 1990, toujours sur la base des recensements de la population. La version actuelle classe les 2896 communes de Suisse (état 2000) selon leur appartenance ou pas à une agglomération ou ville isolée en fonction de critères statistiques (Etat et évolution de la population, lien de continuité de la zone bâtie, rapport entre population active occupée et population résidante, structure économique et flux de pendulaires). Les agglomérations et les villes isolées forment l`espace urbain, les territoires restant l`espace rural. La définition des agglomérations de lOFS na pas valeur dobligation légale.</ows:Abstract>
<ows:WGS84BoundingBox>
<ows:LowerCorner>5.140242 45.398181</ows:LowerCorner>
<ows:UpperCorner>11.47757 48.230651</ows:UpperCorner>
</ows:WGS84BoundingBox>
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
<ows:Metadata xlink:href="http://www.swisstopo.admin.ch/SITiled/world/AdminBoundaries/metadata.htm"/>
<Style>
<ows:Title>Agglomérations et villes isolées</ows:Title>
<ows:Identifier>ch.are.agglomerationen_isolierte_staedte-2000</ows:Identifier>
<LegendURL format="image/png" xlink:href="http://api.geo.admin.ch/legend/ch.are.agglomerationen_isolierte_staedte-2000_fr.png" />
</Style>
<Format>image/png</Format>
<Dimension>
<ows:Identifier>Time</ows:Identifier>
<Default>20090101</Default>
<Value>20090101</Value>
</Dimension>
<TileMatrixSetLink>
<TileMatrixSet>21781</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="image/png" resourceType="tile" template="http://wmts.geo.admin.ch/1.0.0/ch.are.agglomerationen_isolierte_staedte-2000/default/{Time}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
</Layer>
<TileMatrixSet>
<ows:Identifier>21781</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG:1.0:21781</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>14285750.5715</ScaleDenominator>
<TopLeftCorner>420000.0 350000.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
</TileMatrixSet>
</Contents>
<ServiceMetadataURL xlink:href="http://www.opengis.uab.es/SITiled/world/1.0.0/WMTSCapabilities.xml"/>
</Capabilities>
--></div>
</body> </body>
</html> </html>
+11 -1
View File
@@ -4,7 +4,7 @@
<script type="text/javascript"> <script type="text/javascript">
function test_read_WPSDescribeProcess(t) { function test_read_WPSDescribeProcess(t) {
t.plan(16); t.plan(17);
var parser = new OpenLayers.Format.WPSDescribeProcess(); var parser = new OpenLayers.Format.WPSDescribeProcess();
var text = var text =
@@ -109,6 +109,13 @@
' </Supported>' + ' </Supported>' +
' </ComplexOutput>' + ' </ComplexOutput>' +
' </Output>' + ' </Output>' +
' <Output>' +
' <ows:Identifier>literal</ows:Identifier>' +
' <ows:Title>literal output</ows:Title>' +
' <LiteralOutput>' +
' <ows:DataType ows:reference="http://www.w3.org/TR/xmlschema-2/#integer">integer</ows:DataType>'+
' </LiteralOutput>' +
' </Output>' +
' </ProcessOutputs>' + ' </ProcessOutputs>' +
' </ProcessDescription>' + ' </ProcessDescription>' +
'</wps:ProcessDescriptions>'; '</wps:ProcessDescriptions>';
@@ -135,6 +142,9 @@
t.eq(result.complexOutput["supported"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs supported format read correctly [1/2]"); t.eq(result.complexOutput["supported"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs supported format read correctly [1/2]");
t.eq(result.complexOutput["supported"].formats["application/wkt"], true, "processOutputs supported format read correctly [1/2]"); t.eq(result.complexOutput["supported"].formats["application/wkt"], true, "processOutputs supported format read correctly [1/2]");
var literalresult = buffer.processOutputs[1];
t.eq(literalresult.literalOutput.dataType, "integer", "processOutputs supported data type read corectly");
text = '<?xml version="1.0" encoding="UTF-8"?>' + text = '<?xml version="1.0" encoding="UTF-8"?>' +
'<wps:ProcessDescriptions service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' + '<wps:ProcessDescriptions service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en"' + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en"' +
+20 -10
View File
@@ -309,12 +309,12 @@
responseForm: { responseForm: {
responseDocument: { responseDocument: {
storeExecuteResponse: true, storeExecuteResponse: true,
output: { outputs: [{
asReference: true, asReference: true,
identifier: 'BufferedPolygon', identifier: 'BufferedPolygon',
title: 'Area serviced by playground.', title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.' 'abstract': 'Area within which most users of this playground will live.'
} }]
} }
} }
}); });
@@ -349,6 +349,11 @@
' <ows:Title>Area serviced by playground.</ows:Title>' + ' <ows:Title>Area serviced by playground.</ows:Title>' +
' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' + ' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
' </wps:Output>' + ' </wps:Output>' +
' <wps:Output>' +
' <ows:Identifier>literal</ows:Identifier>' +
' <ows:Title/>' +
' <ows:Abstract/>' +
' </wps:Output>' +
' </wps:ResponseDocument>' + ' </wps:ResponseDocument>' +
' </wps:ResponseForm>' + ' </wps:ResponseForm>' +
'</wps:Execute>'; '</wps:Execute>';
@@ -381,12 +386,17 @@
storeExecuteResponse: true, storeExecuteResponse: true,
lineage: true, lineage: true,
status: true, status: true,
output: { outputs: [
asReference: true, {
identifier: 'BufferedPolygon', asReference: true,
title: 'Area serviced by playground.', identifier: 'BufferedPolygon',
'abstract': 'Area within which most users of this playground will live.' title: 'Area serviced by playground.',
} 'abstract': 'Area within which most users of this playground will live.'
},
{
identifier: 'literal'
}
]
} }
} }
}); });
@@ -461,12 +471,12 @@
responseForm: { responseForm: {
responseDocument: { responseDocument: {
storeExecuteResponse: true, storeExecuteResponse: true,
output: { outputs: [{
asReference: true, asReference: true,
identifier: 'BufferedPolygon', identifier: 'BufferedPolygon',
title: 'Area serviced by playground.', title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.' 'abstract': 'Area within which most users of this playground will live.'
} }]
} }
} }
}); });
+9 -15
View File
@@ -117,7 +117,7 @@
handler.activate(); handler.activate();
var oldIsLeftClick = OpenLayers.Event.isLeftClick; var oldIsLeftClick = OpenLayers.Event.isLeftClick;
var oldStop = OpenLayers.Event.stop; var oldPreventDefault = OpenLayers.Event.preventDefault;
var oldCheckModifiers = handler.checkModifiers; var oldCheckModifiers = handler.checkModifiers;
// test mousedown with right click // test mousedown with right click
@@ -163,15 +163,9 @@
"mousedown calls isLeftClick with the proper event"); "mousedown calls isLeftClick with the proper event");
return true; return true;
} }
OpenLayers.Event.stop = function(evt, allowDefault) { OpenLayers.Event.preventDefault = function(evt) {
if(!allowDefault) { t.ok(evt.xy.x == testEvents.down.xy.x && evt.xy.y == testEvents.down.xy.y,
t.ok(evt.xy.x == testEvents.down.xy.x && "mousedown default action is disabled");
evt.xy.y == testEvents.down.xy.y,
"mousedown default action is disabled");
} else {
t.fail(
"mousedown is prevented from falling to other elements");
}
} }
map.events.triggerEvent("mousedown", testEvents.down); map.events.triggerEvent("mousedown", testEvents.down);
t.ok(handler.started, "mousedown sets the started flag to true"); t.ok(handler.started, "mousedown sets the started flag to true");
@@ -183,7 +177,7 @@
handler.last.y == testEvents.down.xy.y, handler.last.y == testEvents.down.xy.y,
"mouse down sets handler.last correctly"); "mouse down sets handler.last correctly");
OpenLayers.Event.stop = oldStop; OpenLayers.Event.preventDefault = oldPreventDefault;
OpenLayers.Event.isLeftClick = oldIsLeftClick; OpenLayers.Event.isLeftClick = oldIsLeftClick;
handler.checkModifiers = oldCheckModifiers; handler.checkModifiers = oldCheckModifiers;
@@ -292,7 +286,7 @@
function test_Handler_Drag_touch(t) { function test_Handler_Drag_touch(t) {
// In this test we verify that "touchstart", "touchmove", and // In this test we verify that "touchstart", "touchmove", and
// "touchend" events set expected states in the drag handler. // "touchend" events set expected states in the drag handler.
// We also verify that we stop event bubbling as appropriate. // We also verify that we prevent the default as appropriate.
t.plan(14); t.plan(14);
@@ -308,8 +302,8 @@
}); });
h.activate(); h.activate();
var _stop = OpenLayers.Event.stop; var _preventDefault = OpenLayers.Event.preventDefault;
OpenLayers.Event.stop = function(e) { OpenLayers.Event.preventDefault = function(e) {
log.push(e); log.push(e);
}; };
@@ -343,7 +337,7 @@
// tear down // tear down
OpenLayers.Event.stop = _stop; OpenLayers.Event.preventDefault = _preventDefault;
m.destroy(); m.destroy();
} }
+3 -3
View File
@@ -126,9 +126,9 @@
map.zoomToMaxExtent(); map.zoomToMaxExtent();
t.delay_call(2, function() { t.delay_call(2, function() {
t.ok(layer.attribution.indexOf('olBingAttribution aerial') !== -1, "Attribution has the correct css class"); t.ok(OpenLayers.Util.indexOf(layer.attribution, 'olBingAttribution aerial') !== -1, "Attribution has the correct css class");
t.ok(layer.attribution.indexOf('<img src="">') == -1, "Attribution contains a logo"); t.ok(OpenLayers.Util.indexOf(layer.attribution, '<img src="">') == -1, "Attribution contains a logo");
t.ok(layer.attribution.indexOf('</img></div></a><a style=') == -1 , "Attribution contains a copyright"); t.ok(OpenLayers.Util.indexOf(layer.attribution, '</img></div></a><a style=') == -1 , "Attribution contains a copyright");
map.destroy(); map.destroy();
}); });
} }
+16 -16
View File
@@ -1375,28 +1375,28 @@
map.zoomTo(1); map.zoomTo(1);
t.delay_call(1, function() { // Mark one tile loaded, to see if back buffer removal gets scheduled.
layer.grid[1][1].onImageLoad();
t.ok(layer.backBuffer.parentNode === layer.div, t.ok(layer.backBuffer.parentNode === layer.div,
'[a] back buffer is a child of layer div'); '[a] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId !== null, t.ok(layer.backBufferTimerId !== null,
'[a] back buffer scheduled for removal'); '[a] back buffer scheduled for removal');
var backBuffer = layer.backBuffer; var backBuffer = layer.backBuffer;
map.zoomTo(2); map.zoomTo(2);
t.ok(layer.backBuffer !== backBuffer, t.ok(layer.backBuffer !== backBuffer,
'[b] a new back buffer was created'); '[b] a new back buffer was created');
t.ok(layer.backBuffer.parentNode === layer.div, t.ok(layer.backBuffer.parentNode === layer.div,
'[b] back buffer is a child of layer div'); '[b] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId === null, t.ok(layer.backBufferTimerId === null,
'[b] back buffer no longer scheduled for removal'); '[b] back buffer no longer scheduled for removal');
// tear down // tear down
map.destroy(); map.destroy();
});
} }
function test_getGridData(t) { function test_getGridData(t) {
+32 -1
View File
@@ -2047,7 +2047,7 @@
} }
function test_adjustZoom(t) { function test_adjustZoom(t) {
t.plan(4); t.plan(5);
var map = new OpenLayers.Map({ var map = new OpenLayers.Map({
div: 'map', div: 'map',
layers: [ layers: [
@@ -2063,6 +2063,9 @@
t.eq(map.adjustZoom(9), 9, "valid zoom maintained"); t.eq(map.adjustZoom(9), 9, "valid zoom maintained");
t.eq(map.adjustZoom(1), 2, "zoom adjusted to not exceed world width"); t.eq(map.adjustZoom(1), 2, "zoom adjusted to not exceed world width");
map.fractionalZoom = true;
t.eq(map.adjustZoom(1).toPrecision(3), "1.29", "zoom adjusted to match world width");
map.moveTo([16, 48], 0); map.moveTo([16, 48], 0);
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom"); t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
} }
@@ -2087,6 +2090,34 @@
t.ok(center.equals(new OpenLayers.LonLat(-13.25, 56)), "Center is correct and not equal to maxExtent's center"); t.ok(center.equals(new OpenLayers.LonLat(-13.25, 56)), "Center is correct and not equal to maxExtent's center");
} }
function test_autoUpdateSize(t) {
t.plan(1);
OpenLayers.Event.unloadCache();
var resizeListener = false;
var map = new OpenLayers.Map({
autoUpdateSize: false,
div: 'map',
layers: [
new OpenLayers.Layer('name', {
isBaseLayer: true,
wrapDateLine: true
})
]
});
map.setCenter(new OpenLayers.LonLat(-1.3, 50.8), 4);
for (var key in OpenLayers.Event.observers) {
var obj = OpenLayers.Event.observers[key];
for (var i=0, ii=obj.length; i<ii; ++i) {
var listener = obj[i];
if (listener.name === 'resize' && listener.element === window) {
resizeListener = true;
}
}
}
t.eq(resizeListener, map.autoUpdateSize, "resize listener not registered when autoUpdateSize is false");
map.destroy();
}
</script> </script>
</head> </head>
<body> <body>
+1 -1
View File
@@ -44,7 +44,7 @@
// conditionally mock up proj4js // conditionally mock up proj4js
var hasProj = !!window.Proj4js; var hasProj = !!window.Proj4js;
if (!hasProj) { if (!hasProj) {
window.Proj4js = true; window.Proj4js = {};
} }
proj1.proj = {defData: "+title= WGS84 +foo=bar +x=0"}; proj1.proj = {defData: "+title= WGS84 +foo=bar +x=0"};
proj2.proj = {defData: "+title=FOO +foo=bar +x=0", srsCode: "FOO"}; proj2.proj = {defData: "+title=FOO +foo=bar +x=0", srsCode: "FOO"};
+18 -15
View File
@@ -112,43 +112,46 @@
function test_events(t) { function test_events(t) {
t.plan(3); t.plan(6);
var log = {
loadstart: 0, var log = [];
loadend: 0
}; var response = new OpenLayers.Protocol.Response();
var map = new OpenLayers.Map("map"); var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, { var layer = new OpenLayers.Layer.Vector(null, {
strategies: [new OpenLayers.Strategy.BBOX()], strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol({ protocol: new OpenLayers.Protocol({
read: function(config) { read: function(config) {
config.callback.call(config.scope, {}); config.callback.call(config.scope, response);
} }
}), }),
isBaseLayer: true, isBaseLayer: true,
eventListeners: { eventListeners: {
loadstart: function() { loadstart: function(event) {
++log.loadstart; log.push(event);
}, },
loadend: function() { loadend: function(event) {
++log.loadend; log.push(event);
} }
} }
}); });
map.addLayer(layer); map.addLayer(layer);
map.zoomToMaxExtent(); map.zoomToMaxExtent();
t.eq(log.loadstart, 1, "loadstart triggered"); t.eq(log.length, 2, "2 events logged");
t.eq(log.loadend, 1, "loadend triggered"); t.eq(log[0].type, "loadstart", "loadstart first");
t.eq(log[1].type, "loadend", "loadend second");
t.ok(log[1].response == response, "loadend includes response");
log = {}; var calls = [];
layer.protocol.read = function(obj) { layer.protocol.read = function(obj) {
log.obj = obj; calls.push(obj);
} }
layer.refresh({force: true, whee: 'chicken'}); layer.refresh({force: true, whee: 'chicken'});
t.eq(log.obj && log.obj.whee, "chicken", "properties passed to read on refresh correctly."); t.eq(calls.length, 1, "1 call to read");
t.eq(calls[0].whee, "chicken", "properties passed to read");
map.destroy(); map.destroy();
+18 -15
View File
@@ -62,28 +62,27 @@
function test_events(t) { function test_events(t) {
t.plan(3); t.plan(6);
var log = { var log = [];
loadstart: 0,
loadend: 0 var response = new OpenLayers.Protocol.Response();
};
var map = new OpenLayers.Map("map"); var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, { var layer = new OpenLayers.Layer.Vector(null, {
strategies: [new OpenLayers.Strategy.Fixed()], strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol({ protocol: new OpenLayers.Protocol({
read: function(config) { read: function(config) {
config.callback.call(config.scope, {}); config.callback.call(config.scope, response);
} }
}), }),
isBaseLayer: true, isBaseLayer: true,
eventListeners: { eventListeners: {
loadstart: function() { loadstart: function(event) {
++log.loadstart; log.push(event);
}, },
loadend: function() { loadend: function(event) {
++log.loadend; log.push(event);
} }
} }
}); });
@@ -91,15 +90,19 @@
map.addLayer(layer); map.addLayer(layer);
map.zoomToMaxExtent(); map.zoomToMaxExtent();
t.eq(log.loadstart, 1, "loadstart triggered"); t.eq(log.length, 2, "2 events logged");
t.eq(log.loadend, 1, "loadend triggered"); t.eq(log[0].type, "loadstart", "loadstart first");
var log = {}; t.eq(log[1].type, "loadend", "loadend second");
t.ok(log[1].response == response, "loadend includes response");
var calls = [];
layer.protocol.read = function(obj) { layer.protocol.read = function(obj) {
log.obj = obj; calls.push(obj);
} }
layer.refresh({whee: 'chicken'}); layer.refresh({whee: 'chicken'});
t.eq(log.obj && log.obj.whee, "chicken", "properties passed to read on refresh correctly."); t.eq(calls.length, 1, "1 call to read");
t.eq(calls[0].whee, "chicken", "properties passed to read");
map.destroy(); map.destroy();
+117
View File
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html>
<head>
<title>vendorPrefix.js Tests</title>
<script>
var div = document.createElement("div");
var style = div.style,
orgCreateElement = document.createElement;
// wrap document.createElement to control property values
document.createElement = function(type) {
return div;
};
// dependencies for tests
var OpenLayers = [
"OpenLayers/Util/vendorPrefix.js"
];
</script>
<script src="../OLLoader.js"></script>
<script>
/**
* Test vendor prefixing
*/
function test_vendor_prefixes(t) {
t.plan(20);
var err;
function clearCache(type) {
var cache = OpenLayers.Util.vendorPrefix[type.replace("style", "js") + "Cache"];
for (var key in cache) {
delete cache[key];
}
}
function setStyleMockProp(prop, value) {
if (prop && value === undefined) {
delete style[prop];
} else if (prop) {
style[prop] = value;
}
}
function curryTestPrefix(type) {
return function(standardProp, expectedPrefix, msg) {
var prefixedProp, err;
try {
clearCache(type);
setStyleMockProp(expectedPrefix, "");
prefixedProp = OpenLayers.Util.vendorPrefix[type](standardProp);
} catch(e) {
err = e;
} finally {
setStyleMockProp(expectedPrefix, undefined);
}
if(!err) {
t.eq(prefixedProp, expectedPrefix, msg);
} else {
t.fail("Error when testing " + type.toUpperCase() + " vendor prefix: " + err.message);
}
};
}
var testDomPrefix = curryTestPrefix("style"),
testCssPrefix = curryTestPrefix("css");
testDomPrefix("unsupported", null, "DOM vendor prefix - unsupported");
testCssPrefix("unsupported", null, "CSS vendor prefix - unsupported");
testDomPrefix("test", "test", "DOM vendor prefix - single word");
testCssPrefix("test", "test", "CSS vendor prefix - single word");
testDomPrefix("testMultiWord", "testMultiWord", "DOM vendor prefix - multiple words");
testCssPrefix("test-multi-word", "test-multi-word", "CSS vendor prefix - multiple words");
testDomPrefix("multiWord", "WebkitMultiWord", "DOM vendor prefix - multiple words for WebKit");
testCssPrefix("multi-word", "-webkit-multi-word", "CSS vendor prefix - multiple words for WebKit");
testDomPrefix("multiWord", "MozMultiWord", "DOM vendor prefix - multiple words for Mozilla");
testCssPrefix("multi-word", "-moz-multi-word", "CSS vendor prefix - multiple words for Mozilla");
testDomPrefix("multiWord", "OMultiWord", "DOM vendor prefix - multiple words for Opera");
testCssPrefix("multi-word", "-o-multi-word", "CSS vendor prefix - multiple words for Opera");
testDomPrefix("multiWord", "msMultiWord", "DOM vendor prefix - multiple words for Internet Explorer");
testCssPrefix("multi-word", "-ms-multi-word", "CSS vendor prefix - multiple words for Internet Explorer");
// test vendor prefix on object
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.js( {}, "unsupported" ), null, "Standard object property - unsupported");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.js( { "test": true }, "test" ), "test", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.js( { "oTest": true }, "test" ), "oTest", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.js( { "msTest": true }, "test" ), "msTest", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.js( { "mozTest": true }, "test" ), "mozTest", "Standard object property");
clearCache("js");
t.eq( OpenLayers.Util.vendorPrefix.js( { "webkitTest": true }, "test" ), "webkitTest", "Standard object property");
// unwrap document.createElement
document.createElement = orgCreateElement;
}
</script>
</head>
<body></body>
</html>
+2 -4
View File
@@ -46,13 +46,10 @@
<li>Control/UTFGrid.html</li> <li>Control/UTFGrid.html</li>
<li>Control/WMSGetFeatureInfo.html</li> <li>Control/WMSGetFeatureInfo.html</li>
<li>Control/WMTSGetFeatureInfo.html</li> <li>Control/WMTSGetFeatureInfo.html</li>
<li>Control/Pan.html</li>
<li>Control/PanPanel.html</li> <li>Control/PanPanel.html</li>
<li>Control/SLDSelect.html</li> <li>Control/SLDSelect.html</li>
<li>Control/Zoom.html</li> <li>Control/Zoom.html</li>
<li>Control/ZoomIn.html</li> <li>Control/ZoomBox.html</li>
<li>Control/ZoomOut.html</li>
<li>Control/ZoomToMaxExtent.html</li>
<li>Events.html</li> <li>Events.html</li>
<li>Events/buttonclick.html</li> <li>Events/buttonclick.html</li>
<li>Extras.html</li> <li>Extras.html</li>
@@ -234,6 +231,7 @@
<li>Tween.html</li> <li>Tween.html</li>
<li>Kinetic.html</li> <li>Kinetic.html</li>
<li>Util.html</li> <li>Util.html</li>
<li>Util/vendorPrefix.html</li>
<li>deprecated/Ajax.html</li> <li>deprecated/Ajax.html</li>
<li>deprecated/Util.html</li> <li>deprecated/Util.html</li>
<li>deprecated/BaseTypes/Class.html</li> <li>deprecated/BaseTypes/Class.html</li>
+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>map.div Events Acceptance Test</title>
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../../examples/style.css" type="text/css">
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, layer;
function init() {
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayer(layer);
map.setCenter(
new OpenLayers.LonLat(-71.147, 42.472).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 12
);
var element = document.getElementById('map');
element.addEventListener('mousedown', function(evt) {
alert('mousedown on map div');
});
}
</script>
</head>
<body onload="init()">
<h1 id="title">map.div Events Acceptance Test</h1>
<div id="map" class="smallmap"></div>
<p><b>Test 1</b> : mousedown the map; an alert must be displayed.</p>
</body>
</html>
+54
View File
@@ -39,10 +39,64 @@ function run() {
else { else {
out.innerHTML += "<br/>height Fail: " + size + ", " + height; out.innerHTML += "<br/>height Fail: " + size + ", " + height;
} }
// To use the same syntax as in "\tests"
var t = {eq: function(a, b, msg) {
if (a == b) {
out.innerHTML += "<br/>ok " + msg;
}
else {
out.innerHTML += "<br/><span style=\"color:red\">Fail (" + a + " not eq " + b + "): " + msg + "<span>";
}
}
};
var text = (new Array(10)).join("foo foo foo <br>"),
content = "<div>" + text + "</div>";
var testName,
finalSize,
initialSize = OpenLayers.Util.getRenderedDimensions(content, null);
// containerElement option on absolute position with width and height
testName = "Absolute with w&h: ";
var optionAbsDiv ={
containerElement: document.getElementById("absoluteDiv")
};
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv);
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
t.eq(finalSize.h, initialSize.h,
testName + "initial height " + initialSize.h + "px is maintained");
testName = "Absolute with w&h (set height): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv);
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
testName = "Absolute with w&h (set width): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv);
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
// containerElement option on absolute position without width and height
testName = "Absolute without w&h: ";
var optionAbsDiv00 ={
containerElement: document.getElementById("absoluteDiv00")
};
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv00);
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
t.eq(finalSize.h, initialSize.h,
testName + "initial height " + initialSize.h + "px is maintained");
testName = "Absolute without w&h (set height): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv00);
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
testName = "Absolute without w&h (set width): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv00);
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
} }
</script> </script>
</head> </head>
<body onload="run()"> <body onload="run()">
<div id="out"></div> <div id="out"></div>
<div id="absoluteDiv" style="position:absolute; left:10px; width:500px; height: 500px"></div>
<div id="absoluteDiv00" style="position:absolute; left:10px;"></div>
</body> </body>
</html> </html>
@@ -49,3 +49,15 @@ div.olControlZoom a:hover {
-o-transition: opacity 0.2s linear; -o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear; transition: opacity 0.2s linear;
} }
/* Enable 3d acceleration when operating on tiles, this is
known to yield better performance on IOS Safari.
http://osgeo-org.1803224.n2.nabble.com/Harware-accelerated-CSS3-animations-for-iOS-td6255560.html
It also prevents tile blinking effects in iOS 5.
See https://github.com/openlayers/openlayers/issues/511
*/
@media (-webkit-transform-3d) {
img.olTileImage {
-webkit-transform: translate3d(0, 0, 0);
}
}
+27 -5
View File
@@ -1,5 +1,28 @@
#!/bin/sh #!/bin/sh
#
#
# Usage:
# $ ./release.sh <release_number>
#
# Example:
# $ ./release.sh 2.12-rc7
#
# This script should be run on the www.openlayers.org server.
#
# What the script does:
#
# 1. Download release tarball from from GitHub.
# 2. Create builds using the Closure Compiler.
# 3. Run the exampleparser.py script to create the examples index.
# 4. Run csstidy for each CSS file in theme/default.
# 5. Publish builds and resources on api.openlayers.org.
# 6. Build the API docs.
# 7. Create release archives
# 8. Make the release archives available on openlayers.org/downloads.
#
#
VERSION=$1 VERSION=$1
wget -c http://closure-compiler.googlecode.com/files/compiler-latest.zip wget -c http://closure-compiler.googlecode.com/files/compiler-latest.zip
@@ -17,20 +40,19 @@ mv ../../compiler.jar ../tools/closure-compiler.jar
./build.py -c none full OpenLayers.debug.js ./build.py -c none full OpenLayers.debug.js
./build.py -c none mobile OpenLayers.mobile.debug.js ./build.py -c none mobile OpenLayers.mobile.debug.js
./build.py -c none light OpenLayers.light.debug.js ./build.py -c none light OpenLayers.light.debug.js
cp OpenLayers.js .. mv OpenLayers*.js ../
cp OpenLayers.*.js ..
rm ../tools/closure-compiler.jar rm ../tools/closure-compiler.jar
cd .. cd ..
cd tools cd tools
python exampleparser.py python exampleparser.py
cd .. cd ..
for i in google ie6-style style; do for i in google ie6-style style style.mobile; do
csstidy theme/default/$i.css --template=highest theme/default/$i.tidy.css csstidy theme/default/$i.css --template=highest theme/default/$i.tidy.css
done done
mkdir doc/devdocs mkdir -p doc/devdocs
mkdir doc/apidocs mkdir -p doc/apidocs
rm tools/*.pyc rm tools/*.pyc
mkdir -p /osgeo/openlayers/sites/openlayers.org/api/$VERSION mkdir -p /osgeo/openlayers/sites/openlayers.org/api/$VERSION