Compare commits
6 Commits
v3.0.0
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e9c6a45e4 | ||
|
|
a4c86b0489 | ||
|
|
538302fa9b | ||
|
|
b7bf7d5436 | ||
|
|
7232cfa3a0 | ||
|
|
2642f000fd |
@@ -14,12 +14,12 @@ if len(sys.argv) > 1:
|
||||
if len(sys.argv) > 2:
|
||||
outputFilename = sys.argv[2]
|
||||
|
||||
print "Adding license file."
|
||||
merged = file("license.txt").read()
|
||||
print "Merging libraries."
|
||||
merged += mergejs.run(sourceDirectory, None, configFilename)
|
||||
merged = mergejs.run(sourceDirectory, None, configFilename)
|
||||
print "Compressing."
|
||||
minimized = jsmin.jsmin(merged)
|
||||
print "Adding license file."
|
||||
minimized = file("license.txt").read() + minimized
|
||||
|
||||
print "Writing to %s." % outputFilename
|
||||
file(outputFilename, "w").write(minimized)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
OpenLayers.js -- OpenLayers Map Viewer Library
|
||||
|
||||
Copyright 2005-2006 MetaCarta, Inc., released under a modified BSD license.
|
||||
Please see http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
Copyright 2005-2007 MetaCarta, Inc., released under the BSD license.
|
||||
Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
for the full text of the license.
|
||||
|
||||
Includes compressed code under the following licenses:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
////
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
/**
|
||||
* @fileoverview Locator Map Control
|
||||
* @author Tim Schaub
|
||||
*/
|
||||
|
||||
// @require: OpenLayers/Control.js
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.OverviewMap = OpenLayers.Class.create();
|
||||
|
||||
OpenLayers.Control.OverviewMap.prototype =
|
||||
@@ -106,6 +106,7 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
this.extentRectangle = document.createElement('div');
|
||||
this.extentRectangle.style.position = 'absolute';
|
||||
this.extentRectangle.style.zIndex = 1000; //HACK
|
||||
this.extentRectangle.style.overflow = 'hidden';
|
||||
this.extentRectangle.style.backgroundImage = 'url(' +
|
||||
OpenLayers.Util.getImagesLocation() +
|
||||
'/blank.png)';
|
||||
@@ -133,7 +134,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 +147,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
|
||||
@@ -164,6 +163,11 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
OpenLayers.Event.observe(this.maximizeDiv,
|
||||
'click',
|
||||
this.maximizeControl.bindAsEventListener(this));
|
||||
OpenLayers.Event.observe(this.maximizeDiv,
|
||||
'dblclick',
|
||||
function(e) {
|
||||
OpenLayers.Event.stop(e);
|
||||
});
|
||||
this.div.appendChild(this.maximizeDiv);
|
||||
|
||||
// minimize button div
|
||||
@@ -179,7 +183,11 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
OpenLayers.Event.observe(this.minimizeDiv,
|
||||
'click',
|
||||
this.minimizeControl.bindAsEventListener(this));
|
||||
|
||||
OpenLayers.Event.observe(this.minimizeDiv,
|
||||
'dblclick',
|
||||
function(e) {
|
||||
OpenLayers.Event.stop(e);
|
||||
});
|
||||
this.div.appendChild(this.minimizeDiv);
|
||||
|
||||
this.minimizeControl();
|
||||
@@ -187,7 +195,9 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
// show the overview map
|
||||
this.element.style.display = '';
|
||||
}
|
||||
|
||||
if(this.map.getExtent()) {
|
||||
this.update();
|
||||
}
|
||||
return this.div;
|
||||
},
|
||||
|
||||
@@ -196,21 +206,23 @@ 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;
|
||||
@@ -416,12 +428,14 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
// The base layer for overview map needs to be in the same projection
|
||||
// as the base layer for the main map. This should be made more robust.
|
||||
if(this.map.units != 'degrees') {
|
||||
if(this.map.getProjection() != this.ovmap.getProjection()) {
|
||||
if(this.ovmap.getProjection() && (this.map.getProjection() != this.ovmap.getProjection())) {
|
||||
alert('The overview map only works when it is in the same projection as the main map');
|
||||
}
|
||||
}
|
||||
var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent());
|
||||
this.setRectPxBounds(pxBounds);
|
||||
if (pxBounds) {
|
||||
this.setRectPxBounds(pxBounds);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -477,8 +491,12 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
lonLatBounds.top);
|
||||
var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat);
|
||||
var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat);
|
||||
return new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
|
||||
rightTopPx.x, rightTopPx.y);
|
||||
var bounds = null;
|
||||
if (leftBottomPx && rightTopPx) {
|
||||
bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
|
||||
rightTopPx.x, rightTopPx.y);
|
||||
}
|
||||
return bounds;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -528,10 +546,13 @@ OpenLayers.Control.OverviewMap.prototype =
|
||||
getOverviewPxFromLonLat: function(lonlat) {
|
||||
var res = this.ovmap.getResolution();
|
||||
var extent = this.ovmap.getExtent();
|
||||
return new OpenLayers.Pixel(
|
||||
Math.round(1/res * (lonlat.lon - extent.left)),
|
||||
Math.round(1/res * (extent.top - lonlat.lat))
|
||||
);
|
||||
var px = null;
|
||||
if (extent) {
|
||||
px = new OpenLayers.Pixel(
|
||||
Math.round(1/res * (lonlat.lon - extent.left)),
|
||||
Math.round(1/res * (extent.top - lonlat.lat)));
|
||||
}
|
||||
return px;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -85,8 +85,8 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
this.div.appendChild(btn);
|
||||
|
||||
btn.onmousedown = this.buttonDown.bindAsEventListener(btn);
|
||||
btn.onmouseup = this.doubleClick.bindAsEventListener(btn);
|
||||
btn.ondblclick = this.doubleClick.bindAsEventListener(btn);
|
||||
btn.onclick = this.doubleClick.bindAsEventListener(btn);
|
||||
btn.action = id;
|
||||
btn.map = this.map;
|
||||
btn.slideFactor = this.slideFactor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -18,6 +18,15 @@ OpenLayers.Layer.prototype = {
|
||||
/** @type DOMElement */
|
||||
div: null,
|
||||
|
||||
/** supported application event types
|
||||
*
|
||||
* @type Array */
|
||||
EVENT_TYPES: [
|
||||
"loadstart", "loadend", "loadcancel"],
|
||||
|
||||
/** @type OpenLayers.Events */
|
||||
events: null,
|
||||
|
||||
/** This variable is set when the layer is added to the map, via the
|
||||
* accessor function setMap()
|
||||
*
|
||||
@@ -121,20 +130,30 @@ OpenLayers.Layer.prototype = {
|
||||
this.div.style.height = "100%";
|
||||
this.div.id = this.id;
|
||||
}
|
||||
|
||||
this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy is a destructor: this is to alleviate cyclic references which
|
||||
* the Javascript garbage cleaner can not take care of on its own.
|
||||
*
|
||||
* @param {Boolean} setNewBaseLayer Should a new baselayer be selected when
|
||||
* this has been removed?
|
||||
* Default is true
|
||||
*/
|
||||
destroy: function() {
|
||||
destroy: function(setNewBaseLayer) {
|
||||
if (setNewBaseLayer == null) {
|
||||
setNewBaseLayer = true;
|
||||
}
|
||||
if (this.map != null) {
|
||||
this.map.removeLayer(this);
|
||||
this.map.removeLayer(this, setNewBaseLayer);
|
||||
}
|
||||
this.map = null;
|
||||
this.name = null;
|
||||
this.div = null;
|
||||
this.options = null;
|
||||
this.events = null;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -508,8 +527,8 @@ OpenLayers.Layer.prototype = {
|
||||
var center = this.map.getCenter();
|
||||
var res = this.map.getResolution();
|
||||
|
||||
var delta_x = viewPortPx.x - Math.ceil(size.w / 2);
|
||||
var delta_y = viewPortPx.y - Math.ceil(size.h / 2);
|
||||
var delta_x = viewPortPx.x - (size.w / 2);
|
||||
var delta_y = viewPortPx.y - (size.h / 2);
|
||||
|
||||
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
|
||||
center.lat - delta_y * res);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
// @requires OpenLayers/Layer/Grid.js
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD licence.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD licence.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
/** @type OpenLayers.Tile.Image */
|
||||
tile: null,
|
||||
|
||||
/** did the image finish loading before a new draw was initiated?
|
||||
* @type Boolean */
|
||||
doneLoading: false,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -63,8 +66,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
*
|
||||
*/
|
||||
destroy: function() {
|
||||
this.tile.destroy();
|
||||
this.tile = null;
|
||||
if (this.tile) {
|
||||
this.tile.destroy();
|
||||
this.tile = null;
|
||||
}
|
||||
OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
|
||||
},
|
||||
|
||||
@@ -108,6 +113,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
* @param {Boolean} dragging
|
||||
*/
|
||||
moveTo:function(bounds, zoomChanged, dragging) {
|
||||
if (!this.doneLoading) {
|
||||
this.events.triggerEvent("loadcancel");
|
||||
this.doneLoading = true;
|
||||
}
|
||||
OpenLayers.Layer.HTTPRequest.prototype.moveTo.apply(this,arguments);
|
||||
|
||||
if (bounds == null) {
|
||||
@@ -155,10 +164,18 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
this.tile = null;
|
||||
}
|
||||
|
||||
this.events.triggerEvent("loadstart");
|
||||
this.doneLoading = false;
|
||||
if (!this.tile) {
|
||||
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
||||
url, tileSize);
|
||||
this.tile.draw();
|
||||
var onload = function() {
|
||||
this.doneLoading = true;
|
||||
this.events.triggerEvent("loadend");
|
||||
}
|
||||
OpenLayers.Event.observe(this.tile.imgDiv, 'load',
|
||||
onload.bindAsEventListener(this));
|
||||
} else {
|
||||
this.tile.moveTo(tileBounds, pos);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -77,6 +77,18 @@ OpenLayers.Map.prototype = {
|
||||
/** @type int */
|
||||
zoom: 0,
|
||||
|
||||
/** Used to store a unique identifier that changes when the map view
|
||||
* changes. viewRequestID should be used when adding data asynchronously
|
||||
* to the map: viewRequestID is incremented when you initiate your
|
||||
* request (right now during changing of baselayers and changing of zooms).
|
||||
* It is stored here in the map and also in the data that will be coming
|
||||
* back asynchronously. Before displaying this data on request completion,
|
||||
* we check that the viewRequestID of the data is still the same as that
|
||||
* of the map. Fix for #480
|
||||
*
|
||||
* @type String */
|
||||
viewRequestID: 0,
|
||||
|
||||
// Options
|
||||
|
||||
/** @type OpenLayers.Size */
|
||||
@@ -201,7 +213,9 @@ OpenLayers.Map.prototype = {
|
||||
destroy:function() {
|
||||
if (this.layers != null) {
|
||||
for(var i=0; i< this.layers.length; i++) {
|
||||
this.layers[i].destroy();
|
||||
//pass 'false' to destroy so that map wont try to set a new
|
||||
// baselayer after each baselayer is removed
|
||||
this.layers[i].destroy(false);
|
||||
}
|
||||
this.layers = null;
|
||||
}
|
||||
@@ -344,8 +358,13 @@ OpenLayers.Map.prototype = {
|
||||
* its own personal list of popups, removing them from the map.
|
||||
*
|
||||
* @param {OpenLayers.Layer} layer
|
||||
* @param {Boolean} setNewBaseLayer Default is true
|
||||
*/
|
||||
removeLayer: function(layer) {
|
||||
removeLayer: function(layer, setNewBaseLayer) {
|
||||
if (setNewBaseLayer == null) {
|
||||
setNewBaseLayer = true;
|
||||
}
|
||||
|
||||
if (layer.isFixed) {
|
||||
this.viewPortDiv.removeChild(layer.div);
|
||||
} else {
|
||||
@@ -355,7 +374,7 @@ OpenLayers.Map.prototype = {
|
||||
OpenLayers.Util.removeItem(this.layers, layer);
|
||||
|
||||
// if we removed the base layer, need to set a new one
|
||||
if (this.baseLayer == layer) {
|
||||
if (setNewBaseLayer && (this.baseLayer == layer)) {
|
||||
this.baseLayer = null;
|
||||
for(i=0; i < this.layers.length; i++) {
|
||||
var iLayer = this.layers[i];
|
||||
@@ -431,29 +450,37 @@ 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
|
||||
this.baseLayer = newBaseLayer;
|
||||
|
||||
// Increment viewRequestID since the baseLayer is
|
||||
// changing. This is used by tiles to check if they should
|
||||
// draw themselves.
|
||||
this.viewRequestID++;
|
||||
this.baseLayer.setVisibility(true, noEvent);
|
||||
|
||||
//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 +507,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 );
|
||||
@@ -738,6 +767,9 @@ OpenLayers.Map.prototype = {
|
||||
for (var i = 0; i < this.popups.length; i++) {
|
||||
this.popups[i].updatePosition();
|
||||
}
|
||||
|
||||
// zoom level has changed, increment viewRequestID.
|
||||
this.viewRequestID++;
|
||||
}
|
||||
|
||||
var bounds = this.getExtent();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
_OPENLAYERS_SFL_=true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ OpenLayers.Tile.Image.prototype =
|
||||
destroy: function() {
|
||||
if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) {
|
||||
this.layer.div.removeChild(this.imgDiv);
|
||||
this.imgDiv.map = null;
|
||||
}
|
||||
this.imgDiv = null;
|
||||
OpenLayers.Tile.prototype.destroy.apply(this, arguments);
|
||||
@@ -53,6 +54,8 @@ OpenLayers.Tile.Image.prototype =
|
||||
this.initImgDiv();
|
||||
}
|
||||
|
||||
this.imgDiv.viewRequestID = this.layer.map.viewRequestID;
|
||||
|
||||
this.url = this.layer.getURL(this.bounds);
|
||||
|
||||
if (this.layer.alpha) {
|
||||
@@ -117,12 +120,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/2006-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) {
|
||||
|
||||
@@ -130,6 +135,10 @@ OpenLayers.Tile.Image.prototype =
|
||||
null, null, null,
|
||||
this.layer.opacity);
|
||||
}
|
||||
|
||||
// we need this reference to check back the viewRequestID
|
||||
this.imgDiv.map = this.layer.map;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -140,6 +149,14 @@ OpenLayers.Tile.Image.prototype =
|
||||
* 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/2006-2007-January/000205.html
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
checkImgURL: function () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||
/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the BSD license.
|
||||
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
|
||||
* for the full text of the license. */
|
||||
|
||||
|
||||
@@ -217,8 +217,25 @@ OpenLayers.Util.setOpacity = function(element, opacity) {
|
||||
}
|
||||
|
||||
OpenLayers.Util.onImageLoad = function() {
|
||||
this.style.backgroundColor = null;
|
||||
this.style.display = "";
|
||||
// The complex check here is to solve issues described in #480.
|
||||
// Every time a map view changes, it increments the 'viewRequestID'
|
||||
// property. As the requests for the images for the new map view are sent
|
||||
// out, they are tagged with this unique viewRequestID.
|
||||
//
|
||||
// If an image has no viewRequestID property set, we display it regardless,
|
||||
// but if it does have a viewRequestID property, we check that it matches
|
||||
// the viewRequestID set on the map.
|
||||
//
|
||||
// If the viewRequestID on the map has changed, that means that the user
|
||||
// has changed the map view since this specific request was sent out, and
|
||||
// therefore this tile does not need to be displayed (so we do not execute
|
||||
// this code that turns its display on).
|
||||
//
|
||||
if (!this.viewRequestID ||
|
||||
(this.viewRequestID == this.map.viewRequestID)) {
|
||||
this.style.backgroundColor = null;
|
||||
this.style.display = "";
|
||||
}
|
||||
};
|
||||
|
||||
OpenLayers.Util.onImageLoadErrorColor = "pink";
|
||||
@@ -321,7 +338,7 @@ OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
|
||||
|
||||
var div = OpenLayers.Util.createDiv();
|
||||
var img = OpenLayers.Util.createImage(null, null, null, null, null, null,
|
||||
false);
|
||||
null, false);
|
||||
div.appendChild(img);
|
||||
|
||||
if (delayDisplay) {
|
||||
@@ -377,17 +394,32 @@ OpenLayers.Util.applyDefaults = function (to, from) {
|
||||
* @returns a concatenation of the properties of an object in
|
||||
* http parameter notation.
|
||||
* (ex. <i>"key1=value1&key2=value2&key3=value3"</i>)
|
||||
* If a parameter is actually a list, that parameter will then
|
||||
* be set to a comma-seperated list of values (foo,bar) instead
|
||||
* of being URL escaped (foo%3Abar).
|
||||
* @type String
|
||||
*/
|
||||
OpenLayers.Util.getParameterString = function(params) {
|
||||
paramsArray = new Array();
|
||||
|
||||
for (var key in params) {
|
||||
var value = params[key];
|
||||
if ((value != null) && (typeof value != 'function')) {
|
||||
paramsArray.push(encodeURIComponent(key) + "=" +
|
||||
encodeURIComponent(value));
|
||||
var value = params[key];
|
||||
if ((value != null) && (typeof value != 'function')) {
|
||||
var encodedValue;
|
||||
if (typeof value == 'object' && value.constructor == Array) {
|
||||
/* value is an array; encode items and separate with "," */
|
||||
var encodedItemArray = new Array();
|
||||
for (var itemIndex=0; itemIndex<value.length; itemIndex++) {
|
||||
encodedItemArray.push(encodeURIComponent(value[itemIndex]));
|
||||
}
|
||||
encodedValue = encodedItemArray.join(",");
|
||||
}
|
||||
else {
|
||||
/* value is a string; simply encode */
|
||||
encodedValue = encodeURIComponent(value);
|
||||
}
|
||||
paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
|
||||
}
|
||||
}
|
||||
|
||||
return paramsArray.join("&");
|
||||
@@ -568,11 +600,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 +778,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 +845,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;
|
||||
@@ -809,12 +855,103 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
||||
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;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
This license applies to official code releases at www.openlayers.org:
|
||||
|
||||
Copyright (c) 2005-2006 MetaCarta, Inc.
|
||||
Copyright (c) 2005-2007 MetaCarta, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
This license applies to all code and content in the OpenLayers code
|
||||
repository at svn.openlayers.org:
|
||||
|
||||
Copyright (c) 2005-2006 MetaCarta, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of MetaCarta, Inc. nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
This license grants no rights to any components related to natural language
|
||||
processing, free text querying, or unstructured information retrieval. This
|
||||
license grants no rights to components that implement inventions on which
|
||||
MetaCarta has patents or has filed applications for patents.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
32
tests/grid_inittiles.html
Normal file
32
tests/grid_inittiles.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
#map {
|
||||
width: 800px;
|
||||
height: 475px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function init(){
|
||||
var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2, tileSize: new OpenLayers.Size(256,256)});
|
||||
ww = new OpenLayers.Layer.WMS( "Basic",
|
||||
"http://labs.metacarta.com/wms-c/Basic.py?",
|
||||
{layers:"basic"});
|
||||
map.addLayers([ww]);
|
||||
map.zoomToMaxExtent();
|
||||
map.zoomIn();
|
||||
map.zoomOut();
|
||||
map.zoomOut();
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1>Grid Test</h1>
|
||||
<p>Map should display with two centered tiles. If there appear to be a combination of two zoom levels, then this test is failed, and something is broken in OpenLayers.</p>
|
||||
<div id="map"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -24,16 +24,14 @@
|
||||
t.eq( cloned.url, "b", "cloned.url does change when edited" );
|
||||
}
|
||||
|
||||
function test_02_Marker_setOpacity(t) {
|
||||
function test_03_Marker_setOpacity(t) {
|
||||
t.plan( 2 );
|
||||
|
||||
icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6));
|
||||
|
||||
t.ok(!icon.imageDiv.style.opacity, "default icon has no opacity");
|
||||
|
||||
icon.setOpacity(0.5);
|
||||
|
||||
t.eq(icon.imageDiv.style.opacity + "", "0.5", "icon.setOpacity() works");
|
||||
t.eq(parseFloat(icon.imageDiv.style.opacity), 0.5, "icon.setOpacity() works");
|
||||
}
|
||||
|
||||
// -->
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript"><!--
|
||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
|
||||
var layer;
|
||||
|
||||
function test_01_Layer_EventPane_constructor (t) {
|
||||
@@ -56,7 +57,7 @@
|
||||
// MOUSEMOVE test does not seem to work...
|
||||
// t.plan( 2 );
|
||||
|
||||
if (document.createEventObject) {
|
||||
if (!isMozilla || isOpera) {
|
||||
t.plan(4);
|
||||
} else {
|
||||
t.plan(3);
|
||||
|
||||
@@ -181,14 +181,14 @@
|
||||
map.addLayer(tLayer);
|
||||
map.zoomToMaxExtent();
|
||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||
t.eq(tLayer.div.firstChild.style.opacity, "0.5", "Opacity on tile is correct");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
tLayer.setOpacity("0.6");
|
||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||
t.eq(tLayer.div.firstChild.style.opacity, "0.6", "Opacity on tile is changed correctly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
var pixel = new OpenLayers.Pixel(5,6);
|
||||
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||
tile.draw();
|
||||
t.eq(tile.imgDiv.style.opacity, "0.6", "Tile opacity is set correctly");
|
||||
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
}
|
||||
|
||||
function test_02_Marker_setOpacity(t) {
|
||||
function test_03_Marker_setOpacity(t) {
|
||||
t.plan( 2 );
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
marker.setOpacity(0.5);
|
||||
|
||||
t.eq(marker.icon.imageDiv.style.opacity + "", "0.5", "marker.setOpacity() works");
|
||||
t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works");
|
||||
}
|
||||
|
||||
// -->
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
var h = 400;
|
||||
var content = "charlie";
|
||||
var color = "red";
|
||||
var hexColor = "#ff0000";
|
||||
var opacity = 0.5;
|
||||
var border = "1px solid";
|
||||
|
||||
@@ -89,7 +90,9 @@
|
||||
t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow");
|
||||
t.eq(contentDiv.innerHTML, content, "correct content div content");
|
||||
|
||||
t.eq(popup.div.style.backgroundColor, color, "good default popup.backgroundColor");
|
||||
var bColor = popup.div.style.backgroundColor;
|
||||
var goodColor = ( (bColor == color) || (bColor == hexColor));
|
||||
t.ok(goodColor, "good default popup.backgroundColor");
|
||||
|
||||
if (navigator.appName.indexOf("Microsoft") == -1) {
|
||||
t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");
|
||||
|
||||
@@ -67,12 +67,15 @@
|
||||
t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");
|
||||
t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");
|
||||
|
||||
t.eq( div.style.backgroundImage, "url(" + img + ")", "div.style.backgroundImage correctly");
|
||||
bImg = div.style.backgroundImage;
|
||||
imgCorrect = ( (bImg == "url(" + img + ")") ||
|
||||
(bImg == "url(\"" + img + "\")") );
|
||||
t.ok(imgCorrect, "div.style.backgroundImage correctly");
|
||||
|
||||
t.eq( div.style.position, position, "div.style.positionset correctly");
|
||||
t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");
|
||||
t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");
|
||||
t.eq( div.style.opacity + "", opacity + "", "elemnt.style.opacity set correctly");
|
||||
t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly");
|
||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||
t.eq( div.style.filter, filterString, "element.style.filter set correctly");
|
||||
|
||||
@@ -95,7 +98,7 @@
|
||||
t.eq( div.style.position, "absolute", "div.style.positionset correctly");
|
||||
t.eq( div.style.border, "", "div.style.border set correctly");
|
||||
t.eq(div.style.overflow, "", "div.style.overflow set correctly");
|
||||
t.ok( !div.style.opacity, "elemnt.style.opacity set correctly");
|
||||
t.ok( !div.style.opacity, "element.style.opacity set correctly");
|
||||
t.ok( !div.style.filter, "element.style.filter set correctly");
|
||||
|
||||
}
|
||||
@@ -116,7 +119,7 @@
|
||||
if (!isMozilla)
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
else
|
||||
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
|
||||
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
|
||||
t.eq( image.id, id, "image.id set correctly");
|
||||
t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");
|
||||
t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");
|
||||
@@ -127,7 +130,7 @@
|
||||
t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");
|
||||
t.eq( image.src, img, "image.style.backgroundImage correctly");
|
||||
t.eq( image.style.position, position, "image.style.position set correctly");
|
||||
t.eq( image.style.opacity+"", opacity + "", "image.style.opacity set correctly");
|
||||
t.eq( parseFloat(image.style.opacity), opacity, "image.style.opacity set correctly");
|
||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||
t.eq( image.style.filter, filterString, "element.style.filter set correctly");
|
||||
|
||||
@@ -137,7 +140,7 @@
|
||||
if (!isMozilla)
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
else
|
||||
t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
|
||||
t.ok( image.nodeName == "IMG", "createDiv creates a valid HTMLDivElement" );
|
||||
t.ok( (image.id != ""), "image.id set to something");
|
||||
t.eq( image.style.left, "", "image.style.left set correctly");
|
||||
t.eq( image.style.top, "", "image.style.top set correctly");
|
||||
@@ -148,7 +151,7 @@
|
||||
t.ok((image.style.border == ""), "image.style.border set correctly");
|
||||
t.eq(image.src, "", "image.style.backgroundImage correctly");
|
||||
t.eq( image.style.position, "relative", "image.style.positionset correctly");
|
||||
t.ok( !image.style.opacity, "elemnt.style.opacity default unset");
|
||||
t.ok( !image.style.opacity, "element.style.opacity default unset");
|
||||
t.ok( !image.style.filter, "element.style.filter default unset");
|
||||
|
||||
}
|
||||
@@ -174,7 +177,7 @@
|
||||
}
|
||||
|
||||
function test_07_Util_getParameterString(t) {
|
||||
t.plan( 2 );
|
||||
t.plan( 4 );
|
||||
|
||||
var params = { foo: "bar",
|
||||
chicken: 1.5
|
||||
@@ -182,6 +185,15 @@
|
||||
|
||||
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar&chicken=1.5", "getParameterString returns correctly");
|
||||
t.eq( OpenLayers.Util.getParameterString({'a:':'b='}), "a%3A=b%3D", "getParameterString returns correctly with non-ascii keys/values");
|
||||
|
||||
|
||||
// Parameters which are a list should end up being a comma-seperated
|
||||
// list of the URL encoded strings
|
||||
var params = { foo: ["bar,baz"] };
|
||||
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar%2Cbaz", "getParameterString encodes , correctly in arrays");
|
||||
|
||||
var params = { foo: ["bar","baz,"] };
|
||||
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar,baz%2C", "getParameterString returns with list of CSVs when given a list. ");
|
||||
}
|
||||
|
||||
function test_08_Util_createAlphaImageDiv(t) {
|
||||
@@ -211,7 +223,7 @@
|
||||
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
||||
|
||||
t.eq( imageDiv.style.position, position, "image.style.positionset correctly");
|
||||
t.eq( imageDiv.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
|
||||
t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");
|
||||
|
||||
var filterString;
|
||||
if (OpenLayers.Util.alphaHack()) {
|
||||
@@ -223,11 +235,10 @@
|
||||
|
||||
|
||||
image = imageDiv.firstChild;
|
||||
|
||||
if (!isMozilla)
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
else
|
||||
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
|
||||
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
|
||||
t.eq( image.id, id + "_innerImage", "image.id set correctly");
|
||||
|
||||
t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");
|
||||
@@ -293,7 +304,7 @@
|
||||
t.eq( element.style.position, position, "element.style.position set correctly");
|
||||
t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");
|
||||
t.eq( element.style.overflow, overflow, "element.style.overflow set correctly");
|
||||
t.eq( element.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
|
||||
t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly");
|
||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||
t.eq( element.style.filter, filterString, "element.style.filter set correctly");
|
||||
}
|
||||
@@ -313,11 +324,10 @@
|
||||
var opacity = 0.5;
|
||||
|
||||
OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
|
||||
|
||||
if (OpenLayers.Util.alphaHack())
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
else
|
||||
t.ok( imageDiv instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
|
||||
t.ok( imageDiv.nodeName == "DIV", "createDiv creates a valid HTMLDivElement" );
|
||||
|
||||
t.eq( imageDiv.id, id, "image.id set correctly");
|
||||
t.eq( imageDiv.style.left, xy.x + "px", "image.style.left set correctly");
|
||||
@@ -327,7 +337,7 @@
|
||||
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
||||
|
||||
t.eq( imageDiv.style.position, position, "image.style.position set correctly");
|
||||
t.eq( imageDiv.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
|
||||
t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");
|
||||
|
||||
|
||||
|
||||
@@ -339,7 +349,7 @@
|
||||
t.ok( true, "skipping element test outside of Mozilla");
|
||||
} else {
|
||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
|
||||
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
|
||||
}
|
||||
t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
|
||||
t.eq( image.id, id + "_innerImage", "image.id set correctly");
|
||||
@@ -516,14 +526,14 @@
|
||||
url2 = "http://www.openlayers.org";
|
||||
|
||||
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignorePort80 works");
|
||||
|
||||
options = {
|
||||
'ignorePort80': false
|
||||
}
|
||||
|
||||
url1 = "http://www.openlayers.org:80";
|
||||
url2 = "http://www.openlayers.org:50";
|
||||
|
||||
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2), "port check works");
|
||||
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2, options), "port check works");
|
||||
|
||||
|
||||
//HASH
|
||||
@@ -546,8 +556,8 @@
|
||||
|
||||
|
||||
//PATHNAME
|
||||
url1 = "foo.html";
|
||||
url2 = "../tests/foo.html";
|
||||
url1 = "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");
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ div.olControlMousePosition {
|
||||
}
|
||||
|
||||
.olControlOverviewMapExtentRectangle {
|
||||
cursor: move;
|
||||
border: 2px dotted red;
|
||||
}
|
||||
.olLayerGeoRSSDescription {
|
||||
|
||||
Reference in New Issue
Block a user