Merge branch 'master' of https://github.com/openlayers/openlayers
Conflicts: tests/list-tests.html
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
});
|
||||
|
||||
@@ -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")),
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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 ?
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
@@ -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:
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -694,7 +694,7 @@ OpenLayers.Popup = OpenLayers.Class({
|
||||
}
|
||||
|
||||
OpenLayers.Event.stopObserving(
|
||||
this.img, "load", this.img._onImageLoad
|
||||
this.img, "load", this.img._onImgLoad
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ var OpenLayers = {
|
||||
/**
|
||||
* Constant: VERSION_NUMBER
|
||||
*/
|
||||
VERSION_NUMBER: "Release 2.12-rc5",
|
||||
VERSION_NUMBER: "Release 2.13 dev",
|
||||
|
||||
/**
|
||||
* Constant: singleFile
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
131
lib/OpenLayers/Util/vendorPrefix.js
Normal file
131
lib/OpenLayers/Util/vendorPrefix.js
Normal 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
|
||||
};
|
||||
}());
|
||||
Reference in New Issue
Block a user