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

View File

@@ -60,6 +60,15 @@ def build(config_file = None, output_file = None, options = None):
print "\nAbnormal termination."
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
if use_compressor == "jsmin":
minimized = jsmin.jsmin(merged)
@@ -101,6 +110,14 @@ def build(config_file = None, output_file = None, options = None):
else: # fallback
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."
minimized = file("license.txt").read() + minimized
@@ -111,7 +128,10 @@ def build(config_file = None, output_file = None, options = None):
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.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()
if not len(args):
build(options=options)

View File

@@ -8,10 +8,12 @@ var map = new OpenLayers.Map({
div: "map",
layers: [
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, {
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: [

View File

@@ -29,12 +29,13 @@ function init() {
var fid, points = [], feature;
for (var i=0, len=e.features.length; i<len; i++) {
feature = e.features[i];
if (feature.fid !== fid || i === len-1) {
fid = feature.fid;
if ((fid && feature.fid !== fid) || i === len-1) {
this.addNodes(points, {silent: true});
points = [];
} else {
points.push(feature);
}
points.push(feature);
fid = feature.fid;
}
return false;
}

View File

@@ -11,7 +11,7 @@ var map = new OpenLayers.Map({
"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"
}
),
@@ -24,7 +24,7 @@ var map = new OpenLayers.Map({
"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"
}
)
@@ -33,4 +33,4 @@ var map = new OpenLayers.Map({
zoom: 1
});
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.LayerSwitcher());

View File

@@ -5,7 +5,7 @@
<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">
<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">
<script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-drawing.js"></script>

View File

@@ -8,7 +8,7 @@
<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/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">
<script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-base.js"></script>

View File

@@ -5,7 +5,7 @@
<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">
<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="mobile-layers.js"></script>
<style>

View File

@@ -6,7 +6,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<title>Mobile Navigation Example</title>
<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">
<script type="text/javascript" src="../lib/OpenLayers.js?mobile"></script>
<script type="text/javascript" src="mobile-navigation.js"></script>

View File

@@ -6,7 +6,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>OpenLayers with Sencha Touch</title>
<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">
<script src="http://cdn.sencha.io/touch/1.1.0/sencha-touch.js"></script>
<script src="mobile-sencha.js"></script>

View File

@@ -163,13 +163,13 @@ var map;
var doc = request.responseText,
caps = format.read(doc);
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(
{layer:"lb", requestEncoding:"REST", transitionEffect:"resize"}, defaults
{layer:"lb", transitionEffect:"resize"}, defaults
));
labels = format.createLayer(caps, OpenLayers.Util.applyDefaults(
{layer:"beschriftung", requestEncoding:"REST", className:"nofade", isBaseLayer: false},
{layer:"beschriftung", className:"nofade", isBaseLayer: false},
defaults
));
map.addLayers([fmzk, aerial, labels]);

View File

@@ -5,7 +5,7 @@
<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">
<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="mobile.js"></script>
<style>

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>

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);
}

View File

@@ -37,10 +37,8 @@
function init() {
map = new OpenLayers.Map('map');
var base = new OpenLayers.Layer.WMS("OpenLayers WMS",
["http://t3.tilecache.osgeo.org/wms-c/Basic.py",
"http://t2.tilecache.osgeo.org/wms-c/Basic.py",
"http://t1.tilecache.osgeo.org/wms-c/Basic.py"],
{layers: 'satellite'}
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'}
);
var style = new OpenLayers.Style({

View File

@@ -22,7 +22,8 @@
<div id="docs">
<p>
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>
See the <a href="wfs-states.js" target="_blank">wfs-states.js

View File

@@ -13,7 +13,13 @@ function init() {
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{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", {
minScale: 15000000,
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://demo.opengeo.org/geoserver/wfs",

View File

@@ -20,15 +20,15 @@
<h1 id="title">Web Map Tile Service (WMTS) Capabilities Parsing</h1>
<div id="tags">
wmts, capabilities, getcapabilities
</div>
</div>
<p id="shortdesc">
The WMTS Capabilities format allows for parsing of capabilities
documents from OGC Web Map Tile Service (WMTS) version 1.0.0
documents from OGC Web Map Tile Service (WMTS) version 1.0.0
implementations.
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
This example creates an OpenLayers.Layer.WMTS layer to based

View File

@@ -3,13 +3,13 @@ OpenLayers.ProxyHost = "/proxy/?url=";
var map, format;
function init() {
format = new OpenLayers.Format.WMTSCapabilities({
/**
* This particular service is not in compliance with the WMTS spec and
* is providing coordinates in y, x order regardless of the CRS. To
* work around this, we can provide the format a table of CRS URN that
* should be considered y, x order. These will extend the defaults on
* work around this, we can provide the format a table of CRS URN that
* should be considered y, x order. These will extend the defaults on
* the format.
*/
yx: {
@@ -38,22 +38,21 @@ function init() {
isBaseLayer: false
});
map.addLayer(layer);
},
},
failure: function() {
alert("Trouble getting capabilities doc");
OpenLayers.Console.error.apply(OpenLayers.Console, arguments);
}
});
map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913"
});
});
var osm = new OpenLayers.Layer.OSM();
map.addLayer(osm);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(-13677832, 5213272), 13);
}

View File

