Pull up patches for the following bugs from trunk:
#385: building for windows users (fix license) #453: IE gives new DOM elements a parent with fragment node type #454: Fix tests which are breaking in Opera #455: Util.isEquivalentUrl broken in Opera #463: map.setBaseLayer is a bit funky #464: Overview Map dissappears when on permalinked page #465: allow controls to live outside viewport (for real) #466: HTMLDivElement is still undefined in IE7 (but OpenLayers.Util.alphaHack() is now false) #467: isEquivalentURL() not complete for IE #468: Overview MapLosing Rectangle #469: Default marker is incorrectly centered #470: Can not use "search" property IE7 #473: Remove call to checkImgURL #474: overview map isn't properly updated when the argparser kicks in git-svn-id: http://svn.openlayers.org/branches/openlayers/2.3@2181 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -133,7 +133,6 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
OpenLayers.Event.stop(e);
|
||||
});
|
||||
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle);
|
||||
this.rectEvents.register('mouseover', this, this.rectMouseOver);
|
||||
this.rectEvents.register('mouseout', this, this.rectMouseOut);
|
||||
this.rectEvents.register('mousedown', this, this.rectMouseDown);
|
||||
this.rectEvents.register('mousemove', this, this.rectMouseMove);
|
||||
@@ -147,8 +146,7 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
|
||||
// Optionally add min/max buttons if the control will go in the
|
||||
// map viewport.
|
||||
if(!this.div.parentNode ||
|
||||
(this.div.parentNode.className == 'olMapViewport')) {
|
||||
if(!this.outsideViewport) {
|
||||
this.div.className = 'olControlOverviewMapContainer';
|
||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
||||
// maximize button div
|
||||
@@ -187,7 +185,9 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
// show the overview map
|
||||
this.element.style.display = '';
|
||||
}
|
||||
|
||||
if(this.map.getExtent()) {
|
||||
this.update();
|
||||
}
|
||||
return this.div;
|
||||
},
|
||||
|
||||
@@ -196,22 +196,24 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
this.map.events.unregister("changebaselayer", this, this.baseLayerDraw);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Event} evt
|
||||
*/
|
||||
rectMouseOver: function (evt) {
|
||||
this.extentRectangle.style.cursor = 'move';
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Event} evt
|
||||
*/
|
||||
rectMouseOut: function (evt) {
|
||||
this.extentRectangle.style.cursor = 'default';
|
||||
if(this.rectDragStart != null) {
|
||||
if(this.performedRectDrag) {
|
||||
this.updateMapToRect();
|
||||
}
|
||||
this.rectMouseMove(evt);
|
||||
var rectPxBounds = this.getRectPxBounds();
|
||||
// if we're off of the overview map, update the main map
|
||||
// otherwise, keep moving the rect
|
||||
if((rectPxBounds.top <= 0) || (rectPxBounds.left <= 0) ||
|
||||
(rectPxBounds.bottom >= this.size.h - this.hComp) ||
|
||||
(rectPxBounds.right >= this.size.w - this.wComp)) {
|
||||
this.updateMapToRect();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
document.onselectstart = null;
|
||||
this.rectDragStart = null;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,10 @@ OpenLayers.Events.prototype = {
|
||||
evt.element = this.element;
|
||||
|
||||
// execute all callbacks registered for specified type
|
||||
var listeners = this.listeners[type];
|
||||
// get a clone of the listeners array to
|
||||
// allow for splicing during callbacks
|
||||
var listeners = (this.listeners[type]) ?
|
||||
this.listeners[type].slice() : null;
|
||||
if ((listeners != null) && (listeners.length > 0)) {
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
var callback = listeners[i];
|
||||
|
||||
@@ -431,16 +431,19 @@ OpenLayers.Map.prototype = {
|
||||
* @param {Boolean} noEvent
|
||||
*/
|
||||
setBaseLayer: function(newBaseLayer, noEvent) {
|
||||
var oldBaseLayer = this.baseLayer;
|
||||
var oldExtent = null;
|
||||
if(this.baseLayer) {
|
||||
oldExtent = this.baseLayer.getExtent();
|
||||
}
|
||||
|
||||
if (newBaseLayer != oldBaseLayer) {
|
||||
if (newBaseLayer != this.baseLayer) {
|
||||
|
||||
// is newBaseLayer an already loaded layer?
|
||||
if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
|
||||
|
||||
// make the old base layer invisible
|
||||
if (oldBaseLayer != null) {
|
||||
oldBaseLayer.setVisibility(false, noEvent);
|
||||
if (this.baseLayer != null) {
|
||||
this.baseLayer.setVisibility(false, noEvent);
|
||||
}
|
||||
|
||||
// set new baselayer and make it visible
|
||||
@@ -450,10 +453,10 @@ OpenLayers.Map.prototype = {
|
||||
//redraw all layers
|
||||
var center = this.getCenter();
|
||||
if (center != null) {
|
||||
if (oldBaseLayer == null) {
|
||||
if (oldExtent == null) {
|
||||
this.setCenter(center);
|
||||
} else {
|
||||
this.zoomToExtent(oldBaseLayer.getExtent());
|
||||
this.zoomToExtent(oldExtent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,11 +483,13 @@ OpenLayers.Map.prototype = {
|
||||
* @param {OpenLayers.Pixel} px
|
||||
*/
|
||||
addControlToMap: function (control, px) {
|
||||
// If a control doesn't have a div at this point, it belongs in the
|
||||
// viewport.
|
||||
control.outsideViewport = (control.div != null);
|
||||
control.setMap(this);
|
||||
var div = control.draw(px);
|
||||
if (div) {
|
||||
// only elements without parents should be appended to the viewport
|
||||
if(!div.parentNode) {
|
||||
if(!control.outsideViewport) {
|
||||
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
|
||||
this.controls.length;
|
||||
this.viewPortDiv.appendChild( div );
|
||||
|
||||
@@ -126,7 +126,11 @@ OpenLayers.Marker.prototype = {
|
||||
OpenLayers.Marker.defaultIcon = function() {
|
||||
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
|
||||
var size = new OpenLayers.Size(21, 25);
|
||||
return new OpenLayers.Icon(url, size);
|
||||
var calculateOffset = function(size) {
|
||||
return new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||
};
|
||||
|
||||
return new OpenLayers.Icon(url, size, null, calculateOffset);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -117,12 +117,14 @@ OpenLayers.Tile.Image.prototype =
|
||||
|
||||
this.imgDiv.className = 'olTileImage';
|
||||
|
||||
/* checkImgURL *should* pretty predictably get called after the
|
||||
createImage / createAlphaImageDiv onLoad handler */
|
||||
/* checkImgURL used to be used to called as a work around, but it
|
||||
ended up hiding problems instead of solving them and broke things
|
||||
like relative URLs. See discussion on the dev list:
|
||||
http://openlayers.org/pipermail/dev/2007-January/000205.html
|
||||
|
||||
OpenLayers.Event.observe( this.imgDiv, "load",
|
||||
this.checkImgURL.bindAsEventListener(this) );
|
||||
|
||||
*/
|
||||
this.layer.div.appendChild(this.imgDiv);
|
||||
if(this.layer.opacity != null) {
|
||||
|
||||
@@ -139,6 +141,14 @@ OpenLayers.Tile.Image.prototype =
|
||||
* the imgDiv display to 'none', as either (a) it will be reset to visible
|
||||
* when the new URL loads in the image, or (b) we don't want to display
|
||||
* this tile after all because its new bounds are outside our maxExtent.
|
||||
*
|
||||
* This function should no longer be neccesary with the improvements to
|
||||
* Grid.js in OpenLayers 2.3. The lack of a good isEquivilantURL function
|
||||
* caused problems in 2.2, but it's possible that with the improved
|
||||
* isEquivilant URL function, this might be neccesary at some point.
|
||||
*
|
||||
* See discussion in the thread at
|
||||
* http://openlayers.org/pipermail/dev/2007-January/000205.html
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -568,11 +568,10 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
|
||||
*/
|
||||
OpenLayers.Util.getArgs = function(url) {
|
||||
if(url == null) {
|
||||
var query = window.location.search.substring(1);
|
||||
} else {
|
||||
var query = (url.indexOf('?') == -1) ?
|
||||
'' : url.substring(url.indexOf('?') + 1);
|
||||
url = window.location.href;
|
||||
}
|
||||
var query = (url.indexOf('?') != -1) ? url.substring(url.indexOf('?') + 1) : '';
|
||||
|
||||
var args = new Object();
|
||||
pairs = query.split(/[&;]/);
|
||||
for(var i = 0; i < pairs.length; ++i) {
|
||||
@@ -747,11 +746,36 @@ OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
|
||||
urlObj1 = OpenLayers.Util.createUrlObject(url1, options);
|
||||
urlObj2 = OpenLayers.Util.createUrlObject(url2, options);
|
||||
|
||||
//compare keys (host, port, etc)
|
||||
//compare all keys (host, port, etc)
|
||||
for(var key in urlObj1) {
|
||||
if ( (key != "args") && (urlObj1[key] != urlObj2[key]) ) {
|
||||
return false;
|
||||
if (options.test) {
|
||||
alert(key + "\n1:" + urlObj1[key] + "\n2:" + 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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// compare search args - irrespective of order
|
||||
@@ -789,18 +813,8 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
||||
}
|
||||
|
||||
var a = document.createElement('a');
|
||||
|
||||
a.href = url;
|
||||
|
||||
//protocol
|
||||
urlObject.protocol = a.protocol;
|
||||
|
||||
//pathname (this part allows for relative <-> absolute comparison)
|
||||
urlObject.pathname = a.pathname;
|
||||
|
||||
//hash
|
||||
urlObject.hash = (options.ignoreHash) ? "" : a.hash;
|
||||
|
||||
//host (without port)
|
||||
urlObject.host = a.host;
|
||||
var port = a.port;
|
||||
@@ -808,13 +822,104 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
||||
var newHostLength = urlObject.host.length - (port.length);
|
||||
urlObject.host = urlObject.host.substring(0, newHostLength);
|
||||
}
|
||||
|
||||
|
||||
//protocol
|
||||
urlObject.protocol = a.protocol;
|
||||
|
||||
//port
|
||||
urlObject.port = ((port == "80") && (options.ignorePort80)) ? "" : port;
|
||||
|
||||
//hash
|
||||
urlObject.hash = (options.ignoreHash) ? "" : a.hash;
|
||||
|
||||
//args
|
||||
urlObject.args = OpenLayers.Util.getArgs(a.search);
|
||||
var queryString = a.search;
|
||||
if (!queryString) {
|
||||
var qMark = url.indexOf("?");
|
||||
queryString = (qMark != -1) ? url.substr(qMark) : "";
|
||||
}
|
||||
urlObject.args = OpenLayers.Util.getArgs(queryString);
|
||||
|
||||
|
||||
//pathname (this part allows for relative <-> absolute comparison)
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {String} url
|
||||
*
|
||||
* @returns The string with all queryString and Hash removed
|
||||
* @type String
|
||||
*/
|
||||
OpenLayers.Util.removeTail = function(url) {
|
||||
var head = null;
|
||||
|
||||
var qMark = url.indexOf("?");
|
||||
var hashMark = url.indexOf("#");
|
||||
|
||||
if (qMark == -1) {
|
||||
head = (hashMark != -1) ? url.substr(0,hashMark) : url;
|
||||
} else {
|
||||
head = (hashMark != -1) ? url.substr(0,Math.min(qMark, hashMark))
|
||||
: url.substr(0, qMark);
|
||||
}
|
||||
return head;
|
||||
};
|
||||
Reference in New Issue
Block a user