Compare commits
6 Commits
docs
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f81dec9f4 | ||
|
|
ac1e566b70 | ||
|
|
9359035324 | ||
|
|
21b5141c09 | ||
|
|
bada3d98a1 | ||
|
|
2150a2c783 |
@@ -45,7 +45,7 @@ OpenLayers.Format.OWSCommon.v1_1_0 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
serviceIdentification.title = this.getChildValue(node);
|
||||
},
|
||||
"Abstract": function(node, serviceIdentification) {
|
||||
serviceIdentification.abstract = this.getChildValue(node);
|
||||
serviceIdentification["abstract"] = this.getChildValue(node);
|
||||
},
|
||||
"Keywords": function(node, serviceIdentification) {
|
||||
serviceIdentification.keywords = {};
|
||||
|
||||
@@ -186,7 +186,7 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class(
|
||||
obj.title = this.getChildValue(node);
|
||||
},
|
||||
"Abstract": function(node, obj) {
|
||||
obj.abstract = this.getChildValue(node);
|
||||
obj["abstract"] = this.getChildValue(node);
|
||||
},
|
||||
"BoundingBox": function(node, obj) {
|
||||
var bbox = {};
|
||||
|
||||
@@ -263,7 +263,10 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
*/
|
||||
setVisibility: function(visible) {
|
||||
this.setGMapVisibility(visible);
|
||||
// sharing a map container, opacity has to be set per layer
|
||||
var opacity = this.opacity == null ? 1 : this.opacity;
|
||||
OpenLayers.Layer.EventPane.prototype.setVisibility.apply(this, arguments);
|
||||
this.setOpacity(opacity);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -303,6 +306,33 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: setOpacity
|
||||
* Sets the opacity for the entire layer (all images)
|
||||
*
|
||||
* Parameter:
|
||||
* opacity - {Float}
|
||||
*/
|
||||
setOpacity: function(opacity) {
|
||||
if (opacity !== this.opacity) {
|
||||
if (this.map != null) {
|
||||
this.map.events.triggerEvent("changelayer", {
|
||||
layer: this,
|
||||
property: "opacity"
|
||||
});
|
||||
}
|
||||
this.opacity = opacity;
|
||||
}
|
||||
// Though this layer's opacity may not change, we're sharing a container
|
||||
// and need to update the opacity for the entire container.
|
||||
if (this.getVisibility()) {
|
||||
var container = this.mapObject.getContainer();
|
||||
OpenLayers.Util.modifyDOMElement(
|
||||
container, null, null, null, null, null, null, opacity
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: destroy
|
||||
* Clean up this layer.
|
||||
|
||||
@@ -107,7 +107,6 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
var y = Math.round((this.maxExtent.top - bounds.top)
|
||||
/ (res * this.tileSize.h));
|
||||
var z = this.map.getZoom();
|
||||
var limit = Math.pow(2, z);
|
||||
|
||||
var url = this.url;
|
||||
var s = '' + x + y + z;
|
||||
|
||||
@@ -424,9 +424,9 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
* ways to call the map constructor. See the examples below.
|
||||
*
|
||||
* Parameters:
|
||||
* div - {String} Id of an element in your page that will contain the map.
|
||||
* May be omitted if the <div> option is provided or if you intend
|
||||
* to use <render> later.
|
||||
* div - {DOMElement|String} The element or id of an element in your page
|
||||
* that will contain the map. May be omitted if the <div> option is
|
||||
* provided or if you intend to call the <render> method later.
|
||||
* options - {Object} Optional object with properties to tag onto the map.
|
||||
*
|
||||
* Examples (method one):
|
||||
@@ -594,13 +594,12 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
|
||||
// add any initial layers
|
||||
if (options && options.layers) {
|
||||
this.addLayers(options.layers);
|
||||
}
|
||||
|
||||
// set center (and optionally zoom)
|
||||
if (options && options.center) {
|
||||
// zoom can be undefined here
|
||||
this.setCenter(options.center, options.zoom);
|
||||
this.addLayers(options.layers);
|
||||
// set center (and optionally zoom)
|
||||
if (options.center) {
|
||||
// zoom can be undefined here
|
||||
this.setCenter(options.center, options.zoom);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -848,9 +848,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
|
||||
|
||||
var align = style.labelAlign || "cm";
|
||||
var xshift = textbox.clientWidth *
|
||||
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);
|
||||
(OpenLayers.Renderer.VML.LABEL_SHIFT[align[0] || "c"]);
|
||||
var yshift = textbox.clientHeight *
|
||||
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);
|
||||
(OpenLayers.Renderer.VML.LABEL_SHIFT[align[1] || "m"]);
|
||||
label.style.left = parseInt(label.style.left)-xshift-1+"px";
|
||||
label.style.top = parseInt(label.style.top)+yshift+"px";
|
||||
|
||||
|
||||
@@ -234,7 +234,57 @@
|
||||
t.debug_print("Google tests can't be run from " +
|
||||
window.location.host);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function test_setOpacity(t) {
|
||||
|
||||
t.plan(6);
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var gmap = new OpenLayers.Layer.Google(
|
||||
"Google Streets", // the default
|
||||
{numZoomLevels: 20}
|
||||
);
|
||||
var ghyb = new OpenLayers.Layer.Google(
|
||||
"Google Hybrid",
|
||||
{type: G_HYBRID_MAP, numZoomLevels: 20}
|
||||
);
|
||||
var gsat = new OpenLayers.Layer.Google(
|
||||
"Google Satellite",
|
||||
{type: G_SATELLITE_MAP, numZoomLevels: 22}
|
||||
);
|
||||
map.addLayers([gmap, ghyb, gsat]);
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
var container = map.baseLayer.mapObject.getContainer();
|
||||
var opacityCheck = function(opacity) {
|
||||
var style = container.style;
|
||||
var current = style.opacity === "" ? 1 : parseFloat(style.opacity);
|
||||
if (style.filter && !style.opacity) {
|
||||
current = Number(style.filter.replace(/alpha\(opacity=(.+?)\)/, "$1"));
|
||||
}
|
||||
return (current === opacity);
|
||||
};
|
||||
|
||||
gmap.setOpacity(0.5);
|
||||
t.ok(opacityCheck(0.5), "container opacity set for visible layer");
|
||||
|
||||
ghyb.setOpacity(0.75);
|
||||
t.ok(opacityCheck(0.5), "container opacity not changed if layer not visible");
|
||||
map.setBaseLayer(ghyb);
|
||||
t.ok(opacityCheck(0.75), "container opacity changed to 0.75 when layer becomes visible");
|
||||
|
||||
map.setBaseLayer(gsat);
|
||||
t.ok(opacityCheck(1), "container opacity set to 1 by default");
|
||||
gsat.setOpacity(0.25);
|
||||
t.ok(opacityCheck(0.25), "container opacity changed to 0.25 for visible layer");
|
||||
|
||||
map.setBaseLayer(gmap);
|
||||
t.ok(opacityCheck(0.5), "container opacity set to layer opacity");
|
||||
|
||||
map.destroy();
|
||||
|
||||
}
|
||||
|
||||
function test_Layer_Google_setGMapVisibility(t) {
|
||||
if(validkey) {
|
||||
|
||||
@@ -1557,19 +1557,19 @@
|
||||
var map, msg;
|
||||
|
||||
|
||||
// try setting center without layers, this is not supported
|
||||
// try setting center without layers, this has no effect
|
||||
var failed = false;
|
||||
try {
|
||||
map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
center: new OpenLayers.LonLat(1, 2)
|
||||
});
|
||||
msg = "center set with no layers";
|
||||
msg = "center option without layers has no effect";
|
||||
} catch (err) {
|
||||
failed = true;
|
||||
msg = "center cannot be set without layers";
|
||||
msg = "center option without layers throws error";
|
||||
}
|
||||
t.ok(failed, msg);
|
||||
t.ok(!failed, msg);
|
||||
|
||||
if (map) {
|
||||
map.destroy();
|
||||
|
||||
Reference in New Issue
Block a user