Compare commits
7 Commits
docs
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3217a7a68 | ||
|
|
07fd731e7f | ||
|
|
d25037210a | ||
|
|
0b0d04b637 | ||
|
|
aeff2e62df | ||
|
|
6162cbafec | ||
|
|
7884e9527f |
@@ -19,10 +19,10 @@
|
|||||||
var layer = new OpenLayers.Layer.Vector("WFS", {
|
var layer = new OpenLayers.Layer.Vector("WFS", {
|
||||||
strategies: [new OpenLayers.Strategy.BBOX()],
|
strategies: [new OpenLayers.Strategy.BBOX()],
|
||||||
protocol: new OpenLayers.Protocol.WFS({
|
protocol: new OpenLayers.Protocol.WFS({
|
||||||
url: "http://publicus.opengeo.org/geoserver/wfs",
|
url: "http://demo.opengeo.org/geoserver/wfs",
|
||||||
featureType: "tasmania_roads",
|
featureType: "tasmania_roads",
|
||||||
featureNS: "http://www.openplans.org/topp"
|
featureNS: "http://www.openplans.org/topp"
|
||||||
}),
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addLayers([wms, layer]);
|
map.addLayers([wms, layer]);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"http://t1.hypercube.telascience.org/cgi-bin/landsat7",
|
"http://t1.hypercube.telascience.org/cgi-bin/landsat7",
|
||||||
{layers: "landsat7"});
|
{layers: "landsat7"});
|
||||||
|
|
||||||
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:"2005-08-29T13:00:00Z"});
|
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:"2005-08-29T13:00:00Z"});
|
||||||
|
|
||||||
jpl_wms.setVisibility(false);
|
jpl_wms.setVisibility(false);
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ OpenLayers.String = {
|
|||||||
* Used to find tokens in a string.
|
* Used to find tokens in a string.
|
||||||
* Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
|
* Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
|
||||||
*/
|
*/
|
||||||
tokenRegEx: /\${([\w.]+?)}/g,
|
tokenRegEx: /\$\{([\w.]+?)\}/g,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: OpenLayers.String.numberRegEx
|
* Property: OpenLayers.String.numberRegEx
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
* {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect
|
* {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect
|
||||||
* callbacks. If null the scope will be this control.
|
* callbacks. If null the scope will be this control.
|
||||||
*/
|
*/
|
||||||
scope: this,
|
scope: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: geometryTypes
|
* APIProperty: geometryTypes
|
||||||
@@ -178,6 +178,10 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
OpenLayers.Control.prototype.EVENT_TYPES
|
OpenLayers.Control.prototype.EVENT_TYPES
|
||||||
);
|
);
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
|
|
||||||
|
if(this.scope === null) {
|
||||||
|
this.scope = this;
|
||||||
|
}
|
||||||
if(layers instanceof Array) {
|
if(layers instanceof Array) {
|
||||||
this.layers = layers;
|
this.layers = layers;
|
||||||
this.layer = new OpenLayers.Layer.Vector.RootContainer(
|
this.layer = new OpenLayers.Layer.Vector.RootContainer(
|
||||||
|
|||||||
@@ -435,6 +435,14 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
*/
|
*/
|
||||||
includeXY: false,
|
includeXY: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: clearMouseListener
|
||||||
|
* A version of <clearMouseCache> that is bound to this instance so that
|
||||||
|
* it can be used with <OpenLayers.Event.observe> and
|
||||||
|
* <OpenLayers.Event.stopObserving>.
|
||||||
|
*/
|
||||||
|
clearMouseListener: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Events
|
* Constructor: OpenLayers.Events
|
||||||
* Construct an OpenLayers.Events object.
|
* Construct an OpenLayers.Events object.
|
||||||
@@ -459,6 +467,11 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
this.handleBrowserEvent, this
|
this.handleBrowserEvent, this
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// to be used with observe and stopObserving
|
||||||
|
this.clearMouseListener = OpenLayers.Function.bind(
|
||||||
|
this.clearMouseCache, this
|
||||||
|
);
|
||||||
|
|
||||||
// if eventTypes is specified, create a listeners list for each
|
// if eventTypes is specified, create a listeners list for each
|
||||||
// custom application event.
|
// custom application event.
|
||||||
this.eventTypes = [];
|
this.eventTypes = [];
|
||||||
@@ -481,6 +494,11 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
destroy: function () {
|
destroy: function () {
|
||||||
if (this.element) {
|
if (this.element) {
|
||||||
OpenLayers.Event.stopObservingElement(this.element);
|
OpenLayers.Event.stopObservingElement(this.element);
|
||||||
|
if(this.element.hasScrollEvent) {
|
||||||
|
OpenLayers.Event.stopObserving(
|
||||||
|
window, "scroll", this.clearMouseListener
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.element = null;
|
this.element = null;
|
||||||
|
|
||||||
@@ -773,8 +791,7 @@ OpenLayers.Events = OpenLayers.Class({
|
|||||||
if (!this.includeXY) {
|
if (!this.includeXY) {
|
||||||
this.clearMouseCache();
|
this.clearMouseCache();
|
||||||
} else if (!this.element.hasScrollEvent) {
|
} else if (!this.element.hasScrollEvent) {
|
||||||
OpenLayers.Event.observe(window, 'scroll',
|
OpenLayers.Event.observe(window, "scroll", this.clearMouseListener);
|
||||||
OpenLayers.Function.bind(this.clearMouseCache, this));
|
|
||||||
this.element.hasScrollEvent = true;
|
this.element.hasScrollEvent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -557,8 +557,8 @@ OpenLayers.Format.ArcXML = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
var keys = this.fontStyleKeys;
|
var keys = this.fontStyleKeys;
|
||||||
for (var i = 0, len = keys.length; i < len; i++) {
|
for (var i = 0, len = keys.length; i < len; i++) {
|
||||||
var key = keys[i];
|
var key = keys[i];
|
||||||
if (symbol[key]) {
|
if (exact.symbol[key]) {
|
||||||
selem.setAttribute(key, renderer[key]);
|
selem.setAttribute(key, exact.symbol[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eelem.appendChild(selem);
|
eelem.appendChild(selem);
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ OpenLayers.Format.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
var attributes = {};
|
var attributes = {};
|
||||||
if (node.nodeType == 1) {
|
if (node.nodeType == 1) {
|
||||||
var children = node.childNodes;
|
var children = node.childNodes;
|
||||||
n = children.length
|
n = children.length;
|
||||||
for (var i = 0; i < n; ++i) {
|
for (var i = 0; i < n; ++i) {
|
||||||
var child = children[i];
|
var child = children[i];
|
||||||
if (child.nodeType == 1) {
|
if (child.nodeType == 1) {
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ OpenLayers.Lang["nb"] = {
|
|||||||
"Denne innstillingen er foreldet, den var ment for <20> st<73>tte " +
|
"Denne innstillingen er foreldet, den var ment for <20> st<73>tte " +
|
||||||
"visning av kartdata over kommersielle bakgrunnskart, men det " +
|
"visning av kartdata over kommersielle bakgrunnskart, men det " +
|
||||||
"b<>r n<> gj<67>res med st<73>tten for Spherical Mercator. Mer informasjon " +
|
"b<>r n<> gj<67>res med st<73>tten for Spherical Mercator. Mer informasjon " +
|
||||||
"finnes p<> " +
|
"finnes p<> http://trac.openlayers.org/wiki/SphericalMercator.",
|
||||||
"http://trac.openlayers.org/wiki/SphericalMercator.",
|
|
||||||
|
|
||||||
// console message
|
// console message
|
||||||
'methodDeprecated':
|
'methodDeprecated':
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
|
|
||||||
if (!arcxml.iserror()) {
|
if (!arcxml.iserror()) {
|
||||||
// if the arcxml is not an error, call the callback with the features parsed
|
// if the arcxml is not an error, call the callback with the features parsed
|
||||||
callback.call(scope, arcxml.features);
|
callback.call(scope, response.features);
|
||||||
} else {
|
} else {
|
||||||
// if the arcxml is an error, return null features selected
|
// if the arcxml is an error, return null features selected
|
||||||
callback.call(scope, null);
|
callback.call(scope, null);
|
||||||
|
|||||||
@@ -212,22 +212,24 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
|||||||
* evt - {Event}
|
* evt - {Event}
|
||||||
*/
|
*/
|
||||||
onMapResize: function() {
|
onMapResize: function() {
|
||||||
this.windowResized = true;
|
// workaround for resizing of invisible or not yet fully loaded layers
|
||||||
if(this.visibility) {
|
// where GMap2.checkResize() does not work. We need to load the GMap
|
||||||
this.checkResize();
|
// for the old div size, then checkResize(), and then call
|
||||||
}
|
// layer.moveTo() to trigger GMap.setCenter() (which will finish
|
||||||
},
|
// the GMap initialization).
|
||||||
|
if(this.visibility && this.mapObject.isLoaded()) {
|
||||||
/**
|
|
||||||
* APIMethod: checkResize
|
|
||||||
* Check if the map has been resized, and if the Google Maps object is ready for checkResize.
|
|
||||||
* If the mapObject.getSize() equals the layer div's offset size, or if mapObject.getCenter()
|
|
||||||
* is null, the mapObject.checkResize() will fail.
|
|
||||||
*/
|
|
||||||
checkResize: function() {
|
|
||||||
if (this.windowResized && this.div.style.display != "none" && this.mapObject.getCenter()) {
|
|
||||||
this.mapObject.checkResize();
|
this.mapObject.checkResize();
|
||||||
this.windowResized = false;
|
} else {
|
||||||
|
if(!this._resized) {
|
||||||
|
var layer = this;
|
||||||
|
var handle = GEvent.addListener(this.mapObject, "load", function() {
|
||||||
|
GEvent.removeListener(handle);
|
||||||
|
delete layer._resized;
|
||||||
|
layer.mapObject.checkResize();
|
||||||
|
layer.moveTo(layer.map.getCenter(), layer.map.getZoom());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this._resized = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -240,7 +242,6 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
|||||||
*/
|
*/
|
||||||
display: function(display) {
|
display: function(display) {
|
||||||
OpenLayers.Layer.EventPane.prototype.display.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.display.apply(this, arguments);
|
||||||
this.checkResize();
|
|
||||||
this.termsOfUse.style.display = this.div.style.display;
|
this.termsOfUse.style.display = this.div.style.display;
|
||||||
this.poweredBy.style.display = this.div.style.display;
|
this.poweredBy.style.display = this.div.style.display;
|
||||||
},
|
},
|
||||||
@@ -264,21 +265,6 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
|||||||
OpenLayers.Layer.EventPane.prototype.removeMap.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.removeMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Method: moveTo
|
|
||||||
* Handle calls to move the layer.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* bound - {<OpenLayers.Bounds>}
|
|
||||||
* zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
|
|
||||||
* do some init work in that case.
|
|
||||||
* dragging - {Boolean}
|
|
||||||
*/
|
|
||||||
moveTo:function(bounds, zoomChanged, dragging) {
|
|
||||||
OpenLayers.Layer.EventPane.prototype.moveTo.apply(this, arguments);
|
|
||||||
this.checkResize();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getZoomForExtent
|
* APIMethod: getZoomForExtent
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -105,7 +105,9 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
var res = this.map.getResolution();
|
var res = this.map.getResolution();
|
||||||
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
|
||||||
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
|
||||||
var z = this.serverResolutions != null ? this.serverResolutions.indexOf(res) : this.map.getZoom();
|
var z = this.serverResolutions != null ?
|
||||||
|
OpenLayers.Util.indexOf(this.serverResolutions, res) :
|
||||||
|
this.map.getZoom();
|
||||||
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
|
||||||
var url = this.url;
|
var url = this.url;
|
||||||
if (url instanceof Array) {
|
if (url instanceof Array) {
|
||||||
|
|||||||
@@ -105,7 +105,9 @@ OpenLayers.Layer.TileCache = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
var size = this.tileSize;
|
var size = this.tileSize;
|
||||||
var tileX = Math.round((bounds.left - bbox.left) / (res * size.w));
|
var tileX = Math.round((bounds.left - bbox.left) / (res * size.w));
|
||||||
var tileY = Math.round((bounds.bottom - bbox.bottom) / (res * size.h));
|
var tileY = Math.round((bounds.bottom - bbox.bottom) / (res * size.h));
|
||||||
var tileZ = this.serverResolutions != null ? this.serverResolutions.indexOf(res) : this.map.getZoom();
|
var tileZ = this.serverResolutions != null ?
|
||||||
|
OpenLayers.Util.indexOf(this.serverResolutions, res) :
|
||||||
|
this.map.getZoom();
|
||||||
/**
|
/**
|
||||||
* Zero-pad a positive integer.
|
* Zero-pad a positive integer.
|
||||||
* number - {Int}
|
* number - {Int}
|
||||||
|
|||||||
@@ -1661,6 +1661,8 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
var bounds = this.getExtent();
|
var bounds = this.getExtent();
|
||||||
|
|
||||||
//send the move call to the baselayer and all the overlays
|
//send the move call to the baselayer and all the overlays
|
||||||
|
|
||||||
|
if(this.baseLayer.visibility) {
|
||||||
this.baseLayer.moveTo(bounds, zoomChanged, dragging);
|
this.baseLayer.moveTo(bounds, zoomChanged, dragging);
|
||||||
if(dragging) {
|
if(dragging) {
|
||||||
this.baseLayer.events.triggerEvent("move");
|
this.baseLayer.events.triggerEvent("move");
|
||||||
@@ -1669,6 +1671,7 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
{"zoomChanged": zoomChanged}
|
{"zoomChanged": zoomChanged}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bounds = this.baseLayer.getExtent();
|
bounds = this.baseLayer.getExtent();
|
||||||
|
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ OpenLayers.Popup = OpenLayers.Class({
|
|||||||
// contents into a fake contentDiv (for the CSS) and then measuring it
|
// contents into a fake contentDiv (for the CSS) and then measuring it
|
||||||
var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" +
|
var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" +
|
||||||
this.contentDiv.innerHTML +
|
this.contentDiv.innerHTML +
|
||||||
"<div>";
|
"</div>";
|
||||||
|
|
||||||
var containerElement = (this.map) ? this.map.layerContainerDiv
|
var containerElement = (this.map) ? this.map.layerContainerDiv
|
||||||
: document.body;
|
: document.body;
|
||||||
|
|||||||
@@ -291,23 +291,28 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
var href = "#" + id;
|
var href = "#" + id;
|
||||||
pos = this.getPosition(node);
|
pos = this.getPosition(node);
|
||||||
widthFactor = this.symbolSize[id] / size;
|
widthFactor = this.symbolSize[id] / size;
|
||||||
// Only set the href if it is different from the current one.
|
|
||||||
// This is a workaround for strange rendering behavior in FF3.
|
// remove the node from the dom before we modify it. This
|
||||||
if (node.getAttributeNS(this.xlinkns, "href") != href) {
|
// prevents various rendering issues in Safari and FF
|
||||||
node.setAttributeNS(this.xlinkns, "href", href);
|
var parent = node.parentNode;
|
||||||
} else if (size != parseFloat(node.getAttributeNS(null, "width"))) {
|
var nextSibling = node.nextSibling;
|
||||||
// hide the element (and force a reflow so it really gets
|
if(parent) {
|
||||||
// hidden. This workaround is needed for Safari.
|
parent.removeChild(node);
|
||||||
node.style.visibility = "hidden";
|
|
||||||
this.container.scrollLeft = this.container.scrollLeft;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
node.setAttributeNS(this.xlinkns, "href", href);
|
||||||
node.setAttributeNS(null, "width", size);
|
node.setAttributeNS(null, "width", size);
|
||||||
node.setAttributeNS(null, "height", size);
|
node.setAttributeNS(null, "height", size);
|
||||||
node.setAttributeNS(null, "x", pos.x - offset);
|
node.setAttributeNS(null, "x", pos.x - offset);
|
||||||
node.setAttributeNS(null, "y", pos.y - offset);
|
node.setAttributeNS(null, "y", pos.y - offset);
|
||||||
// set the visibility back to normal (after the Safari
|
|
||||||
// workaround above)
|
// now that the node has all its new properties, insert it
|
||||||
node.style.visibility = "";
|
// back into the dom where it was
|
||||||
|
if(nextSibling) {
|
||||||
|
parent.insertBefore(node, nextSibling);
|
||||||
|
} else if(parent) {
|
||||||
|
parent.appendChild(node);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
node.setAttributeNS(null, "r", style.pointRadius);
|
node.setAttributeNS(null, "r", style.pointRadius);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,13 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
if (!document.namespaces.olv) {
|
if (!document.namespaces.olv) {
|
||||||
document.namespaces.add("olv", this.xmlns);
|
document.namespaces.add("olv", this.xmlns);
|
||||||
var style = document.createStyleSheet();
|
var style = document.createStyleSheet();
|
||||||
style.addRule('olv\\:*', "behavior: url(#default#VML); " +
|
var shapes = ['shape','rect', 'oval', 'fill', 'stroke', 'imagedata', 'group','textbox'];
|
||||||
|
for (var i = 0, len = shapes.length; i < len; i++) {
|
||||||
|
|
||||||
|
style.addRule('olv\\:' + shapes[i], "behavior: url(#default#VML); " +
|
||||||
"position: absolute; display: inline-block;");
|
"position: absolute; display: inline-block;");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
|
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
@@ -111,14 +115,14 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
|
|
||||||
|
|
||||||
var org = left + " " + top;
|
var org = left + " " + top;
|
||||||
this.root.setAttribute("coordorigin", org);
|
this.root.coordorigin = org;
|
||||||
var roots = [this.root, this.vectorRoot, this.textRoot];
|
var roots = [this.root, this.vectorRoot, this.textRoot];
|
||||||
var root;
|
var root;
|
||||||
for(var i=0, len=roots.length; i<len; ++i) {
|
for(var i=0, len=roots.length; i<len; ++i) {
|
||||||
root = roots[i];
|
root = roots[i];
|
||||||
|
|
||||||
var size = this.size.w + " " + this.size.h;
|
var size = this.size.w + " " + this.size.h;
|
||||||
root.setAttribute("coordsize", size);
|
root.coordsize = size;
|
||||||
|
|
||||||
}
|
}
|
||||||
// flip the VML display Y axis upside down so it
|
// flip the VML display Y axis upside down so it
|
||||||
@@ -240,11 +244,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
options.isStroked = false;
|
options.isStroked = false;
|
||||||
} else if (this.isComplexSymbol(style.graphicName)) {
|
} else if (this.isComplexSymbol(style.graphicName)) {
|
||||||
var cache = this.importSymbol(style.graphicName);
|
var cache = this.importSymbol(style.graphicName);
|
||||||
node.setAttribute("path", cache.path);
|
node.path = cache.path;
|
||||||
node.setAttribute("coordorigin", cache.left + "," +
|
node.coordorigin = cache.left + "," + cache.bottom;
|
||||||
cache.bottom);
|
|
||||||
var size = cache.size;
|
var size = cache.size;
|
||||||
node.setAttribute("coordsize", size + "," + size);
|
node.coordsize = size + "," + size;
|
||||||
this.drawCircle(node, geometry, style.pointRadius);
|
this.drawCircle(node, geometry, style.pointRadius);
|
||||||
node.style.flip = "y";
|
node.style.flip = "y";
|
||||||
} else {
|
} else {
|
||||||
@@ -254,9 +257,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
|
|
||||||
// fill
|
// fill
|
||||||
if (options.isFilled) {
|
if (options.isFilled) {
|
||||||
node.setAttribute("fillcolor", style.fillColor);
|
node.fillcolor = style.fillColor;
|
||||||
} else {
|
} else {
|
||||||
node.setAttribute("filled", "false");
|
node.filled = "false";
|
||||||
}
|
}
|
||||||
var fills = node.getElementsByTagName("fill");
|
var fills = node.getElementsByTagName("fill");
|
||||||
var fill = (fills.length == 0) ? null : fills[0];
|
var fill = (fills.length == 0) ? null : fills[0];
|
||||||
@@ -268,18 +271,18 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
if (!fill) {
|
if (!fill) {
|
||||||
fill = this.createNode('olv:fill', node.id + "_fill");
|
fill = this.createNode('olv:fill', node.id + "_fill");
|
||||||
}
|
}
|
||||||
fill.setAttribute("opacity", style.fillOpacity);
|
fill.opacity = style.fillOpacity;
|
||||||
|
|
||||||
if (node._geometryClass == "OpenLayers.Geometry.Point" &&
|
if (node._geometryClass == "OpenLayers.Geometry.Point" &&
|
||||||
style.externalGraphic) {
|
style.externalGraphic) {
|
||||||
|
|
||||||
// override fillOpacity
|
// override fillOpacity
|
||||||
if (style.graphicOpacity) {
|
if (style.graphicOpacity) {
|
||||||
fill.setAttribute("opacity", style.graphicOpacity);
|
fill.opacity = style.graphicOpacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
fill.setAttribute("src", style.externalGraphic);
|
fill.src = style.externalGraphic;
|
||||||
fill.setAttribute("type", "frame");
|
fill.type = "frame";
|
||||||
|
|
||||||
if (!(style.graphicWidth && style.graphicHeight)) {
|
if (!(style.graphicWidth && style.graphicHeight)) {
|
||||||
fill.aspect = "atmost";
|
fill.aspect = "atmost";
|
||||||
@@ -298,7 +301,7 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
// the graphic as imagedata element. We cannot just remove
|
// the graphic as imagedata element. We cannot just remove
|
||||||
// the fill, because this is part of the hack described
|
// the fill, because this is part of the hack described
|
||||||
// in graphicRotate
|
// in graphicRotate
|
||||||
fill.setAttribute("opacity", 0);
|
fill.opacity = 0;
|
||||||
} else {
|
} else {
|
||||||
node.style.rotation = style.rotation;
|
node.style.rotation = style.rotation;
|
||||||
}
|
}
|
||||||
@@ -306,10 +309,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
|
|
||||||
// stroke
|
// stroke
|
||||||
if (options.isStroked) {
|
if (options.isStroked) {
|
||||||
node.setAttribute("strokecolor", style.strokeColor);
|
node.strokecolor = style.strokeColor;
|
||||||
node.setAttribute("strokeweight", style.strokeWidth + "px");
|
node.strokeweight = style.strokeWidth + "px";
|
||||||
} else {
|
} else {
|
||||||
node.setAttribute("stroked", "false");
|
node.stroked = false;
|
||||||
}
|
}
|
||||||
var strokes = node.getElementsByTagName("stroke");
|
var strokes = node.getElementsByTagName("stroke");
|
||||||
var stroke = (strokes.length == 0) ? null : strokes[0];
|
var stroke = (strokes.length == 0) ? null : strokes[0];
|
||||||
@@ -322,9 +325,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
stroke = this.createNode('olv:stroke', node.id + "_stroke");
|
stroke = this.createNode('olv:stroke', node.id + "_stroke");
|
||||||
node.appendChild(stroke);
|
node.appendChild(stroke);
|
||||||
}
|
}
|
||||||
stroke.setAttribute("opacity", style.strokeOpacity);
|
stroke.opacity = style.strokeOpacity;
|
||||||
stroke.setAttribute("endcap", !style.strokeLinecap || style.strokeLinecap == 'butt' ? 'flat' : style.strokeLinecap);
|
stroke.endcap = !style.strokeLinecap || style.strokeLinecap == 'butt' ? 'flat' : style.strokeLinecap;
|
||||||
stroke.setAttribute("dashstyle", this.dashStyle(style));
|
stroke.dashstyle = this.dashStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.cursor != "inherit" && style.cursor != null) {
|
if (style.cursor != "inherit" && style.cursor != null) {
|
||||||
@@ -453,12 +456,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
var fillColor = node._style.fillColor;
|
var fillColor = node._style.fillColor;
|
||||||
var strokeColor = node._style.strokeColor;
|
var strokeColor = node._style.strokeColor;
|
||||||
if (fillColor == "none" &&
|
if (fillColor == "none" &&
|
||||||
node.getAttribute("fillcolor") != fillColor) {
|
node.fillcolor != fillColor) {
|
||||||
node.setAttribute("fillcolor", fillColor);
|
node.fillcolor = fillColor;
|
||||||
}
|
}
|
||||||
if (strokeColor == "none" &&
|
if (strokeColor == "none" &&
|
||||||
node.getAttribute("strokecolor") != strokeColor) {
|
node.strokecolor != strokeColor) {
|
||||||
node.setAttribute("strokecolor", strokeColor);
|
node.strokecolor = strokeColor;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -544,12 +547,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
createNode: function(type, id) {
|
createNode: function(type, id) {
|
||||||
var node = document.createElement(type);
|
var node = document.createElement(type);
|
||||||
if (id) {
|
if (id) {
|
||||||
node.setAttribute('id', id);
|
node.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IE hack to make elements unselectable, to prevent 'blue flash'
|
// IE hack to make elements unselectable, to prevent 'blue flash'
|
||||||
// while dragging vectors; #1410
|
// while dragging vectors; #1410
|
||||||
node.setAttribute('unselectable', 'on', 0);
|
node.unselectable = 'on';
|
||||||
node.onselectstart = function() { return(false); };
|
node.onselectstart = function() { return(false); };
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
@@ -816,7 +819,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
textbox.style.fontWeight = style.fontWeight;
|
textbox.style.fontWeight = style.fontWeight;
|
||||||
}
|
}
|
||||||
textbox.style.whiteSpace = "nowrap";
|
textbox.style.whiteSpace = "nowrap";
|
||||||
textbox.inset = "0px,0px,0px,0px";
|
// fun with IE: IE7 in standards compliant mode does not display any
|
||||||
|
// text with a left inset of 0. So we set this to 1px and subtract one
|
||||||
|
// pixel later when we set label.style.left
|
||||||
|
textbox.inset = "1px,0px,0px,0px";
|
||||||
|
|
||||||
if(!label.parentNode) {
|
if(!label.parentNode) {
|
||||||
label.appendChild(textbox);
|
label.appendChild(textbox);
|
||||||
@@ -828,7 +834,7 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
|||||||
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);
|
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);
|
||||||
var yshift = textbox.clientHeight *
|
var yshift = textbox.clientHeight *
|
||||||
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);
|
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);
|
||||||
label.style.left = parseInt(label.style.left)-xshift+"px";
|
label.style.left = parseInt(label.style.left)-xshift-1+"px";
|
||||||
label.style.top = parseInt(label.style.top)+yshift+"px";
|
label.style.top = parseInt(label.style.top)+yshift+"px";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ OpenLayers.Style = OpenLayers.Class({
|
|||||||
var defaults = this.defaultStyle;
|
var defaults = this.defaultStyle;
|
||||||
OpenLayers.Util.applyDefaults(symbolizer, {
|
OpenLayers.Util.applyDefaults(symbolizer, {
|
||||||
pointRadius: defaults.pointRadius
|
pointRadius: defaults.pointRadius
|
||||||
})
|
});
|
||||||
if(symbolizer.stroke === true || symbolizer.graphic === true) {
|
if(symbolizer.stroke === true || symbolizer.graphic === true) {
|
||||||
OpenLayers.Util.applyDefaults(symbolizer, {
|
OpenLayers.Util.applyDefaults(symbolizer, {
|
||||||
strokeWidth: defaults.strokeWidth,
|
strokeWidth: defaults.strokeWidth,
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
this.imgDiv.map = null;
|
this.imgDiv.map = null;
|
||||||
}
|
}
|
||||||
this.imgDiv.urls = null;
|
this.imgDiv.urls = null;
|
||||||
this.imgDiv.src = null;
|
// abort any currently loading image
|
||||||
|
this.imgDiv.src = OpenLayers.Util.getImagesLocation() + "blank.gif";
|
||||||
}
|
}
|
||||||
this.imgDiv = null;
|
this.imgDiv = null;
|
||||||
if ((this.frame != null) && (this.frame.parentNode == this.layer.div)) {
|
if ((this.frame != null) && (this.frame.parentNode == this.layer.div)) {
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ OpenLayers.Util.getElement = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintain $() from prototype
|
* Maintain existing definition of $.
|
||||||
*/
|
*/
|
||||||
if ($ == null) {
|
if(typeof window.$ === "undefined") {
|
||||||
var $ = OpenLayers.Util.getElement;
|
window.$ = OpenLayers.Util.getElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1282,36 +1282,13 @@ OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
|
|||||||
var urlObj1 = OpenLayers.Util.createUrlObject(url1, options);
|
var urlObj1 = OpenLayers.Util.createUrlObject(url1, options);
|
||||||
var urlObj2 = OpenLayers.Util.createUrlObject(url2, options);
|
var urlObj2 = OpenLayers.Util.createUrlObject(url2, options);
|
||||||
|
|
||||||
//compare all keys (host, port, etc)
|
//compare all keys except for "args" (treated below)
|
||||||
for(var key in urlObj1) {
|
for(var key in urlObj1) {
|
||||||
if (options.test) {
|
if(key !== "args") {
|
||||||
OpenLayers.Console.userError(key + "\n1:" + urlObj1[key] + "\n2:" + urlObj2[key]);
|
if(urlObj1[key] != urlObj2[key]) {
|
||||||
}
|
|
||||||
var val1 = urlObj1[key];
|
|
||||||
var val2 = urlObj2[key];
|
|
||||||
|
|
||||||
switch(key) {
|
|
||||||
case "args":
|
|
||||||
//do nothing, they'll be treated below
|
|
||||||
break;
|
|
||||||
case "host":
|
|
||||||
case "port":
|
|
||||||
case "protocol":
|
|
||||||
if ((val1 == "") || (val2 == "")) {
|
|
||||||
//these will be blank for relative urls, so no need to
|
|
||||||
// compare them here -- call break.
|
|
||||||
//
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// otherwise continue with default compare
|
|
||||||
//
|
|
||||||
default:
|
|
||||||
if ( (key != "args") && (urlObj1[key] != urlObj2[key]) ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare search args - irrespective of order
|
// compare search args - irrespective of order
|
||||||
@@ -1346,7 +1323,21 @@ OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
|
|||||||
OpenLayers.Util.createUrlObject = function(url, options) {
|
OpenLayers.Util.createUrlObject = function(url, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
var urlObject = {};
|
// deal with relative urls first
|
||||||
|
if(!(/^\w+:\/\//).test(url)) {
|
||||||
|
var loc = window.location;
|
||||||
|
var port = loc.port ? ":" + loc.port : "";
|
||||||
|
var fullUrl = loc.protocol + "//" + loc.host.split(":").shift() + port;
|
||||||
|
if(url.indexOf("/") === 0) {
|
||||||
|
// full pathname
|
||||||
|
url = fullUrl + url;
|
||||||
|
} else {
|
||||||
|
// relative to current path
|
||||||
|
var parts = loc.pathname.split("/");
|
||||||
|
parts.pop();
|
||||||
|
url = fullUrl + parts.join("/") + "/" + url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (options.ignoreCase) {
|
if (options.ignoreCase) {
|
||||||
url = url.toLowerCase();
|
url = url.toLowerCase();
|
||||||
@@ -1355,22 +1346,23 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
|||||||
var a = document.createElement('a');
|
var a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
|
|
||||||
|
var urlObject = {};
|
||||||
|
|
||||||
//host (without port)
|
//host (without port)
|
||||||
urlObject.host = a.host;
|
urlObject.host = a.host.split(":").shift();
|
||||||
var port = a.port;
|
|
||||||
if (port.length <= 0) {
|
|
||||||
var newHostLength = urlObject.host.length - (port.length);
|
|
||||||
urlObject.host = urlObject.host.substring(0, newHostLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
//protocol
|
//protocol
|
||||||
urlObject.protocol = a.protocol;
|
urlObject.protocol = a.protocol;
|
||||||
|
|
||||||
//port
|
//port (get uniform browser behavior with port 80 here)
|
||||||
urlObject.port = ((port == "80") && (options.ignorePort80)) ? "" : port;
|
if(options.ignorePort80) {
|
||||||
|
urlObject.port = (a.port == "80" || a.port == "0") ? "" : a.port;
|
||||||
|
} else {
|
||||||
|
urlObject.port = (a.port == "" || a.port == "0") ? "80" : a.port;
|
||||||
|
}
|
||||||
|
|
||||||
//hash
|
//hash
|
||||||
urlObject.hash = (options.ignoreHash) ? "" : a.hash;
|
urlObject.hash = (options.ignoreHash || a.hash === "#") ? "" : a.hash;
|
||||||
|
|
||||||
//args
|
//args
|
||||||
var queryString = a.search;
|
var queryString = a.search;
|
||||||
@@ -1380,65 +1372,8 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
|||||||
}
|
}
|
||||||
urlObject.args = OpenLayers.Util.getParameters(queryString);
|
urlObject.args = OpenLayers.Util.getParameters(queryString);
|
||||||
|
|
||||||
|
//pathname (uniform browser behavior with leading "/")
|
||||||
//pathname (this part allows for relative <-> absolute comparison)
|
urlObject.pathname = (a.pathname.charAt(0) == "/") ? a.pathname : "/" + a.pathname;
|
||||||
if ( ((urlObject.protocol == "file:") && (url.indexOf("file:") != -1)) ||
|
|
||||||
((urlObject.protocol != "file:") && (urlObject.host != "")) ) {
|
|
||||||
|
|
||||||
urlObject.pathname = a.pathname;
|
|
||||||
|
|
||||||
//Test to see if the pathname includes the arguments (Opera)
|
|
||||||
var qIndex = urlObject.pathname.indexOf("?");
|
|
||||||
if (qIndex != -1) {
|
|
||||||
urlObject.pathname = urlObject.pathname.substring(0, qIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
var relStr = OpenLayers.Util.removeTail(url);
|
|
||||||
|
|
||||||
var backs = 0;
|
|
||||||
do {
|
|
||||||
var index = relStr.indexOf("../");
|
|
||||||
|
|
||||||
if (index == 0) {
|
|
||||||
backs++;
|
|
||||||
relStr = relStr.substr(3);
|
|
||||||
} else if (index >= 0) {
|
|
||||||
var prevChunk = relStr.substr(0,index - 1);
|
|
||||||
|
|
||||||
var slash = prevChunk.indexOf("/");
|
|
||||||
prevChunk = (slash != -1) ? prevChunk.substr(0, slash +1)
|
|
||||||
: "";
|
|
||||||
|
|
||||||
var postChunk = relStr.substr(index + 3);
|
|
||||||
relStr = prevChunk + postChunk;
|
|
||||||
}
|
|
||||||
} while(index != -1);
|
|
||||||
|
|
||||||
var windowAnchor = document.createElement("a");
|
|
||||||
var windowUrl = window.location.href;
|
|
||||||
if (options.ignoreCase) {
|
|
||||||
windowUrl = windowUrl.toLowerCase();
|
|
||||||
}
|
|
||||||
windowAnchor.href = windowUrl;
|
|
||||||
|
|
||||||
//set protocol of window
|
|
||||||
urlObject.protocol = windowAnchor.protocol;
|
|
||||||
|
|
||||||
var splitter = (windowAnchor.pathname.indexOf("/") != -1) ? "/" : "\\";
|
|
||||||
var dirs = windowAnchor.pathname.split(splitter);
|
|
||||||
dirs.pop(); //remove filename
|
|
||||||
while ((backs > 0) && (dirs.length > 0)) {
|
|
||||||
dirs.pop();
|
|
||||||
backs--;
|
|
||||||
}
|
|
||||||
relStr = dirs.join("/") + "/"+ relStr;
|
|
||||||
urlObject.pathname = relStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((urlObject.protocol == "file:") || (urlObject.protocol == "")) {
|
|
||||||
urlObject.host = "localhost";
|
|
||||||
}
|
|
||||||
|
|
||||||
return urlObject;
|
return urlObject;
|
||||||
};
|
};
|
||||||
@@ -1538,9 +1473,7 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
|
|||||||
|
|
||||||
// create temp container div with restricted size
|
// create temp container div with restricted size
|
||||||
var container = document.createElement("div");
|
var container = document.createElement("div");
|
||||||
container.style.overflow= "";
|
container.style.visibility = "hidden";
|
||||||
container.style.position = "absolute";
|
|
||||||
container.style.left = "-9999px";
|
|
||||||
|
|
||||||
var containerElement = (options && options.containerElement)
|
var containerElement = (options && options.containerElement)
|
||||||
? options.containerElement : document.body;
|
? options.containerElement : document.body;
|
||||||
@@ -1565,12 +1498,40 @@ OpenLayers.Util.getRenderedDimensions = function(contentHTML, size, options) {
|
|||||||
var content = document.createElement("div");
|
var content = document.createElement("div");
|
||||||
content.innerHTML = contentHTML;
|
content.innerHTML = contentHTML;
|
||||||
|
|
||||||
|
// we need overflow visible when calculating the size
|
||||||
|
content.style.overflow = "visible";
|
||||||
|
if (content.childNodes) {
|
||||||
|
for (var i=0, l=content.childNodes.length; i<l; i++) {
|
||||||
|
if (!content.childNodes[i].style) continue;
|
||||||
|
content.childNodes[i].style.overflow = "visible";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add content to restricted container
|
// add content to restricted container
|
||||||
container.appendChild(content);
|
container.appendChild(content);
|
||||||
|
|
||||||
// append container to body for rendering
|
// append container to body for rendering
|
||||||
containerElement.appendChild(container);
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
// calculate scroll width of content and add corners and shadow width
|
// calculate scroll width of content and add corners and shadow width
|
||||||
if (!w) {
|
if (!w) {
|
||||||
w = parseInt(content.scrollWidth);
|
w = parseInt(content.scrollWidth);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Control_SelectFeature_clickFeature(t) {
|
function test_Control_SelectFeature_clickFeature(t) {
|
||||||
t.plan(4);
|
t.plan(6);
|
||||||
// mock up layer
|
// mock up layer
|
||||||
var layer = {
|
var layer = {
|
||||||
selectedFeatures: [],
|
selectedFeatures: [],
|
||||||
@@ -100,6 +100,7 @@
|
|||||||
"onSelect called with proper feature (" + feature.index + ")");
|
"onSelect called with proper feature (" + feature.index + ")");
|
||||||
t.eq(feature.tested, feature.test,
|
t.eq(feature.tested, feature.test,
|
||||||
"onSelect called only once for feature (" + feature.index + ")");
|
"onSelect called only once for feature (" + feature.index + ")");
|
||||||
|
t.ok(this == control, "onSelect called in the scope of the control if control.scope is not provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
// test that onUnselect gets called properly
|
// test that onUnselect gets called properly
|
||||||
@@ -109,9 +110,10 @@
|
|||||||
"onUnselect called with proper feature (" + feature.index + ")");
|
"onUnselect called with proper feature (" + feature.index + ")");
|
||||||
t.eq(feature.tested, feature.test,
|
t.eq(feature.tested, feature.test,
|
||||||
"onUnselect called only once for feature (" + feature.index + ")");
|
"onUnselect called only once for feature (" + feature.index + ")");
|
||||||
|
t.ok(this == control, "onUnselect called in the scope of the control if control.scope is not provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
// mock up first click on first feature (runs 2 tests from onSelect)
|
// mock up first click on first feature (runs 3 tests from onSelect)
|
||||||
var feature = features[0];
|
var feature = features[0];
|
||||||
feature.index = 0;
|
feature.index = 0;
|
||||||
feature.test = 1;
|
feature.test = 1;
|
||||||
@@ -121,7 +123,7 @@
|
|||||||
control.toggle = false;
|
control.toggle = false;
|
||||||
control.clickFeature(feature);
|
control.clickFeature(feature);
|
||||||
|
|
||||||
// mock up second click on first feature (runs 2 tests from onUnselect)
|
// mock up second click on first feature (runs 3 tests from onUnselect)
|
||||||
control.toggle = true;
|
control.toggle = true;
|
||||||
feature.test = 2;
|
feature.test = 2;
|
||||||
control.clickFeature(feature);
|
control.clickFeature(feature);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
var testBounds = new OpenLayers.Bounds(1,2,3,4);
|
var testBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
|
|
||||||
t.ok( bounds.equals(testBounds), "getTMSBounds() returns correct bounds")
|
t.ok( bounds.equals(testBounds), "getTMSBounds() returns correct bounds");
|
||||||
|
|
||||||
layer.grid = null;
|
layer.grid = null;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
layer = new OpenLayers.Layer.TMS( "TMS",
|
layer = new OpenLayers.Layer.TMS( "TMS",
|
||||||
"http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png', resolutions:[0.000634956337608418]} );
|
"http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png', resolutions:[0.000634956337608418]} );
|
||||||
m.addLayer(layer);
|
m.addLayer(layer);
|
||||||
m.zoomToMaxExtent()
|
m.zoomToMaxExtent();
|
||||||
t.eq(layer.getURL(layer.grid[3][3].bounds), "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/0/1/1.png", "TMS tiles around rounded properly.");
|
t.eq(layer.getURL(layer.grid[3][3].bounds), "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/0/1/1.png", "TMS tiles around rounded properly.");
|
||||||
m.destroy();
|
m.destroy();
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,9 @@
|
|||||||
layer.serverResolutions = [14,13,12,11,10];
|
layer.serverResolutions = [14,13,12,11,10];
|
||||||
tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
|
tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
|
||||||
level = parseInt(tileurl.split('/')[2]);
|
level = parseInt(tileurl.split('/')[2]);
|
||||||
t.eq(layer.serverResolutions.indexOf(map.getResolution()), level, "Tile zoom level is correct with serverResolutions");
|
var res = map.getResolution();
|
||||||
|
var gotLevel = OpenLayers.Util.indexOf(layer.serverResolutions, res);
|
||||||
|
t.eq(gotLevel, level, "Tile zoom level is correct with serverResolutions");
|
||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
}
|
}
|
||||||
@@ -208,6 +210,6 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map" style="width:500px;height:550px"></div>
|
<div id="map" style="width:500px;height:550px;"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -159,7 +159,8 @@
|
|||||||
layer.serverResolutions = [14,13,12,11,10];
|
layer.serverResolutions = [14,13,12,11,10];
|
||||||
tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
|
tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
|
||||||
level = parseInt(tileurl.split('/')[2]);
|
level = parseInt(tileurl.split('/')[2]);
|
||||||
t.eq(layer.serverResolutions.indexOf(map.getResolution()), level, "Tile zoom level is correct with serverResolutions");
|
var gotLevel = OpenLayers.Util.indexOf(layer.serverResolutions, map.getResolution());
|
||||||
|
t.eq(gotLevel, level, "Tile zoom level is correct with serverResolutions");
|
||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1212,24 +1212,27 @@
|
|||||||
|
|
||||||
function test_allOverlays(t) {
|
function test_allOverlays(t) {
|
||||||
|
|
||||||
t.plan(14);
|
t.plan(16);
|
||||||
|
|
||||||
var map = new OpenLayers.Map({
|
var map = new OpenLayers.Map({
|
||||||
div: "map", allOverlays: true
|
div: "map", allOverlays: true
|
||||||
});
|
});
|
||||||
|
|
||||||
var a = new OpenLayers.Layer.Vector("a");
|
var a = new OpenLayers.Layer.Vector("a", {visibility: true});
|
||||||
|
|
||||||
var b = new OpenLayers.Layer.Image(
|
var b = new OpenLayers.Layer.Image(
|
||||||
"b",
|
"b",
|
||||||
"http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif",
|
"http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif",
|
||||||
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
||||||
new OpenLayers.Size(580, 288)
|
new OpenLayers.Size(580, 288)
|
||||||
);
|
);
|
||||||
|
|
||||||
var c = new OpenLayers.Layer.WMS(
|
var c = new OpenLayers.Layer.WMS(
|
||||||
"c",
|
"c",
|
||||||
"http://labs.metacarta.com/wms/vmap0",
|
"http://labs.metacarta.com/wms/vmap0",
|
||||||
{layers: 'basic'}
|
{layers: 'basic'}
|
||||||
);
|
);
|
||||||
|
|
||||||
var d = new OpenLayers.Layer.Vector("d");
|
var d = new OpenLayers.Layer.Vector("d");
|
||||||
|
|
||||||
map.addLayers([a, b, c, d]);
|
map.addLayers([a, b, c, d]);
|
||||||
@@ -1244,6 +1247,14 @@
|
|||||||
t.eq(moveCount, 1, "map.moveTo moves the base layer only once");
|
t.eq(moveCount, 1, "map.moveTo moves the base layer only once");
|
||||||
t.eq(map.getCenter().toString(), "lon=0,lat=0", "a map with all overlays can have a center");
|
t.eq(map.getCenter().toString(), "lon=0,lat=0", "a map with all overlays can have a center");
|
||||||
|
|
||||||
|
a.setVisibility(false);
|
||||||
|
var moveend = 0;
|
||||||
|
a.events.on({"moveend": function() { moveend++; }});
|
||||||
|
map.zoomToMaxExtent();
|
||||||
|
t.eq(moveCount, 1, "map.moveTo does not move the base layer if it is invisible");
|
||||||
|
t.eq(moveend, 0, "map.moveTo does not trigger \"moveend\" in the layer if the layer is invisible");
|
||||||
|
a.setVisibility(true);
|
||||||
|
|
||||||
// a, b, c, d
|
// a, b, c, d
|
||||||
t.eq(map.baseLayer.name, "a", "base layer set to first layer added");
|
t.eq(map.baseLayer.name, "a", "base layer set to first layer added");
|
||||||
|
|
||||||
@@ -1282,6 +1293,7 @@
|
|||||||
map.setLayerIndex(b, 0);
|
map.setLayerIndex(b, 0);
|
||||||
t.eq(b.visibility, false, "changing layer order doesn't change visibility");
|
t.eq(b.visibility, false, "changing layer order doesn't change visibility");
|
||||||
|
|
||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
126
tests/Util.html
126
tests/Util.html
@@ -1,10 +1,19 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<script>
|
||||||
|
var custom$ = function() {};
|
||||||
|
window.$ = custom$;
|
||||||
|
</script>
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||||
var map;
|
var map;
|
||||||
|
|
||||||
|
function test_$(t) {
|
||||||
|
t.plan(1);
|
||||||
|
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
|
||||||
|
}
|
||||||
|
|
||||||
function test_Util_getImagesLocation (t) {
|
function test_Util_getImagesLocation (t) {
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
|
t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
|
||||||
@@ -606,7 +615,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Util_isEquivalentUrl(t) {
|
function test_Util_isEquivalentUrl(t) {
|
||||||
t.plan(8);
|
t.plan(9);
|
||||||
|
|
||||||
var url1, url2, options;
|
var url1, url2, options;
|
||||||
|
|
||||||
@@ -664,6 +673,121 @@
|
|||||||
url2 = "../tests/../tests/foo.html?bar=now#go";
|
url2 = "../tests/../tests/foo.html?bar=now#go";
|
||||||
|
|
||||||
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
|
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
|
||||||
|
|
||||||
|
url1 = "/foo/bar";
|
||||||
|
url2 = new Array(window.location.pathname.split("/").length-1).join("../")+"foo/bar";
|
||||||
|
|
||||||
|
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "absolute and relative path without host works for "+url2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_createUrlObject(t) {
|
||||||
|
|
||||||
|
var cases = [{
|
||||||
|
url: "http://example.com/",
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "80",
|
||||||
|
pathname: "/",
|
||||||
|
args: {},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "http://example.com:80/",
|
||||||
|
opt: {ignorePort80: true},
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "",
|
||||||
|
pathname: "/",
|
||||||
|
args: {},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "http://example.com/",
|
||||||
|
opt: {ignorePort80: true},
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "",
|
||||||
|
pathname: "/",
|
||||||
|
args: {},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "http://example.com:88/",
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "88",
|
||||||
|
pathname: "/",
|
||||||
|
args: {},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "http://example.com:88/foo#bar",
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "88",
|
||||||
|
pathname: "/foo",
|
||||||
|
args: {},
|
||||||
|
hash: "#bar"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "http://example.com:88/?foo=bar",
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "88",
|
||||||
|
pathname: "/",
|
||||||
|
args: {foo: "bar"},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "http://example.com/bogus/../bogus/../path",
|
||||||
|
exp: {
|
||||||
|
protocol: "http:",
|
||||||
|
host: "example.com",
|
||||||
|
port: "80",
|
||||||
|
pathname: "/path",
|
||||||
|
args: {},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "/relative#foo",
|
||||||
|
exp: {
|
||||||
|
protocol: window.location.protocol,
|
||||||
|
host: window.location.hostname,
|
||||||
|
port: window.location.port || "80",
|
||||||
|
pathname: "/relative",
|
||||||
|
args: {},
|
||||||
|
hash: "#foo"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
url: "../foo",
|
||||||
|
exp: {
|
||||||
|
protocol: window.location.protocol,
|
||||||
|
host: window.location.hostname,
|
||||||
|
port: window.location.port || "80",
|
||||||
|
pathname: (function() {
|
||||||
|
var parts = window.location.pathname.split("/");
|
||||||
|
return parts.slice(0, parts.length -2).join("/") + "/foo";
|
||||||
|
})(),
|
||||||
|
args: {},
|
||||||
|
hash: ""
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
t.plan(cases.length);
|
||||||
|
|
||||||
|
var c, obj;
|
||||||
|
for(var i=0; i<cases.length; ++i) {
|
||||||
|
c = cases[i];
|
||||||
|
obj = OpenLayers.Util.createUrlObject(c.url, c.opt);
|
||||||
|
t.eq(obj, c.exp, i + ": '" + c.url + "'");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Util_createUniqueIDSeq(t) {
|
function test_Util_createUniqueIDSeq(t) {
|
||||||
|
|||||||
103
tests/manual/arcims-2117.html
Normal file
103
tests/manual/arcims-2117.html
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>ArcIMS Test Ticket #2117</title>
|
||||||
|
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="../../examples/style.css" type="text/css" />
|
||||||
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var lon = 0;
|
||||||
|
var lat = 0;
|
||||||
|
var zoom = 1;
|
||||||
|
var map, layer;
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
OpenLayers.ProxyHost = "../../examples/proxy.cgi?url=";
|
||||||
|
|
||||||
|
map = new OpenLayers.Map( 'map' );
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
serviceName: "OpenLayers_Sample",
|
||||||
|
async: true,
|
||||||
|
layers: [{
|
||||||
|
id:1,
|
||||||
|
visible:'true',
|
||||||
|
/*query:{
|
||||||
|
where: '1=1',
|
||||||
|
spatialfilter: true
|
||||||
|
},*/
|
||||||
|
renderer:{
|
||||||
|
type: 'valuemaplabel',
|
||||||
|
lookupfield: 'FIPS_ID',
|
||||||
|
labelfield: 'FIPS_CNTRY',
|
||||||
|
exacts:[{
|
||||||
|
value: '227',
|
||||||
|
symbol: {
|
||||||
|
type: 'text',
|
||||||
|
antialiasing: 'true',
|
||||||
|
interval: 6,
|
||||||
|
blockout: '255,255,255',
|
||||||
|
font: 'Arial',
|
||||||
|
fontcolor: '0,0,0',
|
||||||
|
fontsize: 11,
|
||||||
|
transparency: 0.7
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
value: '150',
|
||||||
|
symbol: {
|
||||||
|
type: 'text',
|
||||||
|
antialiasing: 'true',
|
||||||
|
interval: 6,
|
||||||
|
blockout: '255,255,255',
|
||||||
|
font: 'Arial',
|
||||||
|
fontcolor: '0,0,0',
|
||||||
|
fontsize: 11,
|
||||||
|
transparency: 0.7
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
value: '75',
|
||||||
|
symbol: {
|
||||||
|
type: 'text',
|
||||||
|
antialiasing: 'true',
|
||||||
|
interval: 6,
|
||||||
|
blockout: '255,255,255',
|
||||||
|
font: 'Arial',
|
||||||
|
fontcolor: '0,0,0',
|
||||||
|
fontsize: 11,
|
||||||
|
transparency: 0.7
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
layer = new OpenLayers.Layer.ArcIMS( "Global Sample Map",
|
||||||
|
"http://sample.avencia.com/servlet/com.esri.esrimap.Esrimap", options );
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
||||||
|
map.addControl( new OpenLayers.Control.LayerSwitcher() );
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1 id="title">ArcIMS Test Ticket #2117</h1>
|
||||||
|
|
||||||
|
<div id="tags">
|
||||||
|
</div>
|
||||||
|
<p id="shortdesc">
|
||||||
|
<a href="http://trac.openlayers.org/ticket/2117">Testing ticket #2117</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div id="map" class="smallmap"></div>
|
||||||
|
|
||||||
|
<div id="docs">
|
||||||
|
This is an example of a bug in the ArcXML format writer.
|
||||||
|
If you don't see a map, it's broken.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -11,10 +11,33 @@ function run() {
|
|||||||
var out = document.getElementById("out");
|
var out = document.getElementById("out");
|
||||||
var size = OpenLayers.Util.getRenderedDimensions("<p>Content</p>");
|
var size = OpenLayers.Util.getRenderedDimensions("<p>Content</p>");
|
||||||
var bigger = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", null, {displayClass: 'testDims'});
|
var bigger = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", null, {displayClass: 'testDims'});
|
||||||
|
var overflow = OpenLayers.Util.getRenderedDimensions("<p style='overflow:auto'>Content</p>");
|
||||||
|
var width = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", new OpenLayers.Size(250, null));
|
||||||
|
var height = OpenLayers.Util.getRenderedDimensions("<p>Content</p>", new OpenLayers.Size(null, 40));
|
||||||
if ((size.w + 40) == bigger.w && (size.h + 40) == bigger.h) {
|
if ((size.w + 40) == bigger.w && (size.h + 40) == bigger.h) {
|
||||||
out.innerHTML = "Pass: " + size + ", " + bigger;
|
out.innerHTML = "bigger Pass: " + size + ", " + bigger;
|
||||||
} else {
|
} else {
|
||||||
out.innerHTML = "Fail: " + size + ", " + bigger;
|
out.innerHTML = "bigger Fail: " + size + ", " + bigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size.w == overflow.w && size.h == overflow.h) {
|
||||||
|
out.innerHTML += "<br/>overflow Pass: " + size + ", " + overflow;
|
||||||
|
} else {
|
||||||
|
out.innerHTML += "<br/>overflow Fail: " + size + ", " + overflow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width.w == 250 && width.h == size.h) {
|
||||||
|
out.innerHTML += "<br/>width Pass: " + size + ", " + width;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out.innerHTML += "<br/>width Fail: " + size + ", " + width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height.h == 40 && height.w == size.w) {
|
||||||
|
out.innerHTML += "<br/>height Pass: " + size + ", " + height;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out.innerHTML += "<br/>height Fail: " + size + ", " + height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user