/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* Overiding OpenLayers to add support for GML 3.2.1
*
*/
OpenLayers.Util.extend(OpenLayers.Format.WFST.v1.prototype.namespaces,
{
gml32: 'http://www.opengis.net/gml/3.2'
});
/**
* Method: parseLocations
* Parse the locations from an Atom entry or feed.
*
* Parameters:
* node - {DOMElement} An Atom entry or feed node.
*
* Returns:
* Array({})
*/
OpenLayers.Format.Atom.prototype.parseLocations = function(node) {
// NOTE: Just van den Broecke: 8.dec.2012. See
// Fix for https://github.com/openlayers/openlayers/issues/789
// on OpenLayers 2.12 (line 105 below)
var georssns = this.namespaces.georss;
var locations = {components: []};
var where = this.getElementsByTagNameNS(node, georssns, "where");
if (where && where.length > 0) {
if (!this.gmlParser) {
this.initGmlParser();
}
for (var i=0, ii=where.length; i 0) {
for (var i=0, ii=point.length; i 0) {
var coords;
var p;
var points;
for (var i=0, ii=line.length; i 0) {
var coords;
var p;
var points;
for (var i=0, ii=polygon.length; i= 1.3) ?
{
crs: projection,
i: parseInt(clickPosition.x, 10),
j: parseInt(clickPosition.y, 10)
} :
{
srs: projection,
x: parseInt(clickPosition.x, 10),
y: parseInt(clickPosition.y, 10)
}
);
OpenLayers.Util.applyDefaults(params, this.vendorParams);
return {
url: url,
params: OpenLayers.Util.upperCaseObject(params),
callback: function(request) {
this.handleResponse(clickPosition, request);
},
scope: this
};
};
*/
// http://trac.osgeo.org/openlayers/ticket/3177 (might be fixed in OL 2.11)
/* --- Fixed in OL 2.11 ---
OpenLayers.Format.WMSGetFeatureInfo.prototype.read_FeatureInfoResponse = function(data) {
var response = [];
var featureNodes = this.getElementsByTagNameNS(data, '*',
'FIELDS');
var i;
var len;
for (i = 0,len = featureNodes.length; i < len; i++) {
var featureNode = featureNodes[i];
var geom = null;
// attributes can be actual attributes on the FIELDS tag, or FIELD children
var attributes = {};
var j;
var jlen = featureNode.attributes.length;
if (jlen > 0) {
for (j = 0; j < jlen; j++) {
var attribute = featureNode.attributes[j];
attributes[attribute.nodeName] = attribute.nodeValue;
}
} else {
var nodes = featureNode.childNodes;
var _featureType = "";
for (j = 0,jlen = nodes.length; j < jlen; ++j) {
var node = nodes[j];
if (node.nodeType !== 3) {
//Dirty fix for dino name needs to be stripped as it consists of 3 parts
var dino_name = node.getAttribute("name");
var _feat = dino_name.split(".");
if(_feat[0] === "DINO_DBA"){
attributes[_feat[2]] = node.getAttribute("value");
_featureType = _feat[1];
} else {
attributes[node.getAttribute("name")] = node.getAttribute("value");
}
}
}
}
_feature = new OpenLayers.Feature.Vector(geom, attributes, null);
if(_featureType !== ""){
// Dirty fix for dino to maintain reference to layer
_feature.gml = {};
_feature.gml.featureType = _featureType;
_feature.fid = _featureType + "." + len;
_feature.layer = _featureType;
}
response.push(_feature);
}
return response;
};
*/
/**
* Method: read_FeatureInfoResponse
* Parse FeatureInfoResponse nodes.
*
* Parameters:
* data - {DOMElement}
*
* Returns:
* {Array}
*/
/* OpenLayers.Format.WMSGetFeatureInfo.prototype.read_FeatureInfoResponse = function(data) {
var response = [];
var featureNodes = this.getElementsByTagNameNS(data, '*',
'FIELDS');
if (featureNodes.length == 0) {
featureNodes = this.getElementsByTagNameNS(data, '*', 'Field');
}
for(var i=0, len=featureNodes.length;i 0) {
for(j=0; j} The left and top style position.
* sz - {} The width and height style attributes.
* position - {String} The position attribute. eg: absolute,
* relative, etc.
* border - {String} The style.border attribute. eg:
* solid black 2px
* overflow - {String} The style.overview attribute.
* opacity - {Float} Fractional value (0.0 - 1.0)
*/
OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
border, overflow, opacity) {
if (id) {
element.id = id;
}
if (px) {
if (!px.x) {
// JvdB: fix for IE who cannot deal with NaN
px.x = 0;
}
if (!px.y) {
// JvdB: fix for IE who cannot deal with NaN
px.y = 0;
}
element.style.left = px.x + "px";
element.style.top = px.y + "px";
}
if (sz) {
element.style.width = sz.w + "px";
element.style.height = sz.h + "px";
}
if (position) {
element.style.position = position;
}
if (border) {
element.style.border = border;
}
if (overflow) {
element.style.overflow = overflow;
}
if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
element.style.opacity = opacity;
} else if (parseFloat(opacity) == 1.0) {
element.style.filter = '';
element.style.opacity = '';
}
};
/**
* Donald Kerr's fix to label outlines (Halo's) in IE8
* http://trac.osgeo.org/openlayers/ticket/2965
https://github.com/openlayers/openlayers/pull/140
*/
// Later: does not seem to work now...
// https://code.google.com/p/geoext-viewer/issues/detail?id=185
// Integrate from OL patch.
// http://trac.osgeo.org/openlayers/ticket/3608
// Milestone: 2.13
// setOpacity won't work on a vector layer, if the vector layer is with other vector
// layers in a SelectFeature-Control (the SelectFeature-Control has than a Vect.rootContainer).
// With the following it will work:
// REMOVE/CHECK for OL 2.13 !!
OpenLayers.Layer.Vector.prototype.setOpacity = function(opacity) {
if (opacity != this.opacity) {
this.opacity = opacity;
var element = this.renderer.root;
OpenLayers.Util.modifyDOMElement(element, null, null, null, null,
null, null, opacity);
if (this.map != null) {
this.map.events.triggerEvent("changelayer", {
layer : this,
property : "opacity"
});
}
}
};