@@ -132,6 +132,7 @@
jsFiles = [
"OpenLayers/BaseTypes/Class.js",
"OpenLayers/Util.js",
"OpenLayers/Util/vendorPrefix.js",
"OpenLayers/Animation.js",
"OpenLayers/BaseTypes.js",
"OpenLayers/BaseTypes/Bounds.js",
@@ -414,4 +415,4 @@
/**
* Constant: VERSION_NUMBER
*/
OpenLayers.VERSION_NUMBER="Release 2.12-rc5";
OpenLayers.VERSION_NUMBER="Release 2.13 dev";

View File

@@ -5,6 +5,7 @@
* full text of the license.
*
* @requires OpenLayers/SingleFile.js
* @requires OpenLayers/Util/vendorPrefix.js
*/
/**
@@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
* Property: isNative
* {Boolean} true if a native requestAnimationFrame function is available
*/
var isNative = !!(window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame);
var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
var isNative = !!(requestAnimationFrame);
/**
* Function: requestFrame
@@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
* element - {DOMElement} Optional element that visually bounds the animation.
*/
var requestFrame = (function() {
var request = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
var request = window[requestAnimationFrame] ||
function(callback, element) {
window.setTimeout(callback, 16);
};

View File

@@ -75,6 +75,14 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
*/
defaultKeyPress: function (evt) {
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) {
case OpenLayers.Event.KEY_LEFT:
this.map.pan(-this.slideFactor, 0);

View File

@@ -7,6 +7,9 @@
* @requires OpenLayers/Control.js
* @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Events/buttonclick.js
* @requires OpenLayers/Map.js
* @requires OpenLayers/Handler/Click.js
* @requires OpenLayers/Handler/Drag.js
*/
/**

View File

@@ -99,6 +99,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.un({
"changebaselayer": this.redraw,
"updatesize": this.redraw,
scope: this
});
@@ -116,7 +117,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
*/
setMap: function(map) {
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) {
var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
var id = this.id + "_" + this.map.id;
var minZoom = this.map.getMinZoom();
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
@@ -211,7 +217,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
var sz = {
w: this.zoomStopWidth,
h: this.zoomStopHeight * this.map.getNumZoomLevels()
h: this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom)
};
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
var div = null;
@@ -242,7 +248,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.map.events.register("zoomend", this, this.moveZoomBar);
centered = centered.add(0,
this.zoomStopHeight * this.map.getNumZoomLevels());
this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom));
return centered;
},

View File

@@ -4,6 +4,7 @@
* full text of the license. */
/**
* @requires OpenLayers/Util/vendorPrefix.js
* @requires OpenLayers/Handler/Pinch.js
*/
@@ -162,8 +163,10 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
*/
applyTransform: function(transform) {
var style = this.map.layerContainerDiv.style;
style['-webkit-transform'] = transform;
style['-moz-transform'] = transform;
var transformProperty = OpenLayers.Util.vendorPrefix.style("transform");
if (transformProperty) {
style[transformProperty] = transform;
}
},
/**

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
* (instead of configuration objects), the defaults from the <defaults>
* 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
* the layer given in the constructor (as <layer>) will become the
* initial target.

View File

@@ -240,7 +240,7 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, {
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
if(deactivated) {
if(this.source && this.source.events) {
this.layer.events.un({
this.source.events.un({
sketchcomplete: this.onSketchComplete,
afterfeaturemodified: this.afterFeatureModified,
scope: this

View File

@@ -37,9 +37,9 @@ OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: zoomOutText
* {String}
* Text for zoom-out link. Default is "-".
* Text for zoom-out link. Default is "\u2212".
*/
zoomOutText: "-",
zoomOutText: "\u2212",
/**
* APIProperty: zoomOutId

View File

@@ -41,9 +41,17 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
/**
* 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,
/**
* APIProperty: zoomOnClick
* {Boolean} Should we zoom when no box was dragged, i.e. the user only
* clicked? Default is true.
*/
zoomOnClick: true,
/**
* Method: draw
@@ -93,7 +101,7 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
}
} else { // it's a pixel
} else if (this.zoomOnClick) { // it's a pixel
if (!this.out) {
this.map.setCenter(this.map.getLonLatFromPixel(position),
this.map.getZoom() + 1);

View File

@@ -167,11 +167,7 @@ OpenLayers.Event = {
stop: function(event, allowDefault) {
if (!allowDefault) {
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
OpenLayers.Event.preventDefault(event);
}
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
*

View File

@@ -121,6 +121,26 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
} while(--depth > 0 && element);
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
@@ -170,6 +190,7 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
propagate = false;
}
} else {
propagate = !this.ignore(OpenLayers.Event.element(evt));
delete this.startEvt;
}
}

View File

@@ -230,7 +230,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
}
return OpenLayers.Format.XML.prototype.readNode.apply(this, [node, obj]);
},
/**
* Property: readers
* Contains public functions, grouped by namespace prefix, that will
@@ -241,6 +241,9 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
*/
readers: {
"gml": {
"_inherit": function(node, obj, container) {
// To be implemented by version specific parsers
},
"featureMember": function(node, obj) {
this.readChildNodes(node, obj);
},
@@ -309,6 +312,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"MultiPoint": function(node, container) {
var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.MultiPoint(obj.components)
@@ -319,6 +323,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"LineString": function(node, container) {
var obj = {};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
if(!container.components) {
container.components = [];
@@ -329,6 +334,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"MultiLineString": function(node, container) {
var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.MultiLineString(obj.components)
@@ -339,6 +345,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"Polygon": function(node, container) {
var obj = {outer: null, inner: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
obj.inner.unshift(obj.outer);
if(!container.components) {
@@ -350,6 +357,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"LinearRing": function(node, obj) {
var container = {};
this.readers.gml._inherit.apply(this, [node, container]);
this.readChildNodes(node, container);
obj.components = [new OpenLayers.Geometry.LinearRing(
container.points
@@ -357,6 +365,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"MultiPolygon": function(node, container) {
var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.MultiPolygon(obj.components)
@@ -367,6 +376,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
},
"GeometryCollection": function(node, container) {
var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
container.components = [
new OpenLayers.Geometry.Collection(obj.components)

View File

@@ -90,11 +90,20 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
*/
readers: {
"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) {
this.readChildNodes(node, obj);
},
"Curve": function(node, container) {
var obj = {points: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
if(!container.components) {
container.components = [];
@@ -135,7 +144,9 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
this.regExes.trimSpace, ""
);
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 numPoints = coords.length / dim;
var points = new Array(numPoints);
@@ -172,6 +183,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
},
"MultiCurve": function(node, container) {
var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
if(obj.components.length > 0) {
container.components = [
@@ -184,6 +196,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
},
"MultiSurface": function(node, container) {
var obj = {components: []};
this.readers.gml._inherit.apply(this, [node, obj, container]);
this.readChildNodes(node, obj);
if(obj.components.length > 0) {
container.components = [

View File

@@ -5,6 +5,7 @@
/**
* @requires OpenLayers/Format/XML.js
* @requires OpenLayers/Format/OGCExceptionReport.js
*/
/**
@@ -187,8 +188,13 @@ OpenLayers.Format.WFSDescribeFeatureType = OpenLayers.Class(
data = data.documentElement;
}
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;
},

View File

@@ -6,27 +6,27 @@
/**
* @requires OpenLayers/Format/XML/VersionedOGC.js
*/
/**
* Class: OpenLayers.Format.WMTSCapabilities
* Read WMTS Capabilities.
*
*
* Inherits from:
* - <OpenLayers.Format.XML.VersionedOGC>
*/
OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, {
/**
* APIProperty: defaultVersion
* {String} Version number to assume if none found. Default is "1.0.0".
*/
defaultVersion: "1.0.0",
/**
* APIProperty: yx
* {Object} Members in the yx object are used to determine if a CRS URN
* corresponds to a CRS with y,x axis order. Member names are CRS URNs
* and values are boolean. By default, the following CRS URN are
* and values are boolean. By default, the following CRS URN are
* assumed to correspond to a CRS with y,x axis order:
*
* * urn:ogc:def:crs:EPSG::4326
@@ -48,8 +48,8 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
* APIMethod: read
* Read capabilities data from a string, and return information about
* the service (offering and observedProperty mostly).
*
* Parameters:
*
* Parameters:
* data - {String} or {DOMElement} data to read/parse.
*
* Returns:
@@ -61,36 +61,34 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
* Create a WMTS layer given a capabilities object.
*
* Parameters:
* capabilities - {Object} The object returned from a <read> call to this
* capabilities - {Object} The object returned from a <read> call to this
* format.
* config - {Object} Configuration properties for the layer. Defaults for
* the layer will apply if not provided.
*
* Required config properties:
* 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:
* {<OpenLayers.Layer.WMTS>} A properly configured WMTS layer. Throws an
* error if an incomplete config is provided. Returns undefined if no
* layer could be created with the provided config.
*/
*/
createLayer: function(capabilities, config) {
var layer;
// confirm required properties are supplied in config
var required = {
layer: true,
matrixSet: true
};
for (var prop in required) {
if (!(prop in config)) {
throw new Error("Missing property '" + prop + "' in layer configuration.");
}
if (!('layer' in config)) {
throw new Error("Missing property 'layer' in configuration.");
}
var contents = capabilities.contents;
var matrixSet = contents.tileMatrixSets[config.matrixSet];
// find the layer definition with the given identifier
var layers = contents.layers;
@@ -101,32 +99,97 @@ OpenLayers.Format.WMTSCapabilities = OpenLayers.Class(OpenLayers.Format.XML.Vers
break;
}
}
if (layerDef && matrixSet) {
// 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;
if (!layerDef) {
throw new Error("Layer not found");
}
// find the matrixSet definition
var matrixSet;
if (config.matrixSet) {
matrixSet = contents.tileMatrixSets[config.matrixSet];
} else if (layerDef.tileMatrixSetLinks.length == 1) {
matrixSet = contents.tileMatrixSets[
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"
});

View File

@@ -127,6 +127,10 @@ OpenLayers.Format.WPSDescribeProcess = OpenLayers.Class(
output.complexOutput = {};
this.readChildNodes(node, output.complexOutput);
},
"LiteralOutput": function(node, output) {
output.literalOutput = {};
this.readChildNodes(node, output.literalOutput);
},
"Input": function(node, dataInputs) {
var input = {
maxOccurs: parseInt(node.getAttribute("maxOccurs")),

View File

@@ -93,6 +93,28 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
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
* 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
}
});
if (responseDocument.output) {
this.writeNode("wps:Output", responseDocument.output, node);
if (responseDocument.outputs) {
for (var i = 0, len = responseDocument.outputs.length; i < len; i++) {
this.writeNode("wps:Output", responseDocument.outputs[i], node);
}
}
return node;
},
"Output": function(output) {
var node = this.createElementNSPlus("wps:Output", {
attributes: {
asReference: output.asReference
asReference: output.asReference,
mimeType: output.mimeType,
encoding: output.encoding,
schema: output.schema
}
});
this.writeNode("ows:Identifier", output.identifier, node);
@@ -150,7 +177,9 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
"RawDataOutput": function(rawDataOutput) {
var node = this.createElementNSPlus("wps:RawDataOutput", {
attributes: {
mimeType: rawDataOutput.mimeType
mimeType: rawDataOutput.mimeType,
encoding: rawDataOutput.encoding,
schema: rawDataOutput.schema
}
});
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);
} else if (data.complexData) {
this.writeNode("wps:ComplexData", data.complexData, node);
} else if (data.boundingBoxData) {
this.writeNode("ows:BoundingBox", data.boundingBoxData, node);
}
return node;
},
@@ -256,6 +287,107 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, {
"ogc": OpenLayers.Format.Filter.v1_1_0.prototype.writers.ogc,
"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"

View File

@@ -172,7 +172,8 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
this.down(evt);
this.callback("down", [evt.xy]);
OpenLayers.Event.stop(evt);
// prevent document dragging
OpenLayers.Event.preventDefault(evt);
if(!this.oldOnselectstart) {
this.oldOnselectstart = document.onselectstart ?

View File

@@ -103,7 +103,7 @@ OpenLayers.Handler.Pinch = OpenLayers.Class(OpenLayers.Handler, {
this.last = null;
}
// prevent document dragging
OpenLayers.Event.stop(evt);
OpenLayers.Event.preventDefault(evt);
return propagate;
},

View File

@@ -87,7 +87,9 @@ OpenLayers.Layer = OpenLayers.Class({
*
* Supported map event types:
* 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.
* move - Triggered when layer moves (triggered with every mousemove
* during a drag).
@@ -119,7 +121,7 @@ OpenLayers.Layer = OpenLayers.Class({
/**
* Property: alpha
* {Boolean} The layer's images have an alpha channel. Default is false.
* {Boolean} The layer's images have an alpha channel. Default is false.
*/
alpha: false,

View File

@@ -13,7 +13,7 @@
* This Layer reads from UTFGrid tiled data sources. Since UTFGrids are
* 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
* <OpenLayers.Control.UTFGrid> ontrol as well.
* <OpenLayers.Control.UTFGrid> control as well.
*
* Example:
*

View File

@@ -106,6 +106,7 @@ OpenLayers.Layer.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, {
*
* Matrix properties:
* identifier - {String} The matrix identifier (required).
* scaleDenominator - {Number} The matrix scale denominator.
* topLeftCorner - {<OpenLayers.LonLat>} The top left corner of the
* matrix. Must be provided if different than the layer <tileOrigin>.
* tileWidth - {Number} The tile width for the matrix. Must be provided

View File

@@ -105,6 +105,7 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
initializeZoomify: function( size ) {
var imageSize = size.clone();
this.size = size.clone();
var tiles = new OpenLayers.Size(
Math.ceil( imageSize.w / this.standardTileSize ),
Math.ceil( imageSize.h / this.standardTileSize )
@@ -132,14 +133,18 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
this.tierImageSize.reverse();
this.numberOfTiers = this.tierSizeInTiles.length;
var resolutions = [1];
this.tileCountUpToTier = [0];
for (var i = 1; i < this.numberOfTiers; i++) {
resolutions.unshift(Math.pow(2, i));
this.tileCountUpToTier.push(
this.tierSizeInTiles[i-1].w * this.tierSizeInTiles[i-1].h +
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) {
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 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 path = "TileGroup" + Math.floor( (tileIndex) / 256 ) +
@@ -219,10 +224,10 @@ OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
getImageSize: function() {
if (arguments.length > 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 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 h = this.standardTileSize;
if (x == this.tierSizeInTiles[z].w -1 ) {

View File

@@ -83,6 +83,7 @@ OpenLayers.Map = OpenLayers.Class({
* mouseout - triggered after mouseout the map
* mousemove - triggered after mousemove the map
* changebaselayer - triggered after the base layer changes
* updatesize - triggered after the <updateSize> method was executed
*/
/**
@@ -375,6 +376,13 @@ OpenLayers.Map = OpenLayers.Class({
* Default is to fall through.
*/
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
@@ -577,16 +585,11 @@ OpenLayers.Map = OpenLayers.Class({
if(this.eventListeners instanceof Object) {
this.events.on(this.eventListeners);
}
// Because Mozilla does not support the "resize" event for elements
// other than "window", we need to put a hack here.
if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 9) {
// If IE < 9, register the resize on the div
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.
if (this.autoUpdateSize === true) {
// 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);
OpenLayers.Event.observe(window, 'resize',
@@ -746,9 +749,7 @@ OpenLayers.Map = OpenLayers.Class({
if (this.updateSizeDestroy) {
OpenLayers.Event.stopObserving(window, 'resize',
this.updateSizeDestroy);
} else {
this.events.unregister("resize", this, this.updateSize);
}
}
this.paddingForPopups = null;
@@ -1490,6 +1491,7 @@ OpenLayers.Map = OpenLayers.Class({
}
}
this.events.triggerEvent("updatesize");
},
/**
@@ -1784,18 +1786,42 @@ OpenLayers.Map = OpenLayers.Class({
* <baseLayer>'s maxExtent.
*/
adjustZoom: function(zoom) {
var resolution, resolutions = this.baseLayer.resolutions,
maxResolution = this.getMaxExtent().getWidth() / this.size.w;
if (this.getResolutionForZoom(zoom) > maxResolution) {
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) {
if (resolutions[i] <= maxResolution) {
zoom = i;
break;
}
if (this.baseLayer && this.baseLayer.wrapDateLine) {
var resolution, resolutions = this.baseLayer.resolutions,
maxResolution = this.getMaxExtent().getWidth() / this.size.w;
if (this.getResolutionForZoom(zoom) > maxResolution) {
if (this.fractionalZoom) {
zoom = this.getZoomForResolution(maxResolution);
} else {
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) {
if (resolutions[i] <= maxResolution) {
zoom = i;
break;
}
}
}
}
}
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
@@ -1818,13 +1844,11 @@ OpenLayers.Map = OpenLayers.Class({
zoom = Math.round(zoom);
}
}
if (this.baseLayer.wrapDateLine) {
var requestedZoom = zoom;
zoom = this.adjustZoom(zoom);
if (zoom !== requestedZoom) {
// zoom was adjusted, so keep old lonlat to avoid panning
lonlat = this.getCenter();
}
var requestedZoom = zoom;
zoom = this.adjustZoom(zoom);
if (zoom !== requestedZoom) {
// zoom was adjusted, so keep old lonlat to avoid panning
lonlat = this.getCenter();
}
// dragging is false by default
var dragging = options.dragging || this.dragging;

View File

@@ -694,7 +694,7 @@ OpenLayers.Popup = OpenLayers.Class({
}
OpenLayers.Event.stopObserving(
this.img, "load", this.img._onImageLoad
this.img, "load", this.img._onImgLoad
);
};

View File

@@ -62,7 +62,7 @@ OpenLayers.Projection = OpenLayers.Class({
initialize: function(projCode, options) {
OpenLayers.Util.extend(this, options);
this.projCode = projCode;
if (window.Proj4js) {
if (typeof Proj4js == "object") {
this.proj = new Proj4js.Proj(projCode);
}
},
@@ -115,7 +115,7 @@ OpenLayers.Projection = OpenLayers.Class({
if (!(p instanceof OpenLayers.Projection)) {
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, "") ==
p.proj.defData.replace(this.titleRegEx, "");
} else if (p.getCode) {

View File

@@ -284,7 +284,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
node.setAttributeNS(null, "height", height);
node.setAttributeNS(this.xlinkns, "href", style.externalGraphic);
node.setAttributeNS(null, "style", "opacity: "+opacity);
node.onclick = OpenLayers.Renderer.SVG.preventDefault;
node.onclick = OpenLayers.Event.preventDefault;
} else if (this.isComplexSymbol(style.graphicName)) {
// the symbol viewBox is three times as large as the symbol
var offset = style.pointRadius * 3;
@@ -1000,9 +1000,10 @@ OpenLayers.Renderer.SVG.LABEL_VFACTOR = {
/**
* 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
* ctrl-click) from being executed for externalGraphic symbols
*/
OpenLayers.Renderer.SVG.preventDefault = function(e) {
e.preventDefault && e.preventDefault();
OpenLayers.Event.preventDefault(e);
};

View File

@@ -7,7 +7,7 @@ var OpenLayers = {
/**
* Constant: VERSION_NUMBER
*/
VERSION_NUMBER: "Release 2.12-rc5",
VERSION_NUMBER: "Release 2.13 dev",
/**
* Constant: singleFile

View File

@@ -278,7 +278,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
this.layer.addFeatures(features);
}
this.response = null;
this.layer.events.triggerEvent("loadend");
this.layer.events.triggerEvent("loadend", {response: resp});
},
CLASS_NAME: "OpenLayers.Strategy.BBOX"

View File

@@ -106,7 +106,8 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, {
*
* Parameters:
* 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) {
var layer = this.layer;
@@ -124,7 +125,7 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, {
}
layer.addFeatures(features);
}
layer.events.triggerEvent("loadend");
layer.events.triggerEvent("loadend", {response: resp});
},
CLASS_NAME: "OpenLayers.Strategy.Fixed"

View File

@@ -1535,6 +1535,33 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
var containerElement = (options && options.containerElement)
? 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.
if (size) {
@@ -1569,25 +1596,10 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
container.appendChild(content);
// append container to body for rendering
containerElement.appendChild(container);
// Opera and IE7 can't handle a node with position:aboslute if it inherits
// position:absolute from a parent.
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";
if (superContainer) {
containerElement.appendChild(superContainer);
} else {
containerElement.appendChild(container);
}
// calculate scroll width of content and add corners and shadow width
@@ -1604,7 +1616,12 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
// remove elements
container.removeChild(content);
containerElement.removeChild(container);
if (superContainer) {
superContainer.removeChild(container);
containerElement.removeChild(superContainer);
} else {
containerElement.removeChild(container);
}
return new OpenLayers.Size(w, h);
};

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
};
}());

View File

@@ -25,6 +25,16 @@ Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/254
* 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
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:
.olLayerGridTile .olTileImage {
.olLayerGrid .olTileImage {
-webkit-transition: none;
-moz-transition: none;
-o-transition: all 0 none;
@@ -85,6 +95,19 @@ Corresponding issues/pull requests:
* 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
The tiling code has been overhauled so tile loading in grid layers is now done in a queue.

View File

@@ -35,3 +35,13 @@ Corresponding issue/pull requests:
* 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

View File

@@ -6,6 +6,7 @@
// dependencies for tests
var OpenLayers = [
"OpenLayers/Util/vendorPrefix.js",
"OpenLayers/Animation.js"
];

View File

@@ -33,6 +33,31 @@
map.addControl(control2, new OpenLayers.Pixel(100,100));
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) {
t.plan(2);

View File

@@ -104,13 +104,18 @@
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),
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");
map.addLayer(layer);
map.addLayer(layer1);
map.addLayer(layer2);
map.zoomToMaxExtent();
map.addControl(control);
@@ -124,17 +129,17 @@
t.eq(control.handler.active, false, "sketch handler deactivated");
// set a source layer
control.setSource(layer);
control.setSource(layer2);
// activate and check that listeners are registered
control.activate();
t.ok(layer.events.listeners.sketchcomplete, "sketchcomplete listener registered");
t.ok(layer.events.listeners.afterfeaturemodified, "afterfeaturemodified listener registered");
t.ok(layer2.events.listeners.sketchcomplete, "sketchcomplete listener registered");
t.ok(layer2.events.listeners.afterfeaturemodified, "afterfeaturemodified listener registered");
// deactivate and confirm no draw related events
control.deactivate();
t.eq(layer.events.listeners.sketchcomplete.length, 0, "no sketchcomplete listeners");
t.eq(layer.events.listeners.afterfeaturemodified.length, 0, "no afterfeaturemodified listeners");
t.eq(layer2.events.listeners.sketchcomplete.length, 0, "no sketchcomplete listeners");
t.eq(layer2.events.listeners.afterfeaturemodified.length, 0, "no afterfeaturemodified listeners");
map.destroy();
}

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>

View File

@@ -63,6 +63,40 @@
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) {
t.plan(27);
events = new OpenLayers.Events({}, element);

View File

@@ -198,14 +198,19 @@ var cases = {
])
])
]),
"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, {
"v3/point.xml": cases["v2/point-coordinates.xml"],
"v3/linestring.xml": cases["v2/linestring-coordinates.xml"],

View File

@@ -10,8 +10,8 @@
"v2/linestring-coord.xml", "v2/linestring-coordinates.xml",
"v2/multipoint-coord.xml", "v2/multipoint-coordinates.xml",
"v2/multilinestring-coord.xml", "v2/multilinestring-coordinates.xml",
"v3/point.xml", "v3/linestring.xml", "v3/curve.xml",
"v3/polygon.xml", "v3/surface.xml",
"v3/point.xml", "v3/linestring.xml", "v3/linestring3d.xml",
"v3/curve.xml", "v3/polygon.xml", "v3/surface.xml",
"v3/multipoint-singular.xml", "v3/multipoint-plural.xml",
"v3/multilinestring-singular.xml", "v3/multilinestring-plural.xml",
"v3/multicurve-singular.xml", "v3/multicurve-curve.xml",
@@ -332,6 +332,11 @@
<gml:posList>1 2 3 4</gml:posList>
</gml:LineString>
--></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"><!--
<gml:Curve xmlns:gml="http://www.opengis.net/gml" srsName="foo">
<gml:segments>

View File

@@ -20,6 +20,10 @@
}
function test_Format_GPX_read(t) {
t.plan(7);
var origDefaultPrecision = OpenLayers.Util.DEFAULT_PRECISION;
OpenLayers.Util.DEFAULT_PRECISION = 9;
var expected,
P = OpenLayers.Geometry.Point,
LS = OpenLayers.Geometry.LineString;
@@ -61,6 +65,8 @@
new P(-19493.373203291227, 6684644.845706556)
]);
t.geom_eq(features[1].geometry, expected, "transformed route feature correctly created");
OpenLayers.Util.DEFAULT_PRECISION = origDefaultPrecision;
}
function test_format_GPX_read_attributes(t) {
t.plan(2);

View File

@@ -374,8 +374,24 @@
// 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>
</head>
<body>
</body>
</html>
</html>

View File

@@ -43,15 +43,15 @@
undefined,
"ows:OperationsMetadata GetTile Constraints Get is correct");
}
function test_layers(t) {
t.plan(37);
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
var obj = new OpenLayers.Format.WMTSCapabilities().read(doc);
var contents = obj.contents;
var numOfLayers = contents.layers.length;
t.eq(numOfLayers, 1, "correct count of layers");
@@ -89,11 +89,11 @@
t.eq(wgs84Bbox.top, 90.0, "wgs84BoudingBox top is correct");
t.eq(layer.resourceUrl.tile.format, "image/png", "resourceUrl.tile.format is correct");
t.eq(layer.resourceUrl.tile.template, "http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png",
t.eq(layer.resourceUrl.tile.template, "http://www.example.com/wmts/coastlines/{TileMatrix}/{TileRow}/{TileCol}.png",
"resourceUrl.tile.template is correct");
t.eq(layer.resourceUrl.FeatureInfo.format, "application/gml+xml; version=3.1", "resourceUrl.FeatureInfo.format is correct");
t.eq(layer.resourceUrl.FeatureInfo.template, "http://www.example.com/wmts/coastlines/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml",
t.eq(layer.resourceUrl.FeatureInfo.template, "http://www.example.com/wmts/coastlines/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml",
"resourceUrl.FeatureInfo.template is correct");
var dimensions = layer.dimensions;
@@ -112,7 +112,7 @@
t.plan(19);
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
var obj = new OpenLayers.Format.WMTSCapabilities().read(doc);
var tileMatrixSets = obj.contents.tileMatrixSets;
@@ -138,54 +138,154 @@
t.eq(bigWorld.matrixIds[1].topLeftCorner.lon, -180, "tileMatrix 1 topLeftCorner.lon is correct");
t.eq(bigWorld.matrixIds[1].topLeftCorner.lat, 84, "tileMatrix 1 topLeftCorner.lat is correct");
}
function test_createLayer(t) {
t.plan(7);
t.plan(34);
var format = new OpenLayers.Format.WMTSCapabilities();
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
var caps = format.read(doc);
var layer;
var success = true;
try {
// incomplete config (missing matrixSet)
// incomplete config (missing layer)
layer = format.createLayer(caps, {
layer: "coastlines"
});
} catch (err) {
success = false;
}
t.ok(!success, "createLayer throws error if provided incomplete layer config");
// bogus layer identifier
layer = format.createLayer(caps, {
layer: "foo",
matrixSet: "BigWorld"
});
t.eq(layer, undefined, "createLayer returns undefined given bad layer identifier");
try {
layer = format.createLayer(caps, {
layer: "foo",
matrixSet: "BigWorld"
});
} catch (err) {
success = false;
}
t.ok(!success, "createLayer returns undefined given bad layer identifier");
// bogus matrixSet identifier
layer = format.createLayer(caps, {
layer: "coastlines",
matrixSet: "TheWorld"
});
t.eq(layer, undefined, "createLayer returns undefined given bad matrixSet identifier");
try {
layer = format.createLayer(caps, {
layer: "coastlines",
matrixSet: "TheWorld"
});
} catch (err) {
success = false;
}
t.ok(!success, "createLayer returns undefined given bad matrixSet identifier");
layer = format.createLayer(caps, {
layer: "coastlines",
matrixSet: "BigWorld"
});
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.name, "Coastlines", "correct layer title");
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>
</head>
<body>
@@ -300,15 +400,15 @@ http://schemas.opengis.net/wmts/1.0/examples/wmtsGetCapabilities_response.xml
<TileMatrixSet>BigWorld</TileMatrixSet>
</TileMatrixSetLink>
</Layer>
<TileMatrixSet>
<TileMatrixSet>
<ows:Identifier>BigWorld</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:OGC:1.3:CRS84</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>1e6</ows:Identifier>
<ScaleDenominator>1e6</ScaleDenominator>
<TopLeftCorner>-180 84</TopLeftCorner>
<ScaleDenominator>1e6</ScaleDenominator>
<TopLeftCorner>-180 84</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<TileHeight>256</TileHeight>
<MatrixWidth>60000</MatrixWidth>
<MatrixHeight>50000</MatrixHeight>
</TileMatrix>
@@ -354,5 +454,284 @@ http://schemas.opengis.net/wmts/1.0/examples/wmtsGetCapabilities_response.xml
</Themes>
</Capabilities>
--></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>
</html>

View File

@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_read_WPSDescribeProcess(t) {
t.plan(16);
t.plan(17);
var parser = new OpenLayers.Format.WPSDescribeProcess();
var text =
@@ -109,6 +109,13 @@
' </Supported>' +
' </ComplexOutput>' +
' </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>' +
' </ProcessDescription>' +
'</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["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"?>' +
'<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"' +

View File

@@ -309,12 +309,12 @@
responseForm: {
responseDocument: {
storeExecuteResponse: true,
output: {
outputs: [{
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
}
}]
}
}
});
@@ -349,6 +349,11 @@
' <ows:Title>Area serviced by playground.</ows:Title>' +
' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
' </wps:Output>' +
' <wps:Output>' +
' <ows:Identifier>literal</ows:Identifier>' +
' <ows:Title/>' +
' <ows:Abstract/>' +
' </wps:Output>' +
' </wps:ResponseDocument>' +
' </wps:ResponseForm>' +
'</wps:Execute>';
@@ -381,12 +386,17 @@
storeExecuteResponse: true,
lineage: true,
status: true,
output: {
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
}
outputs: [
{
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
},
{
identifier: 'literal'
}
]
}
}
});
@@ -461,12 +471,12 @@
responseForm: {
responseDocument: {
storeExecuteResponse: true,
output: {
outputs: [{
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
}
}]
}
}
});

View File

@@ -117,7 +117,7 @@
handler.activate();
var oldIsLeftClick = OpenLayers.Event.isLeftClick;
var oldStop = OpenLayers.Event.stop;
var oldPreventDefault = OpenLayers.Event.preventDefault;
var oldCheckModifiers = handler.checkModifiers;
// test mousedown with right click
@@ -163,15 +163,9 @@
"mousedown calls isLeftClick with the proper event");
return true;
}
OpenLayers.Event.stop = function(evt, allowDefault) {
if(!allowDefault) {
t.ok(evt.xy.x == testEvents.down.xy.x &&
evt.xy.y == testEvents.down.xy.y,
"mousedown default action is disabled");
} else {
t.fail(
"mousedown is prevented from falling to other elements");
}
OpenLayers.Event.preventDefault = function(evt) {
t.ok(evt.xy.x == testEvents.down.xy.x && evt.xy.y == testEvents.down.xy.y,
"mousedown default action is disabled");
}
map.events.triggerEvent("mousedown", testEvents.down);
t.ok(handler.started, "mousedown sets the started flag to true");
@@ -183,7 +177,7 @@
handler.last.y == testEvents.down.xy.y,
"mouse down sets handler.last correctly");
OpenLayers.Event.stop = oldStop;
OpenLayers.Event.preventDefault = oldPreventDefault;
OpenLayers.Event.isLeftClick = oldIsLeftClick;
handler.checkModifiers = oldCheckModifiers;
@@ -292,7 +286,7 @@
function test_Handler_Drag_touch(t) {
// In this test we verify that "touchstart", "touchmove", and
// "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);
@@ -308,8 +302,8 @@
});
h.activate();
var _stop = OpenLayers.Event.stop;
OpenLayers.Event.stop = function(e) {
var _preventDefault = OpenLayers.Event.preventDefault;
OpenLayers.Event.preventDefault = function(e) {
log.push(e);
};
@@ -343,7 +337,7 @@
// tear down
OpenLayers.Event.stop = _stop;
OpenLayers.Event.preventDefault = _preventDefault;
m.destroy();
}

View File

@@ -126,9 +126,9 @@
map.zoomToMaxExtent();
t.delay_call(2, function() {
t.ok(layer.attribution.indexOf('olBingAttribution aerial') !== -1, "Attribution has the correct css class");
t.ok(layer.attribution.indexOf('<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, 'olBingAttribution aerial') !== -1, "Attribution has the correct css class");
t.ok(OpenLayers.Util.indexOf(layer.attribution, '<img src="">') == -1, "Attribution contains a logo");
t.ok(OpenLayers.Util.indexOf(layer.attribution, '</img></div></a><a style=') == -1 , "Attribution contains a copyright");
map.destroy();
});
}

View File

@@ -1362,7 +1362,7 @@
t.plan(5);
// set up
var map = new OpenLayers.Map('map', {
resolutions: [32, 16, 8, 4, 2, 1]
});
@@ -1375,28 +1375,28 @@
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,
'[a] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId !== null,
'[a] back buffer scheduled for removal');
t.ok(layer.backBuffer.parentNode === layer.div,
'[a] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId !== null,
'[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,
'[b] a new back buffer was created');
t.ok(layer.backBuffer.parentNode === layer.div,
'[b] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId === null,
'[b] back buffer no longer scheduled for removal');
t.ok(layer.backBuffer !== backBuffer,
'[b] a new back buffer was created');
t.ok(layer.backBuffer.parentNode === layer.div,
'[b] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId === null,
'[b] back buffer no longer scheduled for removal');
// tear down
// tear down
map.destroy();
});
map.destroy();
}
function test_getGridData(t) {

View File

@@ -2047,7 +2047,7 @@
}
function test_adjustZoom(t) {
t.plan(4);
t.plan(5);
var map = new OpenLayers.Map({
div: 'map',
layers: [
@@ -2062,6 +2062,9 @@
t.eq(map.adjustZoom(9), 9, "valid zoom maintained");
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);
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");
}
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>
</head>
<body>

View File

@@ -44,7 +44,7 @@
// conditionally mock up proj4js
var hasProj = !!window.Proj4js;
if (!hasProj) {
window.Proj4js = true;
window.Proj4js = {};
}
proj1.proj = {defData: "+title= WGS84 +foo=bar +x=0"};
proj2.proj = {defData: "+title=FOO +foo=bar +x=0", srsCode: "FOO"};

View File

@@ -112,43 +112,46 @@
function test_events(t) {
t.plan(3);
var log = {
loadstart: 0,
loadend: 0
};
t.plan(6);
var log = [];
var response = new OpenLayers.Protocol.Response();
var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol({
read: function(config) {
config.callback.call(config.scope, {});
config.callback.call(config.scope, response);
}
}),
isBaseLayer: true,
eventListeners: {
loadstart: function() {
++log.loadstart;
loadstart: function(event) {
log.push(event);
},
loadend: function() {
++log.loadend;
loadend: function(event) {
log.push(event);
}
}
});
map.addLayer(layer);
map.zoomToMaxExtent();
t.eq(log.length, 2, "2 events logged");
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");
t.eq(log.loadstart, 1, "loadstart triggered");
t.eq(log.loadend, 1, "loadend triggered");
log = {};
var calls = [];
layer.protocol.read = function(obj) {
log.obj = obj;
calls.push(obj);
}
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();

View File

@@ -62,44 +62,47 @@
function test_events(t) {
t.plan(3);
t.plan(6);
var log = {
loadstart: 0,
loadend: 0
};
var log = [];
var response = new OpenLayers.Protocol.Response();
var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol({
read: function(config) {
config.callback.call(config.scope, {});
config.callback.call(config.scope, response);
}
}),
isBaseLayer: true,
eventListeners: {
loadstart: function() {
++log.loadstart;
loadstart: function(event) {
log.push(event);
},
loadend: function() {
++log.loadend;
loadend: function(event) {
log.push(event);
}
}
});
map.addLayer(layer);
map.zoomToMaxExtent();
t.eq(log.length, 2, "2 events logged");
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");
t.eq(log.loadstart, 1, "loadstart triggered");
t.eq(log.loadend, 1, "loadend triggered");
var log = {};
var calls = [];
layer.protocol.read = function(obj) {
log.obj = obj;
calls.push(obj);
}
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();

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>

View File

@@ -46,13 +46,10 @@
<li>Control/UTFGrid.html</li>
<li>Control/WMSGetFeatureInfo.html</li>
<li>Control/WMTSGetFeatureInfo.html</li>
<li>Control/Pan.html</li>
<li>Control/PanPanel.html</li>
<li>Control/SLDSelect.html</li>
<li>Control/Zoom.html</li>
<li>Control/ZoomIn.html</li>
<li>Control/ZoomOut.html</li>
<li>Control/ZoomToMaxExtent.html</li>
<li>Control/ZoomBox.html</li>
<li>Events.html</li>
<li>Events/buttonclick.html</li>
<li>Extras.html</li>
@@ -234,6 +231,7 @@
<li>Tween.html</li>
<li>Kinetic.html</li>
<li>Util.html</li>
<li>Util/vendorPrefix.html</li>
<li>deprecated/Ajax.html</li>
<li>deprecated/Util.html</li>
<li>deprecated/BaseTypes/Class.html</li>
@@ -251,4 +249,4 @@
<li>deprecated/Renderer/SVG2.html</li>
<li>deprecated/Layer/Yahoo.html</li>
<li>deprecated/Tile/WFS.html</li>
</ul>
</ul>

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>

View File

@@ -39,10 +39,64 @@ function run() {
else {
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>
</head>
<body onload="run()">
<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>
</html>

View File

@@ -49,3 +49,15 @@ div.olControlZoom a:hover {
-o-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);
}
}

View File

@@ -1,5 +1,28 @@
#!/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
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 mobile OpenLayers.mobile.debug.js
./build.py -c none light OpenLayers.light.debug.js
cp OpenLayers.js ..
cp OpenLayers.*.js ..
mv OpenLayers*.js ../
rm ../tools/closure-compiler.jar
cd ..
cd tools
python exampleparser.py
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
done
mkdir doc/devdocs
mkdir doc/apidocs
mkdir -p doc/devdocs
mkdir -p doc/apidocs
rm tools/*.pyc
mkdir -p /osgeo/openlayers/sites/openlayers.org/api/$VERSION