Merge pull request #126 from tomhughes/url-rewrite
Add an interception point to allow image URLs to be rewritten
This commit is contained in:
@@ -550,10 +550,8 @@ OpenLayers.Control.LayerSwitcher =
|
|||||||
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
|
||||||
|
|
||||||
// maximize button div
|
// maximize button div
|
||||||
var img = imgLocation + 'layer-switcher-maximize.png';
|
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
|
||||||
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||||
"OpenLayers_Control_MaximizeDiv",
|
"OpenLayers_Control_MaximizeDiv",
|
||||||
null,
|
null,
|
||||||
@@ -569,7 +567,7 @@ OpenLayers.Control.LayerSwitcher =
|
|||||||
this.div.appendChild(this.maximizeDiv);
|
this.div.appendChild(this.maximizeDiv);
|
||||||
|
|
||||||
// minimize button div
|
// minimize button div
|
||||||
var img = imgLocation + 'layer-switcher-minimize.png';
|
var img = OpenLayers.Util.getImageLocation('layer-switcher-minimize.png');
|
||||||
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||||
"OpenLayers_Control_MinimizeDiv",
|
"OpenLayers_Control_MinimizeDiv",
|
||||||
null,
|
null,
|
||||||
|
|||||||
@@ -238,9 +238,8 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
// map viewport.
|
// map viewport.
|
||||||
if(!this.outsideViewport) {
|
if(!this.outsideViewport) {
|
||||||
this.div.className += " " + this.displayClass + 'Container';
|
this.div.className += " " + this.displayClass + 'Container';
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
|
||||||
// maximize button div
|
// maximize button div
|
||||||
var img = imgLocation + 'layer-switcher-maximize.png';
|
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
|
||||||
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||||
this.displayClass + 'MaximizeButton',
|
this.displayClass + 'MaximizeButton',
|
||||||
null,
|
null,
|
||||||
@@ -256,7 +255,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
this.div.appendChild(this.maximizeDiv);
|
this.div.appendChild(this.maximizeDiv);
|
||||||
|
|
||||||
// minimize button div
|
// minimize button div
|
||||||
var img = imgLocation + 'layer-switcher-minimize.png';
|
var img = OpenLayers.Util.getImageLocation('layer-switcher-minimize.png');
|
||||||
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||||
'OpenLayers_Control_minimizeDiv',
|
'OpenLayers_Control_minimizeDiv',
|
||||||
null,
|
null,
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
* image of the button, and has all the proper event handlers set.
|
* image of the button, and has all the proper event handlers set.
|
||||||
*/
|
*/
|
||||||
_addButton:function(id, img, xy, sz) {
|
_addButton:function(id, img, xy, sz) {
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
|
var imgLocation = OpenLayers.Util.getImageLocation(img);
|
||||||
var btn = OpenLayers.Util.createAlphaImageDiv(
|
var btn = OpenLayers.Util.createAlphaImageDiv(
|
||||||
this.id + "_" + id,
|
this.id + "_" + id,
|
||||||
xy, sz, imgLocation, "absolute");
|
xy, sz, imgLocation, "absolute");
|
||||||
|
|||||||
@@ -193,14 +193,13 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
* location - {<OpenLayers.Pixel>} where zoombar drawing is to start.
|
* location - {<OpenLayers.Pixel>} where zoombar drawing is to start.
|
||||||
*/
|
*/
|
||||||
_addZoomBar:function(centered) {
|
_addZoomBar:function(centered) {
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation();
|
var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
|
||||||
|
|
||||||
var id = this.id + "_" + this.map.id;
|
var id = this.id + "_" + this.map.id;
|
||||||
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
|
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
|
||||||
var slider = OpenLayers.Util.createAlphaImageDiv(id,
|
var slider = OpenLayers.Util.createAlphaImageDiv(id,
|
||||||
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
|
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
|
||||||
new OpenLayers.Size(20,9),
|
new OpenLayers.Size(20,9),
|
||||||
imgLocation+"slider.png",
|
imgLocation,
|
||||||
"absolute");
|
"absolute");
|
||||||
slider.style.cursor = "move";
|
slider.style.cursor = "move";
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
@@ -221,6 +220,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
var sz = new OpenLayers.Size();
|
var sz = new OpenLayers.Size();
|
||||||
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();
|
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();
|
||||||
sz.w = this.zoomStopWidth;
|
sz.w = this.zoomStopWidth;
|
||||||
|
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
|
||||||
var div = null;
|
var div = null;
|
||||||
|
|
||||||
if (OpenLayers.Util.alphaHack()) {
|
if (OpenLayers.Util.alphaHack()) {
|
||||||
@@ -228,7 +228,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
div = OpenLayers.Util.createAlphaImageDiv(id, centered,
|
div = OpenLayers.Util.createAlphaImageDiv(id, centered,
|
||||||
new OpenLayers.Size(sz.w,
|
new OpenLayers.Size(sz.w,
|
||||||
this.zoomStopHeight),
|
this.zoomStopHeight),
|
||||||
imgLocation + "zoombar.png",
|
imgLocation,
|
||||||
"absolute", null, "crop");
|
"absolute", null, "crop");
|
||||||
div.style.height = sz.h + "px";
|
div.style.height = sz.h + "px";
|
||||||
} else {
|
} else {
|
||||||
@@ -236,7 +236,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
'OpenLayers_Control_PanZoomBar_Zoombar' + this.map.id,
|
'OpenLayers_Control_PanZoomBar_Zoombar' + this.map.id,
|
||||||
centered,
|
centered,
|
||||||
sz,
|
sz,
|
||||||
imgLocation+"zoombar.png");
|
imgLocation);
|
||||||
}
|
}
|
||||||
div.style.cursor = "pointer";
|
div.style.cursor = "pointer";
|
||||||
this.zoombarDiv = div;
|
this.zoombarDiv = div;
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ OpenLayers.Format.Text = OpenLayers.Class(OpenLayers.Format, {
|
|||||||
|
|
||||||
if(options.extractStyles !== false) {
|
if(options.extractStyles !== false) {
|
||||||
options.defaultStyle = {
|
options.defaultStyle = {
|
||||||
'externalGraphic': OpenLayers.Util.getImagesLocation() +
|
'externalGraphic': OpenLayers.Util.getImageLocation("marker.png"),
|
||||||
"marker.png",
|
|
||||||
'graphicWidth': 21,
|
'graphicWidth': 21,
|
||||||
'graphicHeight': 25,
|
'graphicHeight': 25,
|
||||||
'graphicXOffset': -10.5,
|
'graphicXOffset': -10.5,
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, {
|
|||||||
this.pane.style.height="100%";
|
this.pane.style.height="100%";
|
||||||
if (OpenLayers.BROWSER_NAME == "msie") {
|
if (OpenLayers.BROWSER_NAME == "msie") {
|
||||||
this.pane.style.background =
|
this.pane.style.background =
|
||||||
"url(" + OpenLayers.Util.getImagesLocation() + "blank.gif)";
|
"url(" + OpenLayers.Util.getImageLocation("blank.gif") + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isFixed) {
|
if (this.isFixed) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ OpenLayers.Layer.WorldWind = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
Y: y
|
Y: y
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return OpenLayers.Util.getImagesLocation() + "blank.gif";
|
return OpenLayers.Util.getImageLocation("blank.gif");
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ OpenLayers.Marker = OpenLayers.Class({
|
|||||||
* {<OpenLayers.Icon>} A default OpenLayers.Icon to use for a marker
|
* {<OpenLayers.Icon>} A default OpenLayers.Icon to use for a marker
|
||||||
*/
|
*/
|
||||||
OpenLayers.Marker.defaultIcon = function() {
|
OpenLayers.Marker.defaultIcon = function() {
|
||||||
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
|
var url = OpenLayers.Util.getImageLocation("marker.png");
|
||||||
var size = new OpenLayers.Size(21, 25);
|
var size = new OpenLayers.Size(21, 25);
|
||||||
var calculateOffset = function(size) {
|
var calculateOffset = function(size) {
|
||||||
return new OpenLayers.Pixel(-(size.w/2), -size.h);
|
return new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ OpenLayers.Popup.FramedCloud =
|
|||||||
initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,
|
initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,
|
||||||
closeBoxCallback) {
|
closeBoxCallback) {
|
||||||
|
|
||||||
this.imageSrc = OpenLayers.Util.getImagesLocation() + 'cloud-popup-relative.png';
|
this.imageSrc = OpenLayers.Util.getImageLocation('cloud-popup-relative.png');
|
||||||
OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments);
|
OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments);
|
||||||
this.contentDiv.className = this.contentDisplayClass;
|
this.contentDiv.className = this.contentDisplayClass;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -557,6 +557,16 @@ OpenLayers.Util.getImagesLocation = function() {
|
|||||||
return OpenLayers.ImgPath || (OpenLayers._getScriptLocation() + "img/");
|
return OpenLayers.ImgPath || (OpenLayers._getScriptLocation() + "img/");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function: getImageLocation
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {String} The fully formatted location string for a specified image
|
||||||
|
*/
|
||||||
|
OpenLayers.Util.getImageLocation = function(image) {
|
||||||
|
return OpenLayers.Util.getImagesLocation() + image;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: Try
|
* Function: Try
|
||||||
|
|||||||
+2
-2
@@ -1475,8 +1475,8 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
|
|||||||
* Method: _addButton
|
* Method: _addButton
|
||||||
*/
|
*/
|
||||||
_addButton:function(id, img, activeImg, xy, sz, title) {
|
_addButton:function(id, img, activeImg, xy, sz, title) {
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
|
var imgLocation = OpenLayers.Util.getImageLocation(img);
|
||||||
var activeImgLocation = OpenLayers.Util.getImagesLocation() + activeImg;
|
var activeImgLocation = OpenLayers.Util.getImageLocation(activeImg);
|
||||||
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
|
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
|
||||||
var btn = OpenLayers.Util.createAlphaImageDiv(
|
var btn = OpenLayers.Util.createAlphaImageDiv(
|
||||||
"OpenLayers_Control_MouseToolbar_" + id,
|
"OpenLayers_Control_MouseToolbar_" + id,
|
||||||
|
|||||||
Reference in New Issue
Block a user