return !0 === b ? e + "," + d + "," + c + "," + f : d +
"," + e + "," + f + "," + c
},
toGeometry: function () {
return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left, this.bottom), new OpenLayers.Geometry.Point(this.right, this.bottom), new OpenLayers.Geometry.Point(this.right, this.top), new OpenLayers.Geometry.Point(this.left, this.top)])])
},
getWidth: function () {
return this.right - this.left
},
getHeight: function () {
return this.top - this.bottom
},
getSize: function () {
return new OpenLayers.Size(this.getWidth(), this.getHeight())
d && !c && (c = d.getWidth(), d = Math.round((a.lon - (d.left + d.right) / 2) / c), c = this.containsLonLat({
lon: a.lon - d * c,
lat: a.lat
}, {
inclusive: b.inclusive
}));
return c
},
containsPixel: function (a, b) {
return this.contains(a.x,
a.y, b)
},
contains: function (a, b, c) {
null == c && (c = !0);
if (null == a || null == b) return !1;
var a = OpenLayers.Util.toFloat(a),
b = OpenLayers.Util.toFloat(b),
d = !1;
return d = c ? a >= this.left && a <= this.right && b >= this.bottom && b <= this.top : a > this.left && a < this.right && b > this.bottom && b < this.top
},
intersectsBounds: function (a, b) {
"boolean" === typeof b && (b = {
inclusive: b
});
b = b || {};
if (b.worldBounds) var c = this.wrapDateLine(b.worldBounds),
for (var a = null, b = 0, c = arguments.length; b < c; b++) {
var d = arguments[b];
try {
a = d();
break
} catch (e) {}
}
return a
};
OpenLayers.Util.getXmlNodeValue = function (a) {
var b = null;
OpenLayers.Util.Try(function () {
b = a.text;
if (!b) b = a.textContent;
if (!b) b = a.firstChild.nodeValue
}, function () {
b = a.textContent
});
return b
};
OpenLayers.Util.mouseLeft = function (a, b) {
for (var c = a.relatedTarget ? a.relatedTarget : a.toElement; c != b && c != null;) c = c.parentNode;
return c != b
};
OpenLayers.Util.DEFAULT_PRECISION = 14;
OpenLayers.Util.toFloat = function (a, b) {
if (b == null) b = OpenLayers.Util.DEFAULT_PRECISION;
typeof a !== "number" && (a = parseFloat(a));
return b === 0 ? a : parseFloat(a.toPrecision(b))
};
OpenLayers.Util.rad = function (a) {
return a * Math.PI / 180
};
OpenLayers.Util.deg = function (a) {
return a * 180 / Math.PI
};
OpenLayers.Util.VincentyConstants = {
a: 6378137,
b: 6356752.3142,
f: 1 / 298.257223563
};
OpenLayers.Util.distVincenty = function (a, b) {
for (var c = OpenLayers.Util.VincentyConstants, d = c.a, e = c.b, c = c.f, f = OpenLayers.Util.rad(b.lon - a.lon), g = Math.atan((1 - c) * Math.tan(OpenLayers.Util.rad(a.lat))), h = Math.atan((1 - c) * Math.tan(OpenLayers.Util.rad(b.lat))), i = Math.sin(g), g = Math.cos(g), j = Math.sin(h), h = Math.cos(h), k = f, l = 2 * Math.PI, m = 20; Math.abs(k - l) > 1.0E-12 && --m > 0;) {
var n = Math.sin(k),
o = Math.cos(k),
p = Math.sqrt(h * n * h * n + (g * j - i * h * o) * (g * j - i * h * o));
if (p == 0) return 0;
var o = i * j + g * h * o,
q = Math.atan2(p, o),
r = Math.asin(g *
h * n / p),
s = Math.cos(r) * Math.cos(r),
n = o - 2 * i * j / s,
t = c / 16 * s * (4 + c * (4 - 3 * s)),
l = k,
k = f + (1 - t) * c * Math.sin(r) * (q + t * p * (n + t * o * (-1 + 2 * n * n)))
}
if (m == 0) return NaN;
d = s * (d * d - e * e) / (e * e);
c = d / 1024 * (256 + d * (-128 + d * (74 - 47 * d)));
return (e * (1 + d / 16384 * (4096 + d * (-768 + d * (320 - 175 * d)))) * (q - c * p * (n + c / 4 * (o * (-1 + 2 * n * n) - c / 6 * n * (-3 + 4 * p * p) * (-3 + 4 * n * n))))).toFixed(3) / 1E3
};
OpenLayers.Util.destinationVincenty = function (a, b, c) {
for (var d = OpenLayers.Util, e = d.VincentyConstants, f = e.a, g = e.b, h = e.f, e = a.lon, a = a.lat, i = d.rad(b), b = Math.sin(i), i = Math.cos(i), a = (1 - h) * Math.tan(d.rad(a)), j = 1 / Math.sqrt(1 + a * a), k = a * j, l = Math.atan2(a, i), a = j * b, m = 1 - a * a, f = m * (f * f - g * g) / (g * g), n = 1 + f / 16384 * (4096 + f * (-768 + f * (320 - 175 * f))), o = f / 1024 * (256 + f * (-128 + f * (74 - 47 * f))), f = c / (g * n), p = 2 * Math.PI; Math.abs(f - p) > 1.0E-12;) var q = Math.cos(2 * l + f),
r = Math.sin(f),
s = Math.cos(f),
t = o * r * (q + o / 4 * (s * (-1 + 2 * q * q) - o / 6 * q * (-3 + 4 * r * r) * (-3 + 4 *
q * q))),
p = f,
f = c / (g * n) + t;
c = k * r - j * s * i;
g = Math.atan2(k * s + j * r * i, (1 - h) * Math.sqrt(a * a + c * c));
b = Math.atan2(r * b, j * s - k * r * i);
i = h / 16 * m * (4 + h * (4 - 3 * m));
q = b - (1 - i) * h * a * (f + i * r * (q + i * s * (-1 + 2 * q * q)));
Math.atan2(a, -c);
return new OpenLayers.LonLat(e + d.deg(q), d.deg(g))
};
OpenLayers.Util.getParameters = function (a) {
var a = a === null || a === void 0 ? window.location.href : a,
b = "";
if (OpenLayers.String.contains(a, "?")) var b = a.indexOf("?") + 1,
c = OpenLayers.String.contains(a, "#") ? a.indexOf("#") : a.length,
b = a.substring(b, c);
for (var a = {}, b = b.split(/[&;]/), c = 0, d = b.length; c < d; ++c) {
OpenLayers.Projection.transform = function (a, b, c) {
if (b && c)
if (b instanceof OpenLayers.Projection || (b = new OpenLayers.Projection(b)), c instanceof OpenLayers.Projection || (c = new OpenLayers.Projection(c)), b.proj && c.proj) a = Proj4js.transform(b.proj, c.proj, a);
else {
var b = b.getCode(),
c = c.getCode(),
d = OpenLayers.Projection.transforms;
if (d[b] && d[b][c]) d[b][c](a)
} return a
};
OpenLayers.Projection.nullTransform = function (a) {
d.resolutions && (d.resolutions.sort(function (a, b) {
return b - a
}), f || (f = d.resolutions[0]), g || (g = d.resolutions[d.resolutions.length - 1]));
if (this.resolutions = d.resolutions) {
b = this.resolutions.length;
this.scales = Array(b);
for (a = 0; a < b; a++) this.scales[a] = OpenLayers.Util.getScaleFromResolution(this.resolutions[a], this.units);
this.numZoomLevels = b
}
if (this.minResolution = g) this.maxScale = OpenLayers.Util.getScaleFromResolution(g, this.units);
if (this.maxResolution = f) this.minScale = OpenLayers.Util.getScaleFromResolution(f,
this.units)
},
resolutionsFromScales: function (a) {
if (null != a) {
var b, c, d;
d = a.length;
b = Array(d);
for (c = 0; c < d; c++) b[c] = OpenLayers.Util.getResolutionFromScale(a[c], this.units);
return b
}
},
calculateResolutions: function (a) {
var b, c, d = a.maxResolution;
null != a.minScale ? d = OpenLayers.Util.getResolutionFromScale(a.minScale, this.units) : "auto" == d && null != this.maxExtent && (b = this.map.getSize(), c = this.maxExtent.getWidth() / b.w, b = this.maxExtent.getHeight() / b.h, d = Math.max(c, b));
c = a.minResolution;
null != a.maxScale ? c = OpenLayers.Util.getResolutionFromScale(a.maxScale,
this.units) : "auto" == a.minResolution && null != this.minExtent && (b = this.map.getSize(), c = this.minExtent.getWidth() / b.w, b = this.minExtent.getHeight() / b.h, c = Math.max(c, b));
"number" !== typeof d && ("number" !== typeof c && null != this.maxExtent) && (d = this.map.getTileSize(), d = Math.max(this.maxExtent.getWidth() / d.w, this.maxExtent.getHeight() / d.h));
b = a.maxZoomLevel;
a = a.numZoomLevels;
"number" === typeof c && "number" === typeof d && void 0 === a ? a = Math.floor(Math.log(d / c) / Math.log(2)) + 1 : void 0 === a && null != b && (a = b + 1);
if (!("number" !==
typeof a || 0 >= a || "number" !== typeof d && "number" !== typeof c)) {
b = Array(a);
var e = 2;
"number" == typeof c && "number" == typeof d && (e = Math.pow(d / c, 1 / (a - 1)));
var f;
if ("number" === typeof d)
for (f = 0; f < a; f++) b[f] = d / Math.pow(e, f);
else
for (f = 0; f < a; f++) b[a - 1 - f] = c * Math.pow(e, f);
a = Math.max(0, Math.min(a, this.resolutions.length - 1));
if (this.map.fractionalZoom) var b = Math.floor(a),
c = Math.ceil(a),
a = this.resolutions[b] - (a - b) * (this.resolutions[b] - this.resolutions[c]);
else a = this.resolutions[Math.round(a)];
return a
},
getZoomForResolution: function (a, b) {
var c, d;
if (this.map.fractionalZoom) {
var e = 0,
f = this.resolutions[e],
g = this.resolutions[this.resolutions.length - 1],
h;
c = 0;
for (d = this.resolutions.length; c <
d; ++c)
if (h = this.resolutions[c], h >= a && (f = h, e = c), h <= a) {
g = h;
break
} c = f - g;
c = 0 < c ? e + (f - a) / c : e
} else {
f = Number.POSITIVE_INFINITY;
c = 0;
for (d = this.resolutions.length; c < d; c++)
if (b) {
e = Math.abs(this.resolutions[c] - a);
if (e > f) break;
f = e
} else if (this.resolutions[c] < a) break;
c = Math.max(0, c - 1)
}
return c
},
getLonLatFromViewPortPx: function (a) {
var b = null,
c = this.map;
if (null != a && c.minPx) {
var b = c.getResolution(),
d = c.getMaxExtent({
restricted: !0
}),
b = new OpenLayers.LonLat((a.x - c.minPx.x) * b + d.left, (c.minPx.y - a.y) * b + d.top);
this.wrapDateLine &&
(b = b.wrapDateLine(this.maxExtent))
}
return b
},
getViewPortPxFromLonLat: function (a, b) {
var c = null;
null != a && (b = b || this.map.getResolution(), c = this.map.calculateBounds(null, b), c = new OpenLayers.Pixel(1 / b * (a.lon - c.left), 1 / b * (c.top - a.lat)));
return c
},
setOpacity: function (a) {
if (a != this.opacity) {
this.opacity = a;
for (var b = this.div.childNodes, c = 0, d = b.length; c < d; ++c) {
var e = b[c].firstChild || b[c],
f = b[c].lastChild;
f && "iframe" === f.nodeName.toLowerCase() && (e = f.parentNode);
null != a && (b = this.sphericalMercator ? this.inverseMercator(a.bottom, a.left) : new OpenLayers.LonLat(a.bottom, a.left), a = this.sphericalMercator ? this.inverseMercator(a.top, a.right) : new OpenLayers.LonLat(a.top, a.right), b = new GLatLngBounds(new GLatLng(b.lat, b.lon), new GLatLng(a.lat, a.lon)));
return b
},
setMapObjectCenter: function (a, b) {
this.mapObject.setCenter(a, b)
},
dragPanMapObject: function (a, b) {
this.dragObject.moveBy(new GSize(-a, b))
},
getMapObjectLonLatFromMapObjectPixel: function (a) {
if (a.getElementsByTagNameNS) d = a.getElementsByTagNameNS(b, c);
else
for (var a = a.getElementsByTagName("*"), e, f, g = 0, h = a.length; g < h; ++g)
if (e = a[g], f = e.prefix ? e.prefix + ":" + c : c, "*" == c || f == e.nodeName)("*" == b || b == e.namespaceURI) && d.push(e);
return d
},
getAttributeNodeNS: function (a, b, c) {
var d = null;
if (a.getAttributeNodeNS) d = a.getAttributeNodeNS(b,
c);
else
for (var a = a.attributes, e, f, g = 0, h = a.length; g < h; ++g)
if (e = a[g], e.namespaceURI == b && (f = e.prefix ? e.prefix + ":" + c : c, f == e.nodeName)) {
d = e;
break
} return d
},
getAttributeNS: function (a, b, c) {
var d = "";
if (a.getAttributeNS) d = a.getAttributeNS(b, c) || "";
else if (a = this.getAttributeNodeNS(a, b, c)) d = a.nodeValue;
return d
},
getChildValue: function (a, b) {
var c = b || "";
if (a)
for (var d = a.firstChild; d; d = d.nextSibling) switch (d.nodeType) {
case 3:
case 4:
c += d.nodeValue
}
return c
},
isSimpleContent: function (a) {
for (var b = !0, a = a.firstChild; a; a =
a.nextSibling)
if (1 === a.nodeType) {
b = !1;
break
} return b
},
contentType: function (a) {
for (var b = !1, c = !1, d = OpenLayers.Format.XML.CONTENT_TYPE.EMPTY, a = a.firstChild; a; a = a.nextSibling) {
switch (a.nodeType) {
case 1:
c = !0;
break;
case 8:
break;
default:
b = !0
}
if (c && b) break
}
if (c && b) d = OpenLayers.Format.XML.CONTENT_TYPE.MIXED;
else {
if (c) return OpenLayers.Format.XML.CONTENT_TYPE.COMPLEX;
if (b) return OpenLayers.Format.XML.CONTENT_TYPE.SIMPLE
}
return d
},
hasAttributeNS: function (a, b, c) {
var d = !1;
return d = a.hasAttributeNS ? a.hasAttributeNS(b,
c) : !!this.getAttributeNodeNS(a, b, c)
},
setAttributeNS: function (a, b, c, d) {
if (a.setAttributeNS) a.setAttributeNS(b, c, d);
else if (this.xmldom) b ? (b = a.ownerDocument.createNode(2, c, b), b.nodeValue = d, a.setAttributeNode(b)) : a.setAttribute(c, d);
else throw "setAttributeNS not implemented";
},
createElementNSPlus: function (a, b) {
var b = b || {},
c = b.uri || this.namespaces[b.prefix];
c || (c = a.indexOf(":"), c = this.namespaces[a.substring(0, c)]);
c || (c = this.namespaces[this.defaultPrefix]);
c = this.createElementNS(c, a);
b.attributes && this.setAttributes(c,
b.attributes);
var d = b.value;
null != d && c.appendChild(this.createTextNode(d));
return c
},
setAttributes: function (a, b) {
var c, d, e;
for (e in b) null != b[e] && b[e].toString && (c = b[e].toString(), d = this.namespaces[e.substring(0, e.indexOf(":"))] || null, this.setAttributeNS(a, d, e, c))
},
readNode: function (a, b) {
b || (b = {});
var c = this.readers[a.namespaceURI ? this.namespaceAlias[a.namespaceURI] : this.defaultPrefix];
if (c) {
var d = a.localName || a.nodeName.split(":").pop();
(c = c[d] || c["*"]) && c.apply(this, [a, b])
}
return b
},
readChildNodes: function (a,
b) {
b || (b = {});
for (var c = a.childNodes, d, e = 0, f = c.length; e < f; ++e) d = c[e], 1 == d.nodeType && this.readNode(d, b);
return b
},
writeNode: function (a, b, c) {
var d, e = a.indexOf(":");
0 < e ? (d = a.substring(0, e), a = a.substring(e + 1)) : d = c ? this.namespaceAlias[c.namespaceURI] : this.defaultPrefix;
b = this.writers[d][a].apply(this, [b]);
c && c.appendChild(b);
return b
},
getChildEl: function (a, b, c) {
return a && this.getThisOrNextEl(a.firstChild, b, c)
},
getNextEl: function (a, b, c) {
return a && this.getThisOrNextEl(a.nextSibling, b, c)
},
getThisOrNextEl: function (a,
b, c) {
a: for (; a; a = a.nextSibling) switch (a.nodeType) {
case 1:
if ((!b || b === (a.localName || a.nodeName.split(":").pop())) && (!c || c === a.namespaceURI)) break a;
a = null;
break a;
case 3:
if (/^\s*$/.test(a.nodeValue)) break;
case 4:
case 6:
case 12:
case 10:
case 11:
a = null;
break a
}
return a || null
},
lookupNamespaceURI: function (a, b) {
var c = null;
if (a)
if (a.lookupNamespaceURI) c = a.lookupNamespaceURI(b);
else a: switch (a.nodeType) {
case 1:
if (null !== a.namespaceURI && a.prefix === b) {
c = a.namespaceURI;
break a
}
if (c = a.attributes.length)
for (var d,
e = 0; e < c; ++e)
if (d = a.attributes[e], "xmlns" === d.prefix && d.name === "xmlns:" + b) {
c = d.value || null;
break a
} else if ("xmlns" === d.name && null === b) {
c = d.value || null;
break a
}
c = this.lookupNamespaceURI(a.parentNode, b);
break a;
case 2:
c = this.lookupNamespaceURI(a.ownerElement, b);
break a;
case 9:
c = this.lookupNamespaceURI(a.documentElement, b);
a ? (c = this.version, c || (c = a.getAttribute("version"), c || (c = this.defaultVersion))) : c = b && b.version || this.version || this.defaultVersion;
return c
},
getParser: function (a) {
var a =
a || this.defaultVersion,
b = this.profile ? "_" + this.profile : "";
if (!this.parser || this.parser.VERSION != a) {
var c = OpenLayers.Format[this.name]["v" + a.replace(/\./g, "_") + b];
if (!c) throw "Can't find a " + this.name + " parser for version " + a + b;
return new OpenLayers.Feature.Vector(this.geometry ? this.geometry.clone() : null, this.attributes, this.style)
},
onScreen: function (a) {
var b = !1;
this.layer && this.layer.map && (b = this.layer.map.getExtent(), a ? (a = this.geometry.getBounds(), b = b.intersectsBounds(a)) : b = b.toGeometry().intersects(this.geometry));
for (var b = this.createElementNSPlus("ogc:And"), c, d = 0, e = a.filters.length; d < e; ++d) c = a.filters[d], "FID" === c.type ? OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, c, b) : this.writeNode(this.getFilterType(c), c, b);
return b
},
Or: function (a) {
for (var b =
this.createElementNSPlus("ogc:Or"), c, d = 0, e = a.filters.length; d < e; ++d) c = a.filters[d], "FID" === c.type ? OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, c, b) : this.writeNode(this.getFilterType(c), c, b);
return b
},
Not: function (a) {
var b = this.createElementNSPlus("ogc:Not"),
a = a.filters[0];
"FID" === a.type ? OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, a, b) : this.writeNode(this.getFilterType(a), a, b);
return b
},
PropertyIsLessThan: function (a) {
var b = this.createElementNSPlus("ogc:PropertyIsLessThan");
this.writeNode("PropertyName", a, b);
this.writeOgcExpression(a.value, b);
return b
},
PropertyIsGreaterThan: function (a) {
var b = this.createElementNSPlus("ogc:PropertyIsGreaterThan");
this.writeNode("PropertyName", a, b);
this.writeOgcExpression(a.value, b);
return b
},
PropertyIsLessThanOrEqualTo: function (a) {
var b = this.createElementNSPlus("ogc:PropertyIsLessThanOrEqualTo");
this.writeNode("PropertyName", a, b);
this.writeOgcExpression(a.value, b);
return b
},
PropertyIsGreaterThanOrEqualTo: function (a) {
var b = this.createElementNSPlus("ogc:PropertyIsGreaterThanOrEqualTo");
this.writeNode("PropertyName", a, b);
this.writeOgcExpression(a.value, b);
return b
},
PropertyIsBetween: function (a) {
var b = this.createElementNSPlus("ogc:PropertyIsBetween");
c || (c = new OpenLayers.Format.WKT, OpenLayers.Geometry.fromWKT.format = c);
a = c.read(a);
if (a instanceof OpenLayers.Feature.Vector) b = a.geometry;
else if (OpenLayers.Util.isArray(a)) {
b = a.length;
for (var c = Array(b), d = 0; d < b; ++d) c[d] = a[d].geometry;
b = new OpenLayers.Geometry.Collection(c)
}
}
return b
};
OpenLayers.Geometry.segmentsIntersect = function (a, b, c) {
var d = c && c.point,
c = c && c.tolerance,
e = !1,
f = a.x1 - b.x1,
g = a.y1 - b.y1,
h = a.x2 - a.x1,
i = a.y2 - a.y1,
j = b.y2 - b.y1,
k = b.x2 - b.x1,
l = j * h - k * i,
j = k * g - j * f,
g = h * g - i * f;
0 == l ? 0 == j && 0 == g && (e = !0) : (f = j / l, l = g / l, 0 <= f && (1 >= f && 0 <= l && 1 >= l) && (d ? (h = a.x1 + f * h, l = a.y1 + f * i, e = new OpenLayers.Geometry.Point(h, l)) : e = !0));
if (c)
if (e) {
if (d) {
a = [a, b];
b = 0;
a: for (; 2 > b; ++b) {
f = a[b];
for (i = 1; 3 > i; ++i)
if (h = f["x" + i], l = f["y" + i], d = Math.sqrt(Math.pow(h - e.x, 2) + Math.pow(l - e.y, 2)), d < c) {
e.x = h;
e.y = l;
break a
}
}
}
} else {
a = [a, b];
b = 0;
a: for (; 2 > b; ++b) {
h = a[b];
l = a[(b + 1) % 2];
for (i = 1; 3 > i; ++i)
if (f = {
x: h["x" + i],
y: h["y" + i]
}, g = OpenLayers.Geometry.distanceToSegment(f, l), g.distance < c) {
e = d ? new OpenLayers.Geometry.Point(f.x, f.y) : !0;
break a
}
}
} return e
};
OpenLayers.Geometry.distanceToSegment = function (a, b) {
var c = a.x,
d = a.y,
e = b.x1,
f = b.y1,
g = b.x2,
h = b.y2,
i = g - e,
j = h - f,
k = (i * (c - e) + j * (d - f)) / (Math.pow(i, 2) + Math.pow(j, 2));
0 >= k || (1 <= k ? (e = g, f = h) : (e += k * i, f += k * j));
for (var a = this.components.length - 1, b = Array(a), c, d, e = 0; e < a; ++e) c = this.components[e], d = this.components[e + 1], b[e] = c.x < d.x ? {
x1: c.x,
y1: c.y,
x2: d.x,
y2: d.y
} : {
x1: d.x,
y1: d.y,
x2: c.x,
y2: c.y
};
return b.sort(function (a, b) {
return a.x1 - b.x1
})
},
splitWithSegment: function (a, b) {
for (var c = !(b && !1 === b.edge), d = b && b.tolerance, e = [], f = this.getVertices(), g = [], h = [], i = !1, j, k, l, m = {
point: !0,
tolerance: d
}, n = null, o = 0, p = f.length - 2; o <= p; ++o)
if (d = f[o], g.push(d.clone()), j = f[o + 1], k = {
1]) || h.push(k.clone()), !(0 === o && k.equals(d)) && !k.equals(j) && (i = !0, k.equals(d) || g.push(k), e.push(new OpenLayers.Geometry.LineString(g)), g = [k.clone()]);
i && (g.push(j.clone()), e.push(new OpenLayers.Geometry.LineString(g)));
if (0 < h.length) var q = a.x1 < a.x2 ? 1 : -1,
r = a.y1 < a.y2 ? 1 : -1,
n = {
lines: e,
points: h.sort(function (a, b) {
return q * a.x - q * b.x || r * a.y - r * b.y
})
};
return n
},
split: function (a, b) {
var c = null,
d = b && b.mutual,
e, f, g, h;
if (a instanceof OpenLayers.Geometry.LineString) {
var i = this.getVertices(),
j, k, l, m, n, o = [];
g = [];
for (var p = 0, q = i.length - 2; p <= q; ++p) {
j = i[p];
k = i[p + 1];
l = {
x1: j.x,
y1: j.y,
x2: k.x,
y2: k.y
};
h = h || [a];
d && o.push(j.clone());
for (var r = 0; r < h.length; ++r)
if (m = h[r].splitWithSegment(l, b))
if (n = m.lines, 0 < n.length && (n.unshift(r, 1), Array.prototype.splice.apply(h, n), r += n.length - 2), d)
for (var s = 0, t = m.points.length; s < t; ++s) n = m.points[s], n.equals(j) || (o.push(n), g.push(new OpenLayers.Geometry.LineString(o)), o = n.equals(k) ? [] : [n.clone()])
for (var c = null, d = b && b.mutual, e, f, g, h, i = [], j = [a], k = 0, l = this.components.length; k < l; ++k) {
f = this.components[k];
g = !1;
for (var m = 0; m < j.length; ++m)
if (e = f.split(j[m], b)) {
if (d) {
g = e[0];
for (var n = 0, o = g.length; n < o; ++n) 0 === n && i.length ? i[i.length - 1].addComponent(g[n]) : i.push(new OpenLayers.Geometry.MultiLineString([g[n]]));
g = !0;
e = e[1]
}
if (e.length) {
e.unshift(m,
1);
Array.prototype.splice.apply(j, e);
break
}
} g || (i.length ? i[i.length - 1].addComponent(f.clone()) : i = [new OpenLayers.Geometry.MultiLineString(f.clone())])
}
i && 1 < i.length ? g = !0 : i = [];
j && 1 < j.length ? h = !0 : j = [];
if (g || h) c = d ? [i, j] : j;
return c
},
splitWith: function (a, b) {
var c = null,
d = b && b.mutual,
e, f, g, h, i, j;
if (a instanceof OpenLayers.Geometry.LineString) {
j = [];
i = [a];
for (var k = 0, l = this.components.length; k < l; ++k) {
g = !1;
f = this.components[k];
for (var m = 0; m < i.length; ++m)
if (e = i[m].split(f, b)) {
d && (g = e[0], g.length && (g.unshift(m,
1), Array.prototype.splice.apply(i, g), m += g.length - 2), e = e[1], 0 === e.length && (e = [f.clone()]));
g = 0;
for (var n = e.length; g < n; ++g) 0 === g && j.length ? j[j.length - 1].addComponent(e[g]) : j.push(new OpenLayers.Geometry.MultiLineString([e[g]]));
for (var c = 0, d = this.components.length; c < d - 1; c++) this.components[c].move(a, b)
},
rotate: function (a, b) {
for (var c = 0, d = this.components.length; c < d - 1; ++c) this.components[c].rotate(a, b)
},
resize: function (a, b, c) {
for (var d = 0, e = this.components.length; d < e - 1; ++d) this.components[d].resize(a, b, c);
return this
},
transform: function (a, b) {
if (a && b) {
for (var c = 0, d = this.components.length; c < d - 1; c++) this.components[c].transform(a,
b);
this.bounds = null
}
return this
},
getCentroid: function () {
if (this.components && 2 < this.components.length) {
for (var a = 0, b = 0, c = 0; c < this.components.length - 1; c++) var d = this.components[c],
e = this.components[c + 1],
a = a + (d.x + e.x) * (d.x * e.y - e.x * d.y),
b = b + (d.y + e.y) * (d.x * e.y - e.x * d.y);
c = -1 * this.getArea();
return new OpenLayers.Geometry.Point(a / (6 * c), b / (6 * c))
}
return null
},
getArea: function () {
var a = 0;
if (this.components && 2 < this.components.length) {
for (var b = a = 0, c = this.components.length; b < c - 1; b++) var d = this.components[b],
e =
this.components[b + 1],
a = a + (d.x + e.x) * (e.y - d.y);
a = -a / 2
}
return a
},
getGeodesicArea: function (a) {
var b = this;
if (a) {
var c = new OpenLayers.Projection("EPSG:4326");
c.equals(a) || (b = this.clone().transform(a, c))
}
a = 0;
c = b.components && b.components.length;
if (2 < c) {
for (var d, e, f = 0; f < c - 1; f++) d = b.components[f], e = b.components[f + 1], a += OpenLayers.Util.rad(e.x - d.x) * (2 + Math.sin(OpenLayers.Util.rad(d.y)) + Math.sin(OpenLayers.Util.rad(e.y)));
a = 40680631590769 * a / 2
}
return a
},
containsPoint: function (a) {
for (var b = OpenLayers.Number.limitSigDigs,
c = b(a.x, 14), a = b(a.y, 14), d = this.components.length - 1, e, f, g, h, i, j = 0, k = 0; k < d; ++k)
if (e = this.components[k], g = b(e.x, 14), e = b(e.y, 14), f = this.components[k + 1], h = b(f.x, 14), f = b(f.y, 14), e == f) {
if (a == e && (g <= h && c >= g && c <= h || g >= h && c <= g && c >= h)) {
j = -1;
break
}
} else {
i = b((a - f) * ((h - g) / (f - e)) + h, 14);
if (i == c && (e < f && a >= e && a <= f || e > f && a <= e && a >= f)) {
j = -1;
break
}
i <= c || g != h && (i < Math.min(g, h) || i > Math.max(g, h)) || (e < f && a >= e && a < f || e > f && a < e && a >= f) && ++j
} return -1 == j ? 1 : !!(j & 1)
},
intersects: function (a) {
var b = !1;
if ("OpenLayers.Geometry.Point" ==
a.CLASS_NAME) b = this.containsPoint(a);
else if ("OpenLayers.Geometry.LineString" == a.CLASS_NAME) b = a.intersects(this);
else if ("OpenLayers.Geometry.LinearRing" == a.CLASS_NAME) b = OpenLayers.Geometry.LineString.prototype.intersects.apply(this, [a]);
else
for (var c = 0, d = a.components.length; c < d && !(b = a.components[c].intersects(this)); ++c);
OpenLayers.Geometry.Polygon.createRegularPolygon = function (a, b, c, d) {
var e = Math.PI * (1 / c - 0.5);
d && (e += d / 180 * Math.PI);
for (var f, g = [], h = 0; h < c; ++h) f = e + 2 * h * Math.PI / c, d = a.x + b * Math.cos(f), f = a.y + b * Math.sin(f), g.push(new OpenLayers.Geometry.Point(d, f));
else throw new TypeError("Unsupported geometry type: " + c);
break
} var g;
c = this.getElementsByTagNameNS(a, this.gmlns, "Box");
for (f = 0; f < c.length; ++f) b = c[f], d = this.parseGeometry.box.apply(this, [b]), b = b.parentNode, "boundedBy" === (b.localName || b.nodeName.split(":").pop()) ? g = d : e = d.toGeometry();
return this.xy ? new OpenLayers.Geometry.Point(c[0], c[1], c[2]) : new OpenLayers.Geometry.Point(c[1],
c[0], c[2])
},
multipoint: function (a) {
var a = this.getElementsByTagNameNS(a, this.gmlns, "Point"),
b = [];
if (0 < a.length)
for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.point.apply(this, [a[d]])) && b.push(c);
return new OpenLayers.Geometry.MultiPoint(b)
},
linestring: function (a, b) {
var c, d;
d = [];
var e = [];
c = this.getElementsByTagNameNS(a, this.gmlns, "posList");
if (0 < c.length) {
d = this.getChildValue(c[0]);
d = d.replace(this.regExes.trimSpace, "");
d = d.split(this.regExes.splitSpace);
var f = parseInt(c[0].getAttribute("dimension")),
g, h, i;
for (c = 0; c < d.length / f; ++c) g = c * f, h = d[g], i = d[g + 1], g = 2 == f ? null : d[g + 2], this.xy ? e.push(new OpenLayers.Geometry.Point(h, i, g)) : e.push(new OpenLayers.Geometry.Point(i, h, g))
0 != e.length && (d = b ? new OpenLayers.Geometry.LinearRing(e) : new OpenLayers.Geometry.LineString(e));
return d
},
multilinestring: function (a) {
var a = this.getElementsByTagNameNS(a, this.gmlns, "LineString"),
b = [];
if (0 < a.length)
for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.linestring.apply(this, [a[d]])) && b.push(c);
return new OpenLayers.Geometry.MultiLineString(b)
},
polygon: function (a) {
var a = this.getElementsByTagNameNS(a, this.gmlns, "LinearRing"),
b = [];
if (0 < a.length)
for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.linestring.apply(this, [a[d], !0])) && b.push(c);
return new OpenLayers.Geometry.Polygon(b)
},
multipolygon: function (a) {
var a = this.getElementsByTagNameNS(a, this.gmlns, "Polygon"),
b = [];
if (0 < a.length)
for (var c, d = 0; d < a.length; ++d)(c = this.parseGeometry.polygon.apply(this, [a[d]])) && b.push(c);
return new OpenLayers.Geometry.MultiPolygon(b)
},
envelope: function (a) {
var b = [],
c, d, e = this.getElementsByTagNameNS(a, this.gmlns, "lowerCorner");
if (0 < e.length) {
c = [];
0 < e.length && (c = e[0].firstChild.nodeValue, c = c.replace(this.regExes.trimSpace, ""), c = c.split(this.regExes.splitSpace));
2 == c.length && (c[2] = null);
var f = this.xy ? new OpenLayers.Geometry.Point(c[0], c[1], c[2]) : new OpenLayers.Geometry.Point(c[1], c[0], c[2])
}
a = this.getElementsByTagNameNS(a, this.gmlns, "upperCorner");
if (0 < a.length) {
c = [];
0 < a.length && (c = a[0].firstChild.nodeValue, c = c.replace(this.regExes.trimSpace, ""), c = c.split(this.regExes.splitSpace));
2 == c.length && (c[2] = null);
var g = this.xy ? new OpenLayers.Geometry.Point(c[0],
c[1], c[2]) : new OpenLayers.Geometry.Point(c[1], c[0], c[2])
}
f && g && (b.push(new OpenLayers.Geometry.Point(f.x, f.y)), b.push(new OpenLayers.Geometry.Point(g.x, f.y)), b.push(new OpenLayers.Geometry.Point(g.x, g.y)), b.push(new OpenLayers.Geometry.Point(f.x, g.y)), b.push(new OpenLayers.Geometry.Point(f.x, f.y)), b = new OpenLayers.Geometry.LinearRing(b), d = new OpenLayers.Geometry.Polygon([b]));
return d
},
box: function (a) {
var b = this.getElementsByTagNameNS(a, this.gmlns, "coordinates"),
c = a = null;
0 < b.length && (b = b[0].firstChild.nodeValue,
b = b.split(" "), 2 == b.length && (a = b[0].split(","), c = b[1].split(",")));
if (null !== a && null !== c) return new OpenLayers.Bounds(parseFloat(a[0]), parseFloat(a[1]), parseFloat(c[0]), parseFloat(c[1]))
}
},
parseAttributes: function (a) {
for (var b = {}, a = a.firstChild, c, d, e; a;) {
if (1 == a.nodeType) {
a = a.childNodes;
for (c = 0; c < a.length; ++c)
if (d = a[c], 1 == d.nodeType)
if (e = d.childNodes, 1 == e.length) {
if (e = e[0], 3 == e.nodeType || 4 == e.nodeType) d = d.prefix ? d.nodeName.split(":")[1] : d.nodeName, e = e.nodeValue.replace(this.regExes.trimSpace, ""),
b[d] = e
} else b[d.nodeName.split(":").pop()] = null;
break
}
a = a.nextSibling
}
return b
},
write: function (a) {
OpenLayers.Util.isArray(a) || (a = [a]);
for (var b = this.createElementNS("http://www.opengis.net/wfs", "wfs:" + this.collectionName), c = 0; c < a.length; c++) b.appendChild(this.createFeatureXML(a[c]));
var b = this.createElementNS(this.gmlns, "gml:Point");
b.appendChild(this.buildCoordinatesNode(a));
return b
},
multipoint: function (a) {
for (var b = this.createElementNS(this.gmlns, "gml:MultiPoint"), a = a.components, c, d, e = 0; e < a.length; e++) c = this.createElementNS(this.gmlns, "gml:pointMember"), d = this.buildGeometry.point.apply(this,
[a[e]]), c.appendChild(d), b.appendChild(c);
return b
},
linestring: function (a) {
var b = this.createElementNS(this.gmlns, "gml:LineString");
b.appendChild(this.buildCoordinatesNode(a));
return b
},
multilinestring: function (a) {
for (var b = this.createElementNS(this.gmlns, "gml:MultiLineString"), a = a.components, c, d, e = 0; e < a.length; ++e) c = this.createElementNS(this.gmlns, "gml:lineStringMember"), d = this.buildGeometry.linestring.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
return b
},
linearring: function (a) {
var b = this.createElementNS(this.gmlns,
"gml:LinearRing");
b.appendChild(this.buildCoordinatesNode(a));
return b
},
polygon: function (a) {
for (var b = this.createElementNS(this.gmlns, "gml:Polygon"), a = a.components, c, d, e = 0; e < a.length; ++e) c = 0 == e ? "outerBoundaryIs" : "innerBoundaryIs", c = this.createElementNS(this.gmlns, "gml:" + c), d = this.buildGeometry.linearring.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
return b
},
multipolygon: function (a) {
for (var b = this.createElementNS(this.gmlns, "gml:MultiPolygon"), a = a.components, c, d, e = 0; e < a.length; ++e) c = this.createElementNS(this.gmlns,
"gml:polygonMember"), d = this.buildGeometry.polygon.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
return b
},
bounds: function (a) {
var b = this.createElementNS(this.gmlns, "gml:Box");
b.appendChild(this.buildCoordinatesNode(a));
return b
}
},
buildCoordinatesNode: function (a) {
var b = this.createElementNS(this.gmlns, "gml:coordinates");
b.setAttribute("decimal", ".");
b.setAttribute("cs", ",");
b.setAttribute("ts", " ");
var c = [];
if (a instanceof OpenLayers.Bounds) c.push(a.left + "," + a.bottom), c.push(a.right + "," + a.top);
else
for (var a = a.components ? a.components : [a], d = 0; d < a.length; d++) c.push(a[d].x + "," + a[d].y);
if (c.components && c.components.length > 0) b.bounds = c.components[0]
},
Point: function (a,
b) {
var c = {
points: []
};
this.readChildNodes(a, c);
if (!b.components) b.components = [];
b.components.push(c.points[0])
},
coordinates: function (a, b) {
for (var c = this.getChildValue(a).replace(this.regExes.trimSpace, ""), c = c.replace(this.regExes.trimComma, ","), c = c.split(this.regExes.splitSpace), d, e = c.length, f = Array(e), g = 0; g < e; ++g) {
d = c[g].split(",");
f[g] = this.xy ? new OpenLayers.Geometry.Point(d[0], d[1], d[2]) : new OpenLayers.Geometry.Point(d[1], d[0], d[2])
var b = this.createElementNSPlus("gml:featureMember");
this.writeNode("feature:_typeName", a, b);
return b
},
MultiPoint: function (a) {
for (var b =
this.createElementNSPlus("gml:MultiPoint"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("pointMember", a[c], b);
return b
},
pointMember: function (a) {
var b = this.createElementNSPlus("gml:pointMember");
this.writeNode("Point", a, b);
return b
},
MultiLineString: function (a) {
for (var b = this.createElementNSPlus("gml:MultiLineString"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("lineStringMember", a[c], b);
return b
},
lineStringMember: function (a) {
var b = this.createElementNSPlus("gml:lineStringMember");
this.writeNode("LineString", a, b);
return b
},
MultiPolygon: function (a) {
for (var b = this.createElementNSPlus("gml:MultiPolygon"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("polygonMember", a[c], b);
return b
},
polygonMember: function (a) {
var b = this.createElementNSPlus("gml:polygonMember");
this.writeNode("Polygon", a, b);
return b
},
GeometryCollection: function (a) {
for (var b = this.createElementNSPlus("gml:GeometryCollection"), c = 0, d = a.components.length; c < d; ++c) this.writeNode("geometryMember", a.components[c],
b);
return b
},
geometryMember: function (a) {
var b = this.createElementNSPlus("gml:geometryMember"),
a = this.writeNode("feature:_geometry", a);
b.appendChild(a.firstChild);
return b
}
},
feature: {
_typeName: function (a) {
var b = this.createElementNSPlus("feature:" + this.featureType, {
var c = this.getChildValue(a).replace(this.regExes.trimSpace, "").split(this.regExes.splitSpace),
c = this.xy ? new OpenLayers.Geometry.Point(c[0], c[1], c[2]) : new OpenLayers.Geometry.Point(c[1], c[0], c[2]);
b.points = [c]
},
posList: function (a,
b) {
for (var c = this.getChildValue(a).replace(this.regExes.trimSpace, "").split(this.regExes.splitSpace), d = parseInt(a.getAttribute("dimension")) || 2, e, f, g, h = Array(c.length / d), i = 0, j = c.length; i < j; i += d) e = c[i], f = c[i + 1], g = 2 == d ? void 0 : c[i + 2], h[i / d] = this.xy ? new OpenLayers.Geometry.Point(e, f, g) : new OpenLayers.Geometry.Point(f, e, g);
for (var b = this.createElementNSPlus("gml:featureMembers"), c = 0, d = a.length; c < d; ++c) this.writeNode("feature:_typeName", a[c], b);
return b
},
Point: function (a) {
var b = this.createElementNSPlus("gml:Point");
this.writeNode("pos", a, b);
return b
},
pos: function (a) {
return this.createElementNSPlus("gml:pos", {
value: this.xy ? a.x +
" " + a.y : a.y + " " + a.x
})
},
LineString: function (a) {
var b = this.createElementNSPlus("gml:LineString");
this.writeNode("posList", a.components, b);
return b
},
Curve: function (a) {
var b = this.createElementNSPlus("gml:Curve");
this.writeNode("segments", a, b);
return b
},
segments: function (a) {
var b = this.createElementNSPlus("gml:segments");
this.writeNode("LineStringSegment", a, b);
return b
},
LineStringSegment: function (a) {
var b = this.createElementNSPlus("gml:LineStringSegment");
this.writeNode("posList", a.components, b);
return b
},
posList: function (a) {
for (var b = a.length, c = Array(b), d, e = 0; e < b; ++e) d = a[e], c[e] = this.xy ? d.x + " " + d.y : d.y + " " + d.x;
return this.createElementNSPlus("gml:posList", {
value: c.join(" ")
})
},
Surface: function (a) {
var b = this.createElementNSPlus("gml:Surface");
this.writeNode("patches", a, b);
return b
},
patches: function (a) {
var b = this.createElementNSPlus("gml:patches");
this.writeNode("PolygonPatch", a, b);
return b
},
PolygonPatch: function (a) {
var b = this.createElementNSPlus("gml:PolygonPatch", {
attributes: {
interpolation: "planar"
}
});
this.writeNode("exterior", a.components[0], b);
for (var c = 1, d = a.components.length; c < d; ++c) this.writeNode("interior", a.components[c], b);
return b
},
Polygon: function (a) {
var b = this.createElementNSPlus("gml:Polygon");
this.writeNode("exterior", a.components[0], b);
for (var c = 1, d = a.components.length; c < d; ++c) this.writeNode("interior", a.components[c], b);
return b
},
exterior: function (a) {
var b = this.createElementNSPlus("gml:exterior");
this.writeNode("LinearRing", a, b);
return b
},
interior: function (a) {
var b = this.createElementNSPlus("gml:interior");
this.writeNode("LinearRing", a, b);
return b
},
LinearRing: function (a) {
var b = this.createElementNSPlus("gml:LinearRing");
this.writeNode("posList", a.components, b);
return b
},
MultiCurve: function (a) {
for (var b = this.createElementNSPlus("gml:MultiCurve"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("curveMember", a[c], b);
return b
},
curveMember: function (a) {
var b = this.createElementNSPlus("gml:curveMember");
this.curve ? this.writeNode("Curve", a, b) : this.writeNode("LineString", a, b);
return b
},
MultiSurface: function (a) {
for (var b =
this.createElementNSPlus("gml:MultiSurface"), a = a.components || [a], c = 0, d = a.length; c < d; ++c) this.writeNode("surfaceMember", a[c], b);
return b
},
surfaceMember: function (a) {
var b = this.createElementNSPlus("gml:surfaceMember");
this.surface ? this.writeNode("Surface", a, b) : this.writeNode("Polygon", a, b);
for (var b = 0; b < this.level; ++b) a.push(this.indent);
return a.join("")
},
writeNewline: function () {
return this.pretty ? this.newline : ""
},
writeSpace: function () {
return this.pretty ? this.space : ""
},
serialize: {
object: function (a) {
if (null == a) return "null";
if (a.constructor == Date) return this.serialize.date.apply(this, [a]);
if (a.constructor == Array) return this.serialize.array.apply(this, [a]);
var b = ["{"];
this.level += 1;
var c, d, e, f = !1;
for (c in a) a.hasOwnProperty(c) && (d = OpenLayers.Format.JSON.prototype.write.apply(this, [c, this.pretty]), e = OpenLayers.Format.JSON.prototype.write.apply(this,
[a[c], this.pretty]), null != d && null != e && (f && b.push(","), b.push(this.writeNewline(), this.writeIndent(), d, ":", this.writeSpace(), e), f = !0));
for (var d = 0, e = a.length; d < e; ++d) b = OpenLayers.Format.JSON.prototype.write.apply(this, [a[d], this.pretty]), null != b && (0 < d && c.push(","), c.push(this.writeNewline(), this.writeIndent(), b));
this.level -= 1;
c.push(this.writeNewline(), this.writeIndent(),
"]");
return c.join("")
},
string: function (a) {
var b = {
"\u0008": "\\b",
"\t": "\\t",
"\n": "\\n",
"\u000c": "\\f",
"\r": "\\r",
'"': '\\"',
"\\": "\\\\"
};
return /["\\\x00-\x1f]/.test(a) ? '"' + a.replace(/([\x00-\x1f\\"])/g, function (a, d) {
var e = b[d];
if (e) return e;
e = d.charCodeAt();
return "\\u00" + Math.floor(e / 16).toString(16) + (e % 16).toString(16)
if (!1 == this.ignoreExtraDims && 2 != a.length) throw "Only 2D points are supported: " + a;
return new OpenLayers.Geometry.Point(a[0], a[1])
},
multipoint: function (a) {
for (var b = [],
c = null, d = 0, e = a.length; d < e; ++d) {
try {
c = this.parseCoords.point.apply(this, [a[d]])
} catch (f) {
throw f;
}
b.push(c)
}
return new OpenLayers.Geometry.MultiPoint(b)
},
linestring: function (a) {
for (var b = [], c = null, d = 0, e = a.length; d < e; ++d) {
try {
c = this.parseCoords.point.apply(this, [a[d]])
} catch (f) {
throw f;
}
b.push(c)
}
return new OpenLayers.Geometry.LineString(b)
},
multilinestring: function (a) {
for (var b = [], c = null, d = 0, e = a.length; d < e; ++d) {
try {
c = this.parseCoords.linestring.apply(this, [a[d]])
} catch (f) {
throw f;
}
b.push(c)
}
return new OpenLayers.Geometry.MultiLineString(b)
},
polygon: function (a) {
for (var b = [], c, d, e = 0, f = a.length; e < f; ++e) {
try {
d = this.parseCoords.linestring.apply(this, [a[e]])
} catch (g) {
throw g;
}
c = new OpenLayers.Geometry.LinearRing(d.components);
b.push(c)
}
return new OpenLayers.Geometry.Polygon(b)
},
multipolygon: function (a) {
for (var b = [], c = null, d = 0, e = a.length; d < e; ++d) {
try {
c = this.parseCoords.polygon.apply(this, [a[d]])
} catch (f) {
throw f;
}
b.push(c)
}
return new OpenLayers.Geometry.MultiPolygon(b)
},
box: function (a) {
if (2 != a.length) throw "GeoJSON box coordinates must have 2 elements";
return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(a[0][0], a[0][1]), new OpenLayers.Geometry.Point(a[1][0], a[0][1]), new OpenLayers.Geometry.Point(a[1][0], a[1][1]), new OpenLayers.Geometry.Point(a[0][0], a[1][1]), new OpenLayers.Geometry.Point(a[0][0], a[0][1])])])
}
},
write: function (a, b) {
var c = {
type: null
};
if (OpenLayers.Util.isArray(a)) {
c.type = "FeatureCollection";
var d = a.length;
c.features = Array(d);
for (var e = 0; e < d; ++e) {
var f = a[e];
if (!f instanceof OpenLayers.Feature.Vector) throw "FeatureCollection only supports collections of features: " +
for (var a, b = this.controls.length - 1; 0 <= b; b--) a = this.controls[b], a.events &&
a.events.un({
activate: this.iconOn,
deactivate: this.iconOff
}), a.panel_div = null;
this.activeState = null
},
activate: function () {
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {
for (var a, b = 0, c = this.controls.length; b < c; b++) a = this.controls[b], (a === this.defaultControl || this.saveState && this.activeState[a.id]) && a.activate();
for (var a = this.div.childNodes.length - 1; 0 <= a; a--) this.div.removeChild(this.div.childNodes[a]);
this.div.innerHTML = "";
if (this.active)
for (var a = 0, b = this.controls.length; a < b; a++) this.div.appendChild(this.controls[a].panel_div)
},
activateControl: function (a) {
if (!this.active) return !1;
if (a.type == OpenLayers.Control.TYPE_BUTTON) a.trigger();
else if (a.type == OpenLayers.Control.TYPE_TOGGLE) a.active ? a.deactivate() : a.activate();
else if (this.allowDepress && a.active) a.deactivate();
else {
for (var b, c = 0, d = this.controls.length; c < d; c++) b = this.controls[c], b != a && (b.type === OpenLayers.Control.TYPE_TOOL || null == b.type) &&
d = this.grid[0][0].position.y * b + parseInt(this.div.style.top, 10) + parseInt(this.map.layerContainerDiv.style.top),
e = this.tileSize.w * b,
f = this.tileSize.h * b;
if (c > -e * (a - 1)) this.shiftColumn(!0);
else if (c < -e * a) this.shiftColumn(!1);
else if (d > -f * (a - 1)) this.shiftRow(!0);
else if (d < -f * a) this.shiftRow(!1);
else break
}
},
shiftRow: function (a) {
for (var b = this.grid, c = b[a ? 0 : this.grid.length - 1], d = this.getServerResolution(), e = a ? -this.tileSize.h : this.tileSize.h, d = d * -e, f = a ?
b.pop() : b.shift(), g = 0, h = c.length; g < h; g++) {
var i = c[g],
j = i.bounds.clone(),
i = i.position.clone();
j.bottom += d;
j.top += d;
i.y += e;
f[g].moveTo(j, i)
}
a ? b.unshift(f) : b.push(f)
},
shiftColumn: function (a) {
for (var b = a ? -this.tileSize.w : this.tileSize.w, c = this.getServerResolution() * b, d = 0, e = this.grid.length; d < e; d++) {
var f = this.grid[d],
g = f[a ? 0 : f.length - 1],
h = g.bounds.clone(),
g = g.position.clone();
h.left += c;
h.right += c;
g.x += b;
var i = a ? this.grid[d].pop() : this.grid[d].shift();
i.moveTo(h, g);
a ? f.unshift(i) : f.push(i)
}
},
removeExcessTiles: function (a,
b) {
for (var c, d; this.grid.length > a;) {
var e = this.grid.pop();
c = 0;
for (d = e.length; c < d; c++) {
var f = e[c];
this.destroyTile(f)
}
}
c = 0;
for (d = this.grid.length; c < d; c++)
for (; this.grid[c].length > b;) e = this.grid[c], f = e.pop(), this.destroyTile(f)
a ? (a = OpenLayers.Format.XML.prototype.read.apply(this, [a]), a = a.documentElement.getElementsByTagName("ERROR"), b = null !== a && 0 < a.length) : b = "" !== this.response.error;
return b
},
read: function (a) {
"string" == typeof a && (a = OpenLayers.Format.XML.prototype.read.apply(this, [a]));
for (var c = "featureweight howmanylabels labelbufferratio labelpriorities labelweight linelabelposition rotationalangles".split(" "), d = 0, e = c.length; d < e; d++) {
var f = c[d];
b[f] && a.setAttribute(f, b[f])
}
if ("text" == b.symbol.type) {
var g = b.symbol,
h = this.createElementNS("", "TEXTSYMBOL");
a.appendChild(h);
c = this.fontStyleKeys;
d = 0;
for (e = c.length; d < e; d++) f = c[d], g[f] && h.setAttribute(f, b[f])
}
},
writePolygonGeometry: function (a) {
if (!(a instanceof OpenLayers.Geometry.Polygon)) throw {
message: "Cannot write polygon geometry to ArcXML with an " + a.CLASS_NAME + " object.",
geometry: a
};
for (var b = this.createElementNS("", "POLYGON"), c = 0, d = a.components.length; c < d; c++) {
for (var e = a.components[c], f = this.createElementNS("", "RING"), g = 0, h = e.components.length; g < h; g++) {
var i = e.components[g],
j = this.createElementNS("", "POINT");
j.setAttribute("x", i.x);
j.setAttribute("y",
i.y);
f.appendChild(j)
}
b.appendChild(f)
}
return b
},
parseResponse: function (a) {
"string" == typeof a && (a = (new OpenLayers.Format.XML).read(a));
var b = new OpenLayers.Format.ArcXML.Response,
c = a.getElementsByTagName("ERROR");
if (null != c && 0 < c.length) b.error = this.getChildValue(c, "Unknown error.");
else {
c = a.getElementsByTagName("RESPONSE");
if (null == c || 0 == c.length) return b.error = "No RESPONSE tag found in ArcXML response.", b;
var d = c[0].firstChild.nodeName;
"#text" == d && (d = c[0].firstChild.nextSibling.nodeName);
if ("IMAGE" ==
d) c = a.getElementsByTagName("ENVELOPE"), a = a.getElementsByTagName("OUTPUT"), null == c || 0 == c.length ? b.error = "No ENVELOPE tag found in ArcXML response." : null == a || 0 == a.length ? b.error = "No OUTPUT tag found in ArcXML response." : (c = this.parseAttributes(c[0]), d = this.parseAttributes(a[0]), b.image = "string" == typeof d.type ? {
envelope: c,
output: {
type: d.type,
data: this.getChildValue(a[0])
}
} : {
envelope: c,
output: d
});
else if ("FEATURES" == d) {
if (a = c[0].getElementsByTagName("FEATURES"), c = a[0].getElementsByTagName("FEATURECOUNT"),
for (var b = this.createElementNSPlus("wcs:TemporalSubset", {}), c = 0, d = a.timePeriods.length; c < d; ++c) this.writeNode("wcs:TimePeriod", a.timePeriods[c], b);
return b
},
TimePeriod: function (a) {
var b = this.createElementNSPlus("wcs:TimePeriod", {});
for (var g = this.getElementsByTagNameNS(c[d], c[d].namespaceURI, "trkseg"), h = 0, i = g.length; h < i; h++) {
var j = this.extractSegment(g[h], "trkpt");
b.push(new OpenLayers.Feature.Vector(j, f))
}
}
if (this.extractRoutes) {
e = a.getElementsByTagName("rte");
c = 0;
for (d =
e.length; c < d; c++) f = {}, this.extractAttributes && (f = this.parseAttributes(e[c])), g = this.extractSegment(e[c], "rtept"), b.push(new OpenLayers.Feature.Vector(g, f))
}
if (this.extractWaypoints) {
a = a.getElementsByTagName("wpt");
c = 0;
for (e = a.length; c < e; c++) f = {}, this.extractAttributes && (f = this.parseAttributes(a[c])), d = new OpenLayers.Geometry.Point(a[c].getAttribute("lon"), a[c].getAttribute("lat")), b.push(new OpenLayers.Feature.Vector(d, f))
}
if (this.internalProjection && this.externalProjection) {
for (var c = this.getElementsByTagNameNS(a, a.namespaceURI, b), d = [], e = 0, f = c.length; e < f; e++) d.push(new OpenLayers.Geometry.Point(c[e].getAttribute("lon"), c[e].getAttribute("lat")));
!1 === c || null === c ? this.unrenderedFeatures[a.id] = a : delete this.unrenderedFeatures[a.id]
}
},
eraseFeatures: function (a) {
this.renderer.eraseFeatures(a)
},
getFeatureFromEvent: function (a) {
if (!this.renderer) throw Error("getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it.");
var b = null;
(a = this.renderer.getFeatureIdFromEvent(a)) && (b = "string" === typeof a ? this.getFeatureById(a) : a);
return b
},
getFeatureBy: function (a, b) {
for (var c =
null, d = 0, e = this.features.length; d < e; ++d)
if (this.features[d][a] == b) {
c = this.features[d];
break
} return c
},
getFeatureById: function (a) {
return this.getFeatureBy("id", a)
},
getFeatureByFid: function (a) {
return this.getFeatureBy("fid", a)
},
getFeaturesByAttribute: function (a, b) {
var c, d, e = this.features.length,
f = [];
for (c = 0; c < e; c++)(d = this.features[c]) && d.attributes && d.attributes[a] === b && f.push(d);
return f
},
onFeatureInsert: function () {},
preFeatureInsert: function () {},
getDataExtent: function () {
var a = null,
b = this.features;
if (b && 0 < b.length)
for (var c = null, d = 0, e = b.length; d < e; d++)
if (c = b[d].geometry) null === a && (a = new OpenLayers.Bounds), a.extend(c.getBounds());
for (var a, b = 0; b < this.map.layers.length; ++b) a = this.map.layers[b], -1 != OpenLayers.Util.indexOf(this.layers, a) && a.renderer.moveRoot(this.renderer)
},
resetRoots: function () {
for (var a, b = 0; b < this.layers.length; ++b) a = this.layers[b], this.renderer && a.renderer.getRenderLayerId() == this.id && this.renderer.moveRoot(a.renderer)
g = Math.sqrt(this.dx * this.dy * this.maxFeatures / f),
d = Math.min(d * this.ratio, g * f),
e = Math.min(e * this.ratio, g),
b = b.getCenterLonLat();
this.gridBounds = new OpenLayers.Bounds(b.lon -
d / 2, b.lat - e / 2, b.lon + d / 2, b.lat + e / 2);
for (var b = Math.floor(e / this.dy), d = Math.floor(d / this.dx), e = c.lon + this.dx * Math.ceil((this.gridBounds.left - c.lon) / this.dx), c = c.lat + this.dy * Math.ceil((this.gridBounds.bottom - c.lat) / this.dy), g = Array(b * d), h, i = 0; i < d; ++i)
for (var f = e + i * this.dx, j = 0; j < b; ++j) h = c + j * this.dy, h = new OpenLayers.Geometry.Point(f, h), this.rotation && h.rotate(this.rotation, a), g[i * b + j] = new OpenLayers.Feature.Vector(h);
for (var c = 0; c < b; ++c) a.symbolizers[c] = this.symbolizers[c].clone()
} else {
a.symbolizer = {};
for (var d in this.symbolizer) b = this.symbolizer[d], c = typeof b, "object" === c ? a.symbolizer[d] = OpenLayers.Util.extend({}, b) : "string" === c && (a.symbolizer[d] = b)
this.compare = a ? OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_Y_ORDER : OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER_DRAWING_ORDER;
this.clear()
},
insert: function (a) {
this.exists(a) && this.remove(a);
var b = a.id;
this.determineZIndex(a);
for (var c = -1, d = this.order.length, e; 1 < d - c;) e = parseInt((c + d) / 2), 0 < this.compare(this, a, OpenLayers.Util.getElement(this.order[e])) ? c = e : d = e;
if (e !== this.rightOfDateLine || b) c = !1, this.xOffset = !0 === e ? f.getWidth() / d : 0;
this.rightOfDateLine = e
}
return c
},
getNodeType: function () {},
drawGeometry: function (a,
b, c) {
var d = a.CLASS_NAME,
e = !0;
if ("OpenLayers.Geometry.Collection" == d || "OpenLayers.Geometry.MultiPoint" == d || "OpenLayers.Geometry.MultiLineString" == d || "OpenLayers.Geometry.MultiPolygon" == d) {
for (var d = 0, f = a.components.length; d < f; d++) e = this.drawGeometry(a.components[d], b, c) && e;
return e
}
d = e = !1;
"none" != b.display && (b.backgroundGraphic ? this.redrawBackgroundNode(a.id, a, b, c) : d = !0, e = this.redrawNode(a.id, a, b, c));
if (!1 == e && (b = document.getElementById(a.id))) b._style.backgroundGraphic && (d = !0), b.parentNode.removeChild(b);
d && (b = document.getElementById(a.id + this.BACKGROUND_ID_SUFFIX)) && b.parentNode.removeChild(b);
for (var e = 0, f = this.trackAttributes.length; e <
f; ++e) d = this.trackAttributes[e], c.attributes[d] = [], d in this.readers.kml || (this.readers.kml[d] = this.readers.kml._trackPointAttribute)
}
this.readChildNodes(a, c);
if (c.whens.length !== c.points.length) throw Error("gx:Track with unequal number of when (" + c.whens.length + ") and gx:coord (" + c.points.length + ") elements.");
var g = 0 < c.angles.length;
if (g && c.whens.length !== c.angles.length) throw Error("gx:Track with unequal number of when (" + c.whens.length + ") and gx:angles (" + c.angles.length + ") elements.");
var b = this.getElementsByTagNameNS(a, this.internalns, "coordinates"),
a = [];
if (0 < b.length) var c = b[0].firstChild.nodeValue,
c = c.replace(this.regExes.removeSpace, ""),
a = c.split(",");
b = null;
if (1 < a.length) 2 == a.length && (a[2] = null), b = new OpenLayers.Geometry.Point(a[0], a[1], a[2]);
else throw "Bad coordinate string: " + c;
return b
},
linestring: function (a, b) {
var c = this.getElementsByTagNameNS(a, this.internalns, "coordinates"),
d = null;
if (0 < c.length) {
for (var c = this.getChildValue(c[0]), c = c.replace(this.regExes.trimSpace, ""), c = c.replace(this.regExes.trimComma, ","), d = c.split(this.regExes.splitSpace), e = d.length, f = Array(e), g, h, i = 0; i < e; ++i)
if (g =
d[i].split(","), h = g.length, 1 < h) 2 == g.length && (g[2] = null), f[i] = new OpenLayers.Geometry.Point(g[0], g[1], g[2]);
else throw "Bad LineString point coordinates: " + d[i];
if (e) d = b ? new OpenLayers.Geometry.LinearRing(f) : new OpenLayers.Geometry.LineString(f);
else throw "Bad LineString coordinates: " + c;
}
return d
},
polygon: function (a) {
var a = this.getElementsByTagNameNS(a, this.internalns, "LinearRing"),
b = a.length,
c = Array(b);
if (0 < b)
for (var d = 0, e = a.length; d < e; ++d)
if (b = this.parseGeometry.linestring.apply(this, [a[d], !0])) c[d] =
b;
else throw "Bad LinearRing geometry: " + d;
return new OpenLayers.Geometry.Polygon(c)
},
multigeometry: function (a) {
for (var b, c = [], d = a.childNodes, e = 0, f = d.length; e < f; ++e) a = d[e], 1 == a.nodeType && (b = this.parseGeometry[(a.prefix ? a.nodeName.split(":")[1] : a.nodeName).toLowerCase()]) && c.push(b.apply(this, [a]));
return new OpenLayers.Geometry.Collection(c)
}
},
parseAttributes: function (a) {
var b = {},
c = a.getElementsByTagName("ExtendedData");
c.length && (b = this.parseExtendedData(c[0]));
for (var d, e, f, a = a.childNodes, c = 0, g =
a.length; c < g; ++c)
if (d = a[c], 1 == d.nodeType && (e = d.childNodes, 1 <= e.length && 3 >= e.length)) {
switch (e.length) {
case 1:
f = e[0];
break;
case 2:
f = e[0];
e = e[1];
f = 3 == f.nodeType || 4 == f.nodeType ? f : e;
break;
default:
f = e[1]
}
if (3 == f.nodeType || 4 == f.nodeType)
if (d = d.prefix ? d.nodeName.split(":")[1] : d.nodeName, f = OpenLayers.Util.getXmlNodeValue(f)) f = f.replace(this.regExes.trimSpace, ""), b[d] = f
for (d = a.length; c < d; c++) h = {}, e = a[c], f = e.getAttribute("name"), h.value = this.getChildValue(e), this.kvpAttributes ? b[f] = h.value : (h.displayName = f, b[f] = h);
return b
},
parseProperty: function (a, b, c) {
var d, a = this.getElementsByTagNameNS(a, b, c);
try {
d = OpenLayers.Util.getXmlNodeValue(a[0])
} catch (e) {
d =
null
}
return d
},
write: function (a) {
OpenLayers.Util.isArray(a) || (a = [a]);
for (var b = this.createElementNS(this.kmlns, "kml"), c = this.createFolderXML(), d = 0, e = a.length; d < e; ++d) c.appendChild(this.createPlacemarkXML(a[d]));
var b = this.createElementNS(this.kmlns, "LinearRing");
b.appendChild(this.buildCoordinatesNode(a));
return b
},
polygon: function (a) {
for (var b = this.createElementNS(this.kmlns, "Polygon"), a = a.components, c, d, e = 0, f = a.length; e < f; ++e) c = 0 == e ? "outerBoundaryIs" : "innerBoundaryIs",
c = this.createElementNS(this.kmlns, c), d = this.buildGeometry.linearring.apply(this, [a[e]]), c.appendChild(d), b.appendChild(c);
for (var b = this.createElementNS(this.kmlns, "MultiGeometry"), c, d = 0, e = a.components.length; d < e; ++d)(c = this.buildGeometryNode.apply(this, [a.components[d]])) && b.appendChild(c);
return b
}
},
buildCoordinatesNode: function (a) {
var b = this.createElementNS(this.kmlns, "coordinates"),
c;
if (c = a.components) {
for (var d = c.length, e = Array(d), f = 0; f < d; ++f) a = c[f], e[f] = this.buildCoordinates(a);
c = e.join(" ")
} else c = this.buildCoordinates(a);
c = this.createTextNode(c);
b.appendChild(c);
return b
},
buildCoordinates: function (a) {
this.internalProjection && this.externalProjection && (a = a.clone(), a.transform(this.internalProjection, this.externalProjection));
return a.x + "," + a.y
},
buildExtendedData: function (a) {
var b = this.createElementNS(this.kmlns, "ExtendedData"),
c;
for (c in a)
if (a[c] && "name" != c && "description" !=
c && "styleUrl" != c) {
var d = this.createElementNS(this.kmlns, "Data");
d.setAttribute("name", c);
var e = this.createElementNS(this.kmlns, "value");
if ("object" == typeof a[c]) {
if (a[c].value && e.appendChild(this.createTextNode(a[c].value)), a[c].displayName) {
var f = this.createElementNS(this.kmlns, "displayName");
c == OpenLayers.Format.Context.serviceTypes.WFS ? (d.strategies = [new OpenLayers.Strategy.BBOX], d.protocol = new OpenLayers.Protocol.WFS({
url: a.url,
featurePrefix: a.name.split(":")[0],
featureType: a.name.split(":").pop()
}), b = new OpenLayers.Layer.Vector(a.title || a.name, d)) : c == OpenLayers.Format.Context.serviceTypes.KML ? (d.strategies = [new OpenLayers.Strategy.Fixed], d.protocol = new OpenLayers.Protocol.HTTP({
url: a.url,
format: new OpenLayers.Format.KML
}),
b = new OpenLayers.Layer.Vector(a.title || a.name, d)) : c == OpenLayers.Format.Context.serviceTypes.GML ? (d.strategies = [new OpenLayers.Strategy.Fixed], d.protocol = new OpenLayers.Protocol.HTTP({
url: a.url,
format: new OpenLayers.Format.GML
}), b = new OpenLayers.Layer.Vector(a.title || a.name, d)) : a.features ? (b = new OpenLayers.Layer.Vector(a.title || a.name, d), b.addFeatures(a.features)) : !0 !== a.categoryLayer && (b = new OpenLayers.Layer.WMS(a.title || a.name, a.url, e, d));
"string" == typeof a && (a = OpenLayers.Format.XML.prototype.read.apply(this, [a]));
a = a.documentElement;
this.rootPrefix = a.prefix;
var b = {
version: a.getAttribute("version")
};
this.runChildNodes(b, a);
return b
},
runChildNodes: function (a, b) {
for (var c = b.childNodes, d, e, f, g = 0, h = c.length; g < h; ++g) d = c[g], 1 == d.nodeType && (e = this.getNamespacePrefix(d.namespaceURI), f = d.nodeName.split(":").pop(),
(e = this["read_" + e + "_" + f]) && e.apply(this, [a, d]))
},
read_wmc_General: function (a, b) {
this.runChildNodes(a, b)
},
read_wmc_BoundingBox: function (a, b) {
a.projection = b.getAttribute("SRS");
a.bounds = new OpenLayers.Bounds(b.getAttribute("minx"), b.getAttribute("miny"), b.getAttribute("maxx"), b.getAttribute("maxy"))
},
read_wmc_LayerList: function (a, b) {
a.layersContext = [];
this.runChildNodes(a, b)
},
read_wmc_Layer: function (a, b) {
var c = {
visibility: "1" != b.getAttribute("hidden"),
queryable: "1" == b.getAttribute("queryable"),
formats: [],
styles: [],
metadata: {}
};
this.runChildNodes(c, b);
a.layersContext.push(c)
},
read_wmc_Extension: function (a, b) {
this.runChildNodes(a, b)
},
read_ol_units: function (a, b) {
a.units = this.getChildValue(b)
},
read_ol_maxExtent: function (a, b) {
var c = new OpenLayers.Bounds(b.getAttribute("minx"), b.getAttribute("miny"), b.getAttribute("maxx"), b.getAttribute("maxy"));
var c = this.createElementNS(this.namespaces.ol, "ol:maxExtent");
this.setAttributes(c, {
minx: a.left.toPrecision(18),
miny: a.bottom.toPrecision(18),
maxx: a.right.toPrecision(18),
maxy: a.top.toPrecision(18)
});
b.appendChild(c)
}
return b
},
write_wmc_LayerList: function (a) {
for (var b = this.createElementDefaultNS("LayerList"), c = 0, d = a.layersContext.length; c < d; ++c) b.appendChild(this.write_wmc_Layer(a.layersContext[c]));
return b
},
write_wmc_Layer: function (a) {
var b = this.createElementDefaultNS("Layer", null, {
for (var c = "transparent numZoomLevels units isBaseLayer opacity displayInLayerSwitcher singleTile".split(" "), e = 0, f = c.length; e < f; ++e)(d = this.createOLPropertyNode(a, c[e])) && b.appendChild(d);
this.addControls([new OpenLayers.Control.Pan(OpenLayers.Control.Pan.NORTH, a), new OpenLayers.Control.Pan(OpenLayers.Control.Pan.SOUTH, a), new OpenLayers.Control.Pan(OpenLayers.Control.Pan.EAST, a), new OpenLayers.Control.Pan(OpenLayers.Control.Pan.WEST, a)])
(c.zIndex = this.featureTypeCounter, b.symbolizers.push(new OpenLayers.Symbolizer.Point(c))) : b.symbolizer.Point = c
},
Stroke: function (a, b) {
b.stroke = !0;
this.readChildNodes(a, b)
},
Fill: function (a, b) {
b.fill = !0;
this.readChildNodes(a, b)
},
CssParameter: function (a, b) {
var c = a.getAttribute("name"),
d = this.cssMap[c];
b.label && ("fill" === c ? d = "fontColor" : "fill-opacity" === c && (d = "fontOpacity"));
d && (c = this.readers.ogc._expression.call(this, a)) && (b[d] = c)
},
Graphic: function (a, b) {
b.graphic = !0;
var c = {};
this.readChildNodes(a, c);
for (var d = "stroke strokeColor strokeWidth strokeOpacity strokeLinecap fill fillColor fillOpacity graphicName rotation graphicFormat".split(" "), e, f, g = 0, h = d.length; g < h; ++g) e = d[g], f = c[e], void 0 != f && (b[e] = f);
}, d = [0], e, f, g, h, i, j = 0, k = a.rules.length; j < k; ++j)
if (e = a.rules[j], e.symbolizers) {
f = {};
for (var l = 0, m = e.symbolizers.length; l < m; ++l) g = e.symbolizers[l], h = g.zIndex, h in f || (i = e.clone(), i.symbolizers = [], f[h] = i), f[h].symbolizers.push(g.clone());
for (h in f) h in c || (d.push(h), c[h] = []), c[h].push(f[h])
} else c[0].push(e.clone());
d.sort();
j = 0;
for (k = d.length; j < k; ++j) e = c[d[j]], 0 < e.length && (i = a.clone(), i.rules = c[d[j]], this.writeNode("FeatureTypeStyle", i, b))
f; ++e) d = a.symbolizers[e], c = d.CLASS_NAME.split(".").pop(), this.writeNode(c + "Symbolizer", d, b);
else
for (var f = OpenLayers.Style.SYMBOLIZER_PREFIXES, e = 0, g = f.length; e < g; ++e) c = f[e], (d = a.symbolizer[c]) && this.writeNode(c + "Symbolizer", d, b);
(a.setAttributeNS(null, "points", c.path), c.complete ? a : null) : !1
},
drawPolygon: function (a, b) {
for (var c = "", d = !0, e = !0, f, g, h = 0, i = b.components.length; h < i; h++) c += " M", f = this.getComponentsString(b.components[h].components, " "), (g = f.path) ? (c += " " + g, e = f.complete && e) : d = !1;
return d ? (a.setAttributeNS(null, "d", c + " z"), a.setAttributeNS(null, "fill-rule", "evenodd"), e ? a : null) : !1
var l = OpenLayers.Renderer.SVG.LABEL_VFACTOR[g[1]];
null == l && (l = -0.5);
k.setAttribute("dy", l * (i - 1) + "em")
} else k.setAttribute("dy",
"1em");
k.textContent = "" === h[j] ? " " : h[j];
k.parentNode || f.appendChild(k)
}
f.parentNode || this.textRoot.appendChild(f)
},
getComponentsString: function (a, b) {
for (var c = [], d = !0, e = a.length, f = [], g, h = 0; h < e; h++) g = a[h], c.push(g), (g = this.getShortString(g)) ? f.push(g) : (0 < h && this.getShortString(a[h - 1]) && f.push(this.clipLine(a[h], a[h - 1])), h < e - 1 && this.getShortString(a[h + 1]) && f.push(this.clipLine(a[h], a[h + 1])), d = !1);
return {
path: f.join(b || ","),
complete: d
}
},
clipLine: function (a, b) {
if (b.equals(a)) return "";
var c = this.getResolution(),
d = this.MAX_PIXEL - this.translationParameters.x,
e = this.MAX_PIXEL - this.translationParameters.y,
f = (b.x - this.featureDx) / c + this.left,
g = this.top - b.y / c,
h = (a.x - this.featureDx) / c + this.left,
c = this.top - a.y / c,
i;
if (h < -d || h > d) i = (c - g) / (h - f), h = 0 > h ? -d : d, c = g + (h - f) * i;
if (c < -e || c > e) i = (h - f) / (c - g), c = 0 > c ? -e : e, h = f + (c - g) * i;
return h + "," + c
},
getShortString: function (a) {
var b = this.getResolution(),
c = (a.x - this.featureDx) / b + this.left,
a = this.top - a.y / b;
return this.inValidRange(c, a) ? c + "," + a : !1
},
getPosition: function (a) {
return {
x: parseFloat(a.getAttributeNS(null,
"cx")),
y: parseFloat(a.getAttributeNS(null, "cy"))
}
},
importSymbol: function (a) {
this.defs || (this.defs = this.createDefs());
var b = this.container.id + "-" + a,
c = document.getElementById(b);
if (null != c) return c;
var d = OpenLayers.Renderer.symbol[a];
if (!d) throw Error(a + " is not a valid symbol name");
var a = this.nodeFactory(b, "symbol"),
e = this.nodeFactory(null, "polygon");
a.appendChild(e);
for (var c = new OpenLayers.Bounds(Number.MAX_VALUE, Number.MAX_VALUE, 0, 0), f = [], g, h, i = 0; i < d.length; i += 2) g = d[i], h = d[i + 1], c.left = Math.min(c.left,
if (!1 !== this.events.triggerEvent("beforesetfeature", {
feature: a
})) {
this.feature = a;
this.activate();
this._setfeature = !0;
var e = this.feature.geometry.getBounds();
this.box.move(e.getCenterLonLat());
this.box.geometry.rotate(-c, d);
this._angle = 0;
this.rotation ? (c = a.geometry.clone(), c.rotate(-this.rotation, this.center), c = new OpenLayers.Feature.Vector(c.getBounds().toGeometry()), c.geometry.rotate(this.rotation, this.center), this.box.geometry.rotate(this.rotation, this.center), this.box.move(c.geometry.getBounds().getCenterLonLat()), c = c.geometry.components[0].components[0].getBounds().getCenterLonLat()) : c = new OpenLayers.LonLat(e.left, e.bottom);
this.center = new OpenLayers.Geometry.Point(0, 0);
this.box = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(-1, -1), new OpenLayers.Geometry.Point(0, -1), new OpenLayers.Geometry.Point(1, -1), new OpenLayers.Geometry.Point(1, 0), new OpenLayers.Geometry.Point(1, 1), new OpenLayers.Geometry.Point(0, 1), new OpenLayers.Geometry.Point(-1,
1), new OpenLayers.Geometry.Point(-1, 0), new OpenLayers.Geometry.Point(-1, -1)]), null, "string" == typeof this.renderIntent ? null : this.renderIntent);
if (Math.abs(a._angle) >= f || 0 !== d) d = Math.round(a._angle / f) * f - d, a._angle = 0, a.box.geometry.rotate(d, g), a.transformFeature({
rotation: d
})
}
}, g = Array(8), h = Array(4), i, j, k, l = "sw s se e ne n nw w".split(" "), m = 0; 8 > m; ++m) i = this.box.geometry.components[m], j = new OpenLayers.Feature.Vector(i.clone(), {
role: l[m] + "-resize"
}, "string" == typeof this.renderIntent ? null : this.renderIntent), 0 == m % 2 && (k = new OpenLayers.Feature.Vector(i.clone(), {
"multi" in this.handlerOptions || (this.handlerOptions.multi = this.multi);
if (a = this.layer.styleMap && this.layer.styleMap.styles.temporary) this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions, {
var a = OpenLayers.Strategy.prototype.activate.call(this);
a && (this.layer.events.on({
moveend: this.update,
refresh: this.update,
visibilitychanged: this.update,
scope: this
}), this.update());
return a
},
deactivate: function () {
var a = OpenLayers.Strategy.prototype.deactivate.call(this);
a && this.layer.events.un({
moveend: this.update,
refresh: this.update,
visibilitychanged: this.update,
scope: this
});
return a
},
update: function (a) {
var b = this.getMapBounds();
if (null !== b && (a && a.force || this.layer.visibility && this.layer.calculateInRange() && this.invalidBounds(b))) this.calculateBounds(b), this.resolution = this.layer.map.getResolution(), this.triggerRead(a)
},
getMapBounds: function () {
if (null === this.layer.map) return null;
var a = this.layer.map.getExtent();
a && !this.layer.projection.equals(this.layer.map.getProjectionObject()) && (a = a.clone().transform(this.layer.map.getProjectionObject(), this.layer.projection));
return a
},
invalidBounds: function (a) {
a || (a = this.getMapBounds());
a = !this.bounds || !this.bounds.containsBounds(a);
!a && this.resFactor && (a = this.resolution / this.layer.map.getResolution(), a = a >= this.resFactor || a <= 1 / this.resFactor);
return a
},
calculateBounds: function (a) {
a || (a = this.getMapBounds());
var b = a.getCenterLonLat(),
c = a.getWidth() * this.ratio,
a = a.getHeight() * this.ratio;
this.bounds = new OpenLayers.Bounds(b.lon - c / 2, b.lat - a / 2, b.lon + c / 2, b.lat + a / 2)
null != a && (b = this.sphericalMercator ? this.inverseMercator(a.bottom, a.left) : new OpenLayers.LonLat(a.bottom,
a.left), a = this.sphericalMercator ? this.inverseMercator(a.top, a.right) : new OpenLayers.LonLat(a.top, a.right), b = new google.maps.LatLngBounds(new google.maps.LatLng(b.lat, b.lon), new google.maps.LatLng(a.lat, a.lon)));
return b
},
getMapObjectLonLatFromMapObjectPixel: function (a) {
var b = this.map.getSize(),
c = this.getLongitudeFromMapObjectLonLat(this.mapObject.center),
d = this.getLatitudeFromMapObjectLonLat(this.mapObject.center),
e = this.map.getResolution(),
a = new OpenLayers.LonLat(c + (a.x - b.w / 2) * e, d - (a.y - b.h / 2) * e);
this.wrapDateLine && (a = a.wrapDateLine(this.maxExtent));
"string" == typeof a && (a = OpenLayers.Format.XML.prototype.read.apply(this, [a]));
a && 9 == a.nodeType && (a = a.documentElement);
var b = {};
this.readNode(a, b);
return b
},
readers: {
csw: {
GetRecordsResponse: function (a, b) {
b.records = [];
this.readChildNodes(a, b);
var c = this.getAttributeNS(a, "", "version");
"" != c && (b.version = c)
},
RequestId: function (a, b) {
b.RequestId = this.getChildValue(a)
},
SearchStatus: function (a, b) {
b.SearchStatus = {};
var c = this.getAttributeNS(a, "", "timestamp");
"" != c && (b.SearchStatus.timestamp = c)
},
SearchResults: function (a, b) {
this.readChildNodes(a, b);
for (var c = a.attributes, d = {}, e = 0, f = c.length; e < f; ++e) d[c[e].name] = "numberOfRecordsMatched" == c[e].name || "numberOfRecordsReturned" ==
i && (this.internalProjection && this.externalProjection && f.transform(this.externalProjection, this.internalProjection), e = new OpenLayers.Feature.Vector(f, g, h), c.push(e))
for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.point.apply(this, [a.components[c]]) +
")");
return b.join(",")
},
linestring: function (a) {
for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extract.point.apply(this, [a.components[c]]));
return b.join(",")
},
multilinestring: function (a) {
for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.linestring.apply(this, [a.components[c]]) + ")");
return b.join(",")
},
polygon: function (a) {
for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.linestring.apply(this, [a.components[c]]) + ")");
return b.join(",")
},
multipolygon: function (a) {
for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push("(" + this.extract.polygon.apply(this, [a.components[c]]) + ")");
return b.join(",")
},
collection: function (a) {
for (var b = [], c = 0, d = a.components.length; c < d; ++c) b.push(this.extractGeometry.apply(this, [a.components[c]]));
return b.join(",")
}
},
parse: {
point: function (a) {
a = OpenLayers.String.trim(a).split(this.regExes.spaces);
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(a[0], a[1]))
},
multipoint: function (a) {
for (var b = OpenLayers.String.trim(a).split(","),
c = [], d = 0, e = b.length; d < e; ++d) a = b[d].replace(this.regExes.trimParens, "$1"), c.push(this.parse.point.apply(this, [a]).geometry);
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(c))
},
linestring: function (a) {
for (var a = OpenLayers.String.trim(a).split(","), b = [], c = 0, d = a.length; c < d; ++c) b.push(this.parse.point.apply(this, [a[c]]).geometry);
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(b))
},
multilinestring: function (a) {
for (var b = OpenLayers.String.trim(a).split(this.regExes.parenComma),
c = [], d = 0, e = b.length; d < e; ++d) a = b[d].replace(this.regExes.trimParens, "$1"), c.push(this.parse.linestring.apply(this, [a]).geometry);
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(c))
},
polygon: function (a) {
for (var b, a = OpenLayers.String.trim(a).split(this.regExes.parenComma), c = [], d = 0, e = a.length; d < e; ++d) b = a[d].replace(this.regExes.trimParens, "$1"), b = this.parse.linestring.apply(this, [b]).geometry, b = new OpenLayers.Geometry.LinearRing(b.components), c.push(b);
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(c))
},
multipolygon: function (a) {
for (var b = OpenLayers.String.trim(a).split(this.regExes.doubleParenComma), c = [], d = 0, e = b.length; d < e; ++d) a = b[d].replace(this.regExes.trimParens, "$1"), c.push(this.parse.polygon.apply(this, [a]).geometry);
return new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(c))
},
geometrycollection: function (a) {
for (var a = a.replace(/,\s*([A-Za-z])/g, "|$1"), a = OpenLayers.String.trim(a).split("|"), b = [], c = 0, d = a.length; c < d; ++c) b.push(OpenLayers.Format.WKT.prototype.read.apply(this, [a[c]]));
for (var b = new OpenLayers.Geometry.Point(b.lon, b.lat), d, e, f, g = Number.MAX_VALUE, h = 0; h < a.length && !(d = a[h], d.geometry && (f = b.distanceTo(d.geometry, {
edge: !1
}), f < g && (g = f, e = d, 0 == g))); ++h);
!0 == c.hover ? this.hoverSelect(e) : this.select(e || a)
var b = (new OpenLayers.LonLat(a.coords.longitude, a.coords.latitude)).transform(new OpenLayers.Projection("EPSG:4326"), this.map.getProjectionObject());
for (var e = a.attributes, f, g, h = 0, i = e.length; h < i; ++h) f = e[h], g = f.name, 0 == g.indexOf("xmlns") ? this.setNamespace(g.split(":")[1] || "", f.value) : b[g] = f.value;
for (var c = a.childNodes, d, e, f = 0, g = c.length; f < g; ++f) d = c[f], 1 == d.nodeType && (e = d.nodeName.split(":").pop(), d = d.getAttribute("value"),
c = OpenLayers.String.trim(this.getChildValue(e[0])).split(/\s+/);
d = [];
e = 0;
for (f = c.length; e < f; e += 2) b = new OpenLayers.Geometry.Point(c[e + 1], c[e]), d.push(b);
h = new OpenLayers.Geometry.LineString(d)
} else if (0 < f.length) {
c = OpenLayers.String.trim(this.getChildValue(f[0])).split(/\s+/);
d = [];
e = 0;
for (f = c.length; e < f; e += 2) b = new OpenLayers.Geometry.Point(c[e + 1], c[e]), d.push(b);
h = new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(d)])
} else 0 <
g.length ? (this.gmlParser || (this.gmlParser = new OpenLayers.Format.GML({
xy: this.xy
})), h = this.gmlParser.parseFeature(g[0]).geometry) : 0 < a.length && (c = OpenLayers.String.trim(a[0].firstChild.nodeValue).split(/\s+/), d = [], 3 < c.length && (b = new OpenLayers.Geometry.Point(c[1], c[0]), d.push(b), b = new OpenLayers.Geometry.Point(c[1], c[2]), d.push(b), b = new OpenLayers.Geometry.Point(c[3], c[2]), d.push(b), b = new OpenLayers.Geometry.Point(c[3], c[0]), d.push(b), b = new OpenLayers.Geometry.Point(c[1], c[0]), d.push(b)), h = new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing(d)]));
h && (this.internalProjection && this.externalProjection) && h.transform(this.externalProjection, this.internalProjection);
return h
},
createFeatureFromItem: function (a) {
var b = this.createGeometryFromItem(a),
c = this._getChildValue(a, "*", "title", this.featureTitle),
for (var f in a.attributes) "link" == f || ("title" == f || "description" == f) || (d = this.createTextNode(a.attributes[f]), e = f, -1 !=
f.search(":") && (e = f.split(":")[1]), e = this.createElementNS(this.featureNS, "feature:" + e), e.appendChild(d), c.appendChild(e));
c.appendChild(b);
return c
},
buildGeometryNode: function (a) {
this.internalProjection && this.externalProjection && (a = a.clone(), a.transform(this.internalProjection, this.externalProjection));
var b;
if ("OpenLayers.Geometry.Polygon" == a.CLASS_NAME) b = this.createElementNS(this.georssns, "georss:polygon"), b.appendChild(this.buildCoordinatesNode(a.components[0]));
else if ("OpenLayers.Geometry.LineString" ==
a.CLASS_NAME) b = this.createElementNS(this.georssns, "georss:line"), b.appendChild(this.buildCoordinatesNode(a));
else if ("OpenLayers.Geometry.Point" == a.CLASS_NAME) b = this.createElementNS(this.georssns, "georss:point"), b.appendChild(this.buildCoordinatesNode(a));
else throw "Couldn't parse " + a.CLASS_NAME;
return b
},
buildCoordinatesNode: function (a) {
var b = null;
a.components && (b = a.components);
if (b) {
for (var a = b.length, c = Array(a), d = 0; d < a; d++) c[d] = b[d].y + " " + b[d].x;
for (var f in a.attributes) c = this.createElementNS(this.wfsns, "wfs:Property"), d = this.createElementNS(this.wfsns, "wfs:Name"), d.appendChild(this.createTextNode(f)), c.appendChild(d), d = this.createElementNS(this.wfsns, "wfs:Value"), d.appendChild(this.createTextNode(a.attributes[f])), c.appendChild(d), b.appendChild(c);
c = this.createElementNS(this.ogcns, "ogc:Filter");
f = this.createElementNS(this.ogcns, "ogc:FeatureId");
f.setAttribute("fid", a.fid);
c.appendChild(f);
b.appendChild(c);
return b
},
remove: function (a) {
if (!a.fid) return OpenLayers.Console.userError(OpenLayers.i18n("noFID")), !1;
var b = this.createElementNS(this.wfsns, "wfs:Delete");
for (var b = document.createStyleSheet(), c = "shape rect oval fill stroke imagedata group textbox".split(" "), d = 0, e = c.length; d < e; d++) b.addRule("olv\\:" + c[d], "behavior: url(#default#VML); position: absolute; display: inline-block;")
for (var b = [this.rendererRoot, this.root, this.vectorRoot, this.textRoot], c = this.size.w + "px", d = this.size.h + "px", e, f = 0, g = b.length; f < g; ++f) e = b[f], e.style.width = c, e.style.height = d
return this.nodeFactory(this.container.id + a, "olv:group")
},
drawPoint: function (a, b) {
return this.drawCircle(a, b, 1)
},
drawCircle: function (a, b, c) {
if (!isNaN(b.x) && !isNaN(b.y)) {
var d = this.getResolution();
a.style.left = ((b.x - this.featureDx) / d - this.offset.x | 0) - c + "px";
a.style.top = (b.y / d - this.offset.y | 0) - c + "px";
b = 2 * c;
a.style.width =
b + "px";
a.style.height = b + "px";
return a
}
return !1
},
drawLineString: function (a, b) {
return this.drawLine(a, b, !1)
},
drawLinearRing: function (a, b) {
return this.drawLine(a, b, !0)
},
drawLine: function (a, b, c) {
this.setNodeDimension(a, b);
for (var d = this.getResolution(), e = b.components.length, f = Array(e), g, h, i = 0; i < e; i++) g = b.components[i], h = (g.x - this.featureDx) / d - this.offset.x | 0, g = g.y / d - this.offset.y | 0, f[i] = " " + h + "," + g + " l ";
a.path = "m" + f.join("") + (c ? " x e" : " e");
return a
},
drawPolygon: function (a, b) {
this.setNodeDimension(a,
b);
var c = this.getResolution(),
d = [],
e, f, g, h, i, j, k, l, m, n;
e = 0;
for (f = b.components.length; e < f; e++) {
d.push("m");
g = b.components[e].components;
h = 0 === e;
j = i = null;
k = 0;
for (l = g.length; k < l; k++) m = g[k], n = (m.x - this.featureDx) / c - this.offset.x | 0, m = m.y / c - this.offset.y | 0, n = " " + n + "," + m, d.push(n), 0 == k && d.push(" l"), h || (i ? i != n && (j ? j != n && (h = !0) : j = n) : i = n);
for (var f = [], k = null, l = Math.min(e[0].y, 90), h = Math.max(e[e.length - 1].y, -90), m = (l - h) / this.numPoints, l = h, h = 0; h <= this.numPoints; ++h) {
var n = new OpenLayers.Geometry.Point(j,
l);
n.transform(b, c);
f.push(n);
l += m;
n.y >= a.bottom && !k && (k = n)
}
this.labelled && (k = new OpenLayers.Geometry.Point(k.x, a.bottom), j = {
var b = OpenLayers.Util.isEquivalentUrl(this.url, a);
if (!b && this.layerUrls)
for (var c = 0, d = this.layerUrls.length; c < d; ++c)
if (OpenLayers.Util.isEquivalentUrl(this.layerUrls[c], a)) {
b = !0;
break
} return b
},
buildWMSOptions: function (a, b, c, d) {
for (var e = [], f = [], g = 0, h = b.length; g < h; g++) null != b[g].params.LAYERS && (e = e.concat(b[g].params.LAYERS), f = f.concat(this.getStyleNames(b[g])));
null == a && (a = new OpenLayers.Layer.WMTS(this.options));
return a = OpenLayers.Layer.Grid.prototype.clone.apply(this, [a])
},
getIdentifier: function () {
return this.getServerZoom()
},
getMatrix: function () {
var a;
if (!this.matrixIds || 0 === this.matrixIds.length) a = {
identifier: this.getIdentifier()
};
else if ("scaleDenominator" in this.matrixIds[0])
for (var b =
OpenLayers.METERS_PER_INCH * OpenLayers.INCHES_PER_UNIT[this.units] * this.getServerResolution() / 2.8E-4, c = Number.POSITIVE_INFINITY, d, e = 0, f = this.matrixIds.length; e < f; ++e) d = Math.abs(1 - this.matrixIds[e].scaleDenominator / b), d < c && (c = d, a = this.matrixIds[e]);
else a = this.matrixIds[this.getIdentifier()];
return a
},
getTileInfo: function (a) {
var b = this.getServerResolution(),
c = (a.lon - this.tileOrigin.lon) / (b * this.tileSize.w),
a = (this.tileOrigin.lat - a.lat) / (b * this.tileSize.h),
b = Math.floor(c),
d = Math.floor(a);
return {
col: b,
row: d,
i: Math.floor((c - b) * this.tileSize.w),
j: Math.floor((a - d) * this.tileSize.h)
}
},
getURL: function (a) {
var a = this.adjustBounds(a),
b = "";
if (!this.tileFullExtent || this.tileFullExtent.intersectsBounds(a)) {
var c = this.getTileInfo(a.getCenterLonLat()),
a = this.dimensions;
if ("REST" === this.requestEncoding.toUpperCase())
for (var e = OpenLayers.Util.isArray(c.authors) ? c.authors : [c.authors], f = 0, g = e.length; f < g; f++) d.appendChild(this.buildPersonConstructNode("author", e[f]));
if (c.categories)
for (var e = OpenLayers.Util.isArray(c.categories) ? c.categories : [c.categories],
h, f = 0, g = e.length; f < g; f++) h = e[f], d.appendChild(this.createElementNSPlus("atom:category", {