Merge branch 'master' into light-build

This commit is contained in:
Matt Priour
2012-03-05 10:46:04 -06:00
70 changed files with 1062 additions and 262 deletions

View File

@@ -51,10 +51,14 @@ def build(config_file = None, output_file = None, options = None):
outputFilename = output_file
print "Merging libraries."
if use_compressor == "closure":
sourceFiles = mergejs.getNames(sourceDirectory, configFilename)
else:
merged = mergejs.run(sourceDirectory, None, configFilename)
try:
if use_compressor == "closure":
sourceFiles = mergejs.getNames(sourceDirectory, configFilename)
else:
merged = mergejs.run(sourceDirectory, None, configFilename)
except mergejs.MissingImport, E:
print "\nAbnormal termination."
sys.exit("ERROR: %s" % E)
print "Compressing using %s" % use_compressor
if use_compressor == "jsmin":

View File

@@ -1,5 +1,4 @@
[first]
OpenLayers/SingleFile.js
[last]

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="all-overlays-google.js"></script>
</head>

View File

@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers Script Protocol XML Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="../lib/OpenLayers.js"></script>
</head>
<body>
<h1 id="title">Script Protocol With XML</h1>
<div id="tags">
protocol, script, cross origin, xml, advanced
</div>
<p id="shortdesc">
Demonstrates how, with a custom parseFeatures method, the script protocol can be used with YQL for cross-origin loading of files in any of the XML formats supported by OpenLayers.
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
YQL can wrap a jsonp callback around an XML file, which effectively means Yahoo's servers are acting as a proxy for cross-origin feature loading. This example uses a GPX file, but the same technique can be used for other formats such as KML.
</p>
<p>
View the <a href="cross-origin-xml.js" target="_blank">cross-origin-xml.js</a>
source to see how this is done
</p>
</div>
<script src="cross-origin-xml.js"></script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
var map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.OSM(),
new OpenLayers.Layer.Vector("Vectors", {
projection: new OpenLayers.Projection("EPSG:4326"),
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.Script({
url: "http://query.yahooapis.com/v1/public/yql",
params: {
q: "select * from xml where url='http://www.topografix.com/fells_loop.gpx'"
},
format: new OpenLayers.Format.GPX(),
parseFeatures: function(data) {
return this.format.read(data.results[0]);
}
}),
eventListeners: {
"featuresadded": function () {
this.map.zoomToExtent(this.getDataExtent());
}
}
})
]
});

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="google-v3.js"></script>
</head>

73
examples/mapbox.html Normal file
View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers MapBox Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<style>
.olControlAttribution {
bottom: 5px;
font-size: 9px;
}
div.olControlZoomPanel {
top: 10px;
left: 10px;
}
div.olControlZoomPanel .olControlZoomInItemInactive,
div.olControlZoomPanel .olControlZoomOutItemInactive {
background: rgba(0, 0, 0, 0.2);
position: absolute;
}
div.olControlZoomPanel .olControlZoomInItemInactive {
border-radius: 3px 3px 0 0;
}
div.olControlZoomPanel .olControlZoomOutItemInactive {
border-radius: 0 0 3px 3px ;
top: 20px;
}
div.olControlZoomPanel div:hover {
background: rgba(0, 0, 0, 0.5);
}
div.olControlZoomPanel .olControlZoomOutItemInactive:after ,
div.olControlZoomPanel .olControlZoomInItemInactive:after {
font-weight: bold;
content: '+';
font-size: 18px;
padding: 0 2px;
z-index: 2000;
color: #fff;
line-height: 1em;
}
div.olControlZoomPanel .olControlZoomOutItemInactive:after {
content: '';
line-height: 0.9em;
padding: 0 5px;
}
div.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
display: none;
}
</style>
</head>
<body>
<h1 id="title">Basic MapBox OSM Example</h1>
<div id="tags">mapbox xyz osm</div>
<div id="shortdesc">Shows how to use MapBox tiles in an OpenLayers map.</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>This example demonstrates the use of an XYZ layer that accesses tiles from MapBox.</p>
<p>
See the <a href="mapbox.js" target="_blank">mapbox.js</a> source
for details. Make sure to read the <a href="http://mapbox.com/tos/">Terms of Service</a>
before using MapBox tiles in your application.
</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="mapbox.js"></script>
</body>
</html>

34
examples/mapbox.js Normal file
View File

@@ -0,0 +1,34 @@
var streets = new OpenLayers.Layer.XYZ(
"MapBox Streets",
[
"http://a.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png",
"http://b.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png",
"http://c.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png",
"http://d.tiles.mapbox.com/v3/mapbox.mapbox-streets/${z}/${x}/${y}.png"
], {
attribution: "Tiles © <a href='http://mapbox.com/'>MapBox</a> | " +
"Data © <a href='http://www.openstreetmap.org/'>OpenStreetMap</a> " +
"and contributors, CC-BY-SA",
sphericalMercator: true,
transitionEffect: "resize",
buffer: 1,
numZoomLevels: 16
}
);
var map = new OpenLayers.Map({
div: "map",
layers: [streets],
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.ZoomPanel(),
new OpenLayers.Control.Permalink({anchor: true})
],
center: [0, 0],
zoom: 1
});

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.3&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="osm-google.js"></script>
</head>

View File

@@ -22,7 +22,7 @@
}
</style>
<script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
</head>

68
examples/zoom.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Zoom Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<style>
.olControlAttribution {
bottom: 5px;
font-size: 9px;
}
#customZoom {
z-index: 1001;
position: relative;
top: 10px;
left: 10px;
}
#customZoom a {
text-decoration: none;
position: absolute;
display: block;
width: 50px;
text-align: center;
font-weight: bold;
color: #fff;
background: #369;
border: 1px solid #ccc;
border-radius: 3px;
}
#customZoom a:hover {
background: #036;
}
#customZoomOut {
top: 25px;
}
</style>
</head>
<body>
<h1 id="title">Zoom Control Example</h1>
<div id="tags">zoom control</div>
<div id="shortdesc">Shows how to use a simple zoom control.</div>
<div id="map" class="smallmap"></div>
<p>The map above uses the default control configuration and style.</p>
<p>The map below uses the custom zoom elements and styling.</p>
<div id="map2" class="smallmap">
<div id="customZoom">
<a href="#customZoomIn" id="customZoomIn">in</a>
<a href="#customZoomIn" id="customZoomOut">out</a>
</div>
</div>
<div id="docs">
<p>This example demonstrates the use of a Zoom control.</p>
<p>
See the <a href="zoom.js" target="_blank">zoom.js</a> source
for details.
</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="zoom.js"></script>
</body>
</html>

34
examples/zoom.js Normal file
View File

@@ -0,0 +1,34 @@
var map = new OpenLayers.Map({
div: "map",
layers: [new OpenLayers.Layer.OSM()],
controls: [
new OpenLayers.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Zoom()
],
center: [0, 0],
zoom: 1
});
var map2 = new OpenLayers.Map({
div: "map2",
layers: [new OpenLayers.Layer.OSM()],
controls: [
new OpenLayers.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
}),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Zoom({
zoomInId: "customZoomIn",
zoomOutId: "customZoomOut"
})
],
center: [0, 0],
zoom: 1
});

View File

@@ -204,6 +204,7 @@
"OpenLayers/Control/Graticule.js",
"OpenLayers/Control/TransformFeature.js",
"OpenLayers/Control/SLDSelect.js",
"OpenLayers/Control/Zoom.js",
"OpenLayers/Geometry.js",
"OpenLayers/Geometry/Collection.js",
"OpenLayers/Geometry/Point.js",

View File

@@ -3,6 +3,10 @@
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/SingleFile.js
*/
/**
* Header: OpenLayers Base Types
* OpenLayers custom string, number and function functions are described here.
@@ -60,6 +64,28 @@ OpenLayers.String = {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
},
/**
* APIFunction: camelize
* Camel-case a hyphenated string.
* Ex. "chicken-head" becomes "chickenHead", and
* "-chicken-head" becomes "ChickenHead".
*
* Parameters:
* str - {String} The string to be camelized. The original is not modified.
*
* Returns:
* {String} The string, camelized
*/
camelize: function(str) {
var oStringList = str.split('-');
var camelizedString = oStringList[0];
for (var i=1, len=oStringList.length; i<len; i++) {
var s = oStringList[i];
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
}
return camelizedString;
},
/**
* APIFunction: format
* Given a string with tokens in the form ${token}, return a string

View File

@@ -3,6 +3,10 @@
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/SingleFile.js
*/
/**
* Namespace: OpenLayers.Date
* Contains implementations of Date.parse and date.toISOString that match the

View File

@@ -163,7 +163,7 @@ OpenLayers.Element = {
var value = null;
if (element && element.style) {
value = element.style[style];
value = element.style[OpenLayers.String.camelize(style)];
if (!value) {
if (document.defaultView &&
document.defaultView.getComputedStyle) {
@@ -171,7 +171,7 @@ OpenLayers.Element = {
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css.getPropertyValue(style) : null;
} else if (element.currentStyle) {
value = element.currentStyle[style];
value = element.currentStyle[OpenLayers.String.camelize(style)];
}
}

View File

@@ -231,8 +231,8 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
* mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
*/
measureImmediate : function(point, feature, drawing) {
if (drawing && this.delayedTrigger === null &&
!this.handler.freehandMode(this.handler.evt)) {
if (drawing && !this.handler.freehandMode(this.handler.evt)) {
this.cancelDelay();
this.measure(feature.geometry, "measurepartial");
}
},

View File

@@ -246,7 +246,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
// configure the drag control
var dragOptions = {
geometryTypes: ["OpenLayers.Geometry.Point"],
snappingOptions: this.snappingOptions,
onStart: function(feature, pixel) {
control.dragStart.apply(control, [feature, pixel]);
},

View File

@@ -493,14 +493,14 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
this.ovmap.zoomToMaxExtent();
// check extent rectangle border width
this.wComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'borderLeftWidth')) +
'border-left-width')) +
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'borderRightWidth'));
'border-right-width'));
this.wComp = (this.wComp) ? this.wComp : 2;
this.hComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'border-top-width')) +
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'borderBottomWidth'));
'border-bottom-width'));
this.hComp = (this.hComp) ? this.hComp : 2;
this.handlers.drag = new OpenLayers.Handler.Drag(

View File

@@ -94,12 +94,13 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
* APIMethod: destroy
*/
destroy: function() {
if (this.element.parentNode == this.div) {
if (this.element && this.element.parentNode == this.div) {
this.div.removeChild(this.element);
this.element = null;
}
if (this.map) {
this.map.events.unregister('moveend', this, this.updateLink);
}
this.element = null;
this.map.events.unregister('moveend', this, this.updateLink);
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},

View File

@@ -341,6 +341,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
service: "WMS",
version: firstLayer.params.VERSION,
request: "GetFeatureInfo",
exceptions: firstLayer.params.EXCEPTIONS,
bbox: this.map.getExtent().toBBOX(null,
firstLayer.reverseAxisOrder()),
feature_count: this.maxFeatures,

View File

@@ -0,0 +1,142 @@
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the Clear BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Control.js
* @requires OpenLayers/Events/buttonclick.js
*/
/**
* Class: OpenLayers.Control.Zoom
* The Zoom control is a pair of +/- links for zooming in and out.
*
* Inherits from:
* - <OpenLayers.Control>
*/
OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
/**
* APIProperty: zoomInText
* {String}
* Text for zoom-in link. Default is "+".
*/
zoomInText: "+",
/**
* APIProperty: zoomInId
* {String}
* Instead of having the control create a zoom in link, you can provide
* the identifier for an anchor element already added to the document.
* By default, an element with id "olZoomInLink" will be searched for
* and used if it exists.
*/
zoomInId: "olZoomInLink",
/**
* APIProperty: zoomOutText
* {String}
* Text for zoom-out link. Default is "-".
*/
zoomOutText: "-",
/**
* APIProperty: zoomOutId
* {String}
* Instead of having the control create a zoom out link, you can provide
* the identifier for an anchor element already added to the document.
* By default, an element with id "olZoomOutLink" will be searched for
* and used if it exists.
*/
zoomOutId: "olZoomOutLink",
/**
* Method: draw
*
* Returns:
* {DOMElement} A reference to the DOMElement containing the zoom links.
*/
draw: function() {
var div = OpenLayers.Control.prototype.draw.apply(this),
links = this.getOrCreateLinks(div),
zoomIn = links.zoomIn,
zoomOut = links.zoomOut,
bind = OpenLayers.Function.bind;
this.events.register("buttonclick", this, this.onZoomClick);
this.zoomInLink = zoomIn;
this.zoomOutLink = zoomOut;
return div;
},
/**
* Method: getOrCreateLinks
*
* Parameters:
* el - {DOMElement}
*
* Return:
* {Object} Object with zoomIn and zoomOut properties referencing links.
*/
getOrCreateLinks: function(el) {
var zoomIn = document.getElementById(this.zoomInId),
zoomOut = document.getElementById(this.zoomOutId),
eventElement = zoomOut ? zoomOut.parentNode : this.div;
this.events.attachToElement(eventElement);
if (!zoomIn) {
zoomIn = document.createElement("a");
zoomIn.href = "#zoomIn";
zoomIn.appendChild(document.createTextNode(this.zoomInText));
zoomIn.className = "olControlZoomIn";
el.appendChild(zoomIn);
}
OpenLayers.Element.addClass(zoomIn, "olButton");
if (!zoomOut) {
zoomOut = document.createElement("a");
zoomOut.href = "#zoomOut";
zoomOut.appendChild(document.createTextNode(this.zoomOutText));
zoomOut.className = "olControlZoomOut";
el.appendChild(zoomOut);
}
OpenLayers.Element.addClass(zoomOut, "olButton");
return {
zoomIn: zoomIn, zoomOut: zoomOut
};
},
/**
* Method: onZoomClick
* Called when zoomin/out link is clicked.
*/
onZoomClick: function(evt) {
var propagate = true,
button = evt.buttonElement;
if (button === this.zoomInLink) {
this.map.zoomIn();
propagate = false;
} else if (button === this.zoomOutLink) {
this.map.zoomOut();
propagate = false;
}
return propagate;
},
/**
* Method: destroy
* Clean up.
*/
destroy: function() {
if (this.zoomInLink) {
this.zoomInLink.onclick = null;
delete this.zoomInLink;
}
if (this.zoomOutLink) {
this.zoomOutLink.onclick = null;
delete this.zoomOutLink;
}
OpenLayers.Control.prototype.destroy.apply(this);
},
CLASS_NAME: "OpenLayers.Control.Zoom"
});

View File

@@ -64,9 +64,25 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
* APIProperty: extractAttributes
* {Boolean} Extract attributes from KML. Default is true.
* Extracting styleUrls requires this to be set to true
* Note that currently only Data and SimpleData
* elements are handled.
*/
extractAttributes: true,
/**
* APIProperty: kvpAttributes
* {Boolean} Only used if extractAttributes is true.
* If set to true, attributes will be simple
* key-value pairs, compatible with other formats,
* Any displayName elements will be ignored.
* If set to false, attributes will be objects,
* retaining any displayName elements, but not
* compatible with other formats. Any CDATA in
* displayName will be read in as a string value.
* Default is false.
*/
kvpAttributes: false,
/**
* Property: extractStyles
* {Boolean} Extract styles from KML. Default is false.
@@ -1079,11 +1095,15 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
if (valueNode.length) {
ed['value'] = this.getChildValue(valueNode[0]);
}
var nameNode = data.getElementsByTagName("displayName");
if (nameNode.length) {
ed['displayName'] = this.getChildValue(nameNode[0]);
if (this.kvpAttributes) {
attributes[key] = ed['value'];
} else {
var nameNode = data.getElementsByTagName("displayName");
if (nameNode.length) {
ed['displayName'] = this.getChildValue(nameNode[0]);
}
attributes[key] = ed;
}
attributes[key] = ed;
}
var simpleDataNodes = node.getElementsByTagName("SimpleData");
for (i = 0, len = simpleDataNodes.length; i < len; i++) {
@@ -1091,8 +1111,12 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
data = simpleDataNodes[i];
key = data.getAttribute("name");
ed['value'] = this.getChildValue(data);
ed['displayName'] = key;
attributes[key] = ed;
if (this.kvpAttributes) {
attributes[key] = ed['value'];
} else {
ed['displayName'] = key;
attributes[key] = ed;
}
}
return attributes;
@@ -1209,7 +1233,14 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
var geometryNode = this.buildGeometryNode(feature.geometry);
placemarkNode.appendChild(geometryNode);
// TBD - deal with remaining (non name/description) attributes.
// output attributes as extendedData
if (feature.attributes) {
var edNode = this.buildExtendedData(feature.attributes);
if (edNode) {
placemarkNode.appendChild(edNode);
}
}
return placemarkNode;
},
@@ -1440,5 +1471,48 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
return point.x + "," + point.y;
},
/**
* Method: buildExtendedData
*
* Parameters:
* attributes - {Object}
*
* Returns
* {DOMElement} A KML ExtendedData node or {null} if no attributes.
*/
buildExtendedData: function(attributes) {
var extendedData = this.createElementNS(this.kmlns, "ExtendedData");
for (var attributeName in attributes) {
// empty, name, description, styleUrl attributes ignored
if (attributes[attributeName] && attributeName != "name" && attributeName != "description" && attributeName != "styleUrl") {
var data = this.createElementNS(this.kmlns, "Data");
data.setAttribute("name", attributeName);
var value = this.createElementNS(this.kmlns, "value");
if (typeof attributes[attributeName] == "object") {
// cater for object attributes with 'value' properties
// other object properties will output an empty node
if (attributes[attributeName].value) {
value.appendChild(this.createTextNode(attributes[attributeName].value));
}
if (attributes[attributeName].displayName) {
var displayName = this.createElementNS(this.kmlns, "displayName");
// displayName always written as CDATA
displayName.appendChild(this.getXMLDoc().createCDATASection(attributes[attributeName].displayName));
data.appendChild(displayName);
}
} else {
value.appendChild(this.createTextNode(attributes[attributeName]));
}
data.appendChild(value);
extendedData.appendChild(data);
}
}
if (this.isSimpleContent(extendedData)) {
return null;
} else {
return extendedData;
}
},
CLASS_NAME: "OpenLayers.Format.KML"
});

View File

@@ -570,7 +570,7 @@ OpenLayers.Format.SLD.v1 = OpenLayers.Class(OpenLayers.Format.Filter.v1_0_0, {
break;
}
}
return format || this.defautlGraphicFormat;
return format || this.defaultGraphicFormat;
},
/**

View File

@@ -221,13 +221,13 @@ OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
document.body.removeChild(testDiv);
var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
"borderLeftWidth"));
"border-left-width"));
var right = parseInt(OpenLayers.Element.getStyle(
this.zoomBox, "borderRightWidth"));
this.zoomBox, "border-right-width"));
var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
"borderTopWidth"));
"border-top-width"));
var bottom = parseInt(OpenLayers.Element.getStyle(
this.zoomBox, "borderBottomWidth"));
this.zoomBox, "border-bottom-width"));
this.boxOffsets = {
left: left,
right: right,

View File

@@ -452,7 +452,9 @@ OpenLayers.Layer.ArcGISCache = OpenLayers.Class(OpenLayers.Layer.XYZ, {
// Write the values into our formatted url
url = OpenLayers.String.format(url, {'x': x, 'y': y, 'z': z});
return url;
return OpenLayers.Util.urlAppend(
url, OpenLayers.Util.getParameterString(this.params)
);
},
/**

View File

@@ -202,6 +202,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* track of the loading progress. Listeners are called with an object
* with a tile property as first argument, making the loded tile
* available to the listener.
* tileerror - Triggered before the tileloaded event (i.e. when the tile is
* still hidden) if a tile failed to load. Listeners receive an object
* as first argument, which has a tile property that references the
* tile that could not be loaded.
*/
/**
@@ -969,7 +973,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
this.numLoadingTiles++;
};
tile.events.register("loadstart", this, tile.onLoadStart);
tile.onLoadEnd = function() {
this.numLoadingTiles--;
@@ -987,8 +990,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
}
};
tile.events.register("loadend", this, tile.onLoadEnd);
tile.events.register("unload", this, tile.onLoadEnd);
tile.onLoadError = function() {
this.events.triggerEvent("tileerror", {tile: tile});
};
tile.events.on({
"loadstart": tile.onLoadStart,
"loadend": tile.onLoadEnd,
"unload": tile.onLoadEnd,
"loaderror": tile.onLoadError,
scope: this
});
},
/**
@@ -1005,6 +1018,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
"loadstart": tile.onLoadStart,
"loadend": tile.onLoadEnd,
"unload": tile.onLoadEnd,
"loaderror": tile.onLoadError,
scope: this
});
},

View File

@@ -60,7 +60,9 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
initialize: function(name, url, params, options) {
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
this.url = url;
this.params = OpenLayers.Util.extend( {}, params);
if (!this.params) {
this.params = OpenLayers.Util.extend({}, params);
}
},
/**

View File

@@ -34,7 +34,7 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
/**
* APIProperty: url
* {String} The tileset URL scheme. Defaults to
* : http://tile.openstreetmap.org/${z}/${x}/${y}.png
* : http://[a|b|c].tile.openstreetmap.org/${z}/${x}/${y}.png
* (the official OSM tileset) if the second argument to the constructor
* is null or undefined. To use another tileset you can have something
* like this:
@@ -43,7 +43,11 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
* "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png");
* (end)
*/
url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
url: [
'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png',
'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png',
'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'
],
/**
* Property: attribution

View File

@@ -496,13 +496,16 @@ OpenLayers.Map = OpenLayers.Class({
this.projection.projCode : this.projection;
OpenLayers.Util.applyDefaults(this, OpenLayers.Projection.defaults[projCode]);
// allow extents to be arrays
// allow extents and center to be arrays
if (this.maxExtent && !(this.maxExtent instanceof OpenLayers.Bounds)) {
this.maxExtent = new OpenLayers.Bounds(this.maxExtent);
}
if (this.restrictedExtent && !(this.restrictedExtent instanceof OpenLayers.Bounds)) {
this.restrictedExtent = new OpenLayers.Bounds(this.restrictedExtent);
}
if (this.center && !(this.center instanceof OpenLayers.LonLat)) {
this.center = new OpenLayers.LonLat(this.center);
}
// initialize layers array
this.layers = [];
@@ -627,7 +630,7 @@ OpenLayers.Map = OpenLayers.Class({
delete this.center;
this.addLayers(options.layers);
// set center (and optionally zoom)
if (options.center) {
if (options.center && !this.getCenter()) {
// zoom can be undefined here
this.setCenter(options.center, options.zoom);
}

View File

@@ -685,7 +685,9 @@ OpenLayers.Popup = OpenLayers.Class({
// 'img' properties in the context.
//
var onImgLoad = function() {
if (this.popup.id === null) { // this.popup has been destroyed!
return;
}
this.popup.updateSize();
if ( this.popup.visible() && this.popup.panMapIfOutOfView ) {
@@ -845,10 +847,10 @@ OpenLayers.Popup = OpenLayers.Class({
//read the padding settings from css, put them in an OL.Bounds
contentDivPadding = new OpenLayers.Bounds(
OpenLayers.Element.getStyle(this.contentDiv, "paddingLeft"),
OpenLayers.Element.getStyle(this.contentDiv, "paddingBottom"),
OpenLayers.Element.getStyle(this.contentDiv, "paddingRight"),
OpenLayers.Element.getStyle(this.contentDiv, "paddingTop")
OpenLayers.Element.getStyle(this.contentDiv, "padding-left"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-bottom"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-right"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-top")
);
//cache the value

View File

@@ -114,7 +114,7 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
* Valid options include:
* url - {String}
* headers - {Object}
* params - {Object}
* params - {Object} URL parameters for GET requests
* format - {<OpenLayers.Format>}
* callback - {Function}
* scope - {Object}

View File

@@ -135,7 +135,7 @@ OpenLayers.Protocol.Script = OpenLayers.Class(OpenLayers.Protocol, {
});
this.filterToParams = function(filter, params) {
return format.write(filter, params);
}
};
}
},

View File

@@ -434,28 +434,6 @@ OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, {
}
},
/**
* Method: setCanvasStyle
* Prepare the canvas for drawing by setting various global settings.
*
* Parameters:
* type - {String} one of 'stroke', 'fill', or 'reset'
* style - {Object} Symbolizer hash
*/
setCanvasStyle: function(type, style) {
if (type === "fill") {
this.canvas.globalAlpha = style['fillOpacity'];
this.canvas.fillStyle = style['fillColor'];
} else if (type === "stroke") {
this.canvas.globalAlpha = style['strokeOpacity'];
this.canvas.strokeStyle = style['strokeColor'];
this.canvas.lineWidth = style['strokeWidth'];
} else {
this.canvas.globalAlpha = 0;
this.canvas.lineWidth = 1;
}
},
/**
* Method: featureIdToHex
* Convert a feature ID string into an RGB hex string.

View File

@@ -3,6 +3,10 @@
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/SingleFile.js
*/
/**
* Namespace: Spherical
* The OpenLayers.Spherical namespace includes utility functions for

View File

@@ -40,6 +40,8 @@ OpenLayers.Tile = OpenLayers.Class({
* to call <draw>(true) to actually draw the tile.
* loadstart - Triggered when tile loading starts.
* loadend - Triggered when tile loading ends.
* loaderror - Triggered before the loadend event (i.e. when the tile is
* still hidden) if the tile could not be loaded.
* reload - Triggered when an already loading tile is reloaded.
* unload - Triggered before a tile is unloaded.
*/

View File

@@ -425,6 +425,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
this.setImgSrc(this.layer.getURL(this.bounds));
} else {
OpenLayers.Element.addClass(img, "olImageLoadError");
this.events.triggerEvent("loaderror");
this.onImageLoad();
}
}

View File

@@ -560,8 +560,10 @@ OpenLayers.Util.urlAppend = function(url, paramStr) {
};
/**
* Property: ImgPath
* {String} Default is ''.
* APIProperty: ImgPath
* {String} Set this to the path where control images are stored.
* If set to '' OpenLayers will use script location + "img/"
* Default is ''.
*/
OpenLayers.ImgPath = '';

View File

@@ -105,30 +105,6 @@ OpenLayers.Util.clearArray = function(array) {
array.length = 0;
};
/**
* APIFunction: camelize
* Camel-case a hyphenated string.
* Ex. "chicken-head" becomes "chickenHead", and
* "-chicken-head" becomes "ChickenHead".
*
* Parameters:
* str - {String} The string to be camelized. The original is not modified.
*
* Returns:
* {String} The string, camelized
*/
OpenLayers.String.camelize = function(str) {
var oStringList = str.split('-');
var camelizedString = oStringList[0];
for (var i=1, len=oStringList.length; i<len; i++) {
var s = oStringList[i];
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
}
return camelizedString;
};
/**
* Function: setOpacity
* *Deprecated*. This function has been deprecated. Instead, please use

View File

@@ -133,6 +133,12 @@ The internal `OpenLayers.Layer.getURLasync` function now take a bound, a callbac
Vector editing across the date line works reliably now. To make this work, OpenLayers won't zoom out to resolutions where more than one world is visible any more. For maps that have base layers with wrapDateLine set to false, no zoom restrictions apply.
## OpenLayers.Util.onImageLoadError no longer exists
To replace a tile that couldn't be loaded with a static image, create a css selector for the `.olImageLoadError` class (e.g. a `background-image`).
For more complex tile loading error handling, register a listener to the layer's `tileerror` event.
## Deprecated Components
A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate `<script>` tag after OpenLayers.js).
@@ -144,7 +150,6 @@ A number of properties, methods, and constructors have been marked as deprecated
* OpenLayers.Util.setOpacity
* OpenLayers.Util.safeStopPropagation
* OpenLayers.Util.getArgs
* OpenLayers.Sring.camelize
* OpenLayers.nullHandler
* OpenLayers.loadURL
* OpenLayers.parseXMLString

View File

@@ -48,7 +48,7 @@ As an example, using bash (with the release files in ~/openlayers):
The [examples directory](http://openlayers.org/dev/examples/) is full of useful examples.
Documentation is available at http://trac.osgeo.org/openlayers/wiki/Documentation.
You can generate the API documentation with http://www.naturaldocs.org/:
You can generate the API documentation with http://www.naturaldocs.org/
As an example, using bash (with the release files in ~/openlayers):
$ cd ~/openlayers/

View File

@@ -17,12 +17,22 @@
function test_all(t) {
t.plan(8);
t.ok(OpenLayers.Animation.isNative !== undefined, "isNative is set.");
t.open_window("Animation.html", function(win) {
function doIt(win) {
win.requestFrame(t);
win.start(t);
win.startDuration(t);
win.stop(t);
});
}
// Test in an extra window in Firefox, and directly in other browsers.
// This is needed because requestAnimationFrame does not work
// correctly in Firefox in a hidden IFrame.
if (window.mozRequestAnimationFrame) {
t.open_window("Animation.html", doIt);
} else {
doIt(window);
}
}
function requestFrame(t) {

View File

@@ -60,6 +60,33 @@
t.eq(OpenLayers.String.trim(str), "", "whitespace string is trimmed correctly");
}
function test_String_camelize(t) {
t.plan(7);
var str = "chickenhead";
t.eq(OpenLayers.String.camelize(str), "chickenhead", "string with no hyphens is left alone");
str = "chicken-head";
t.eq(OpenLayers.String.camelize(str), "chickenHead", "string with one middle hyphen is camelized correctly");
str = "chicken-head-man";
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens is camelized correctly");
str = "-chickenhead";
t.eq(OpenLayers.String.camelize(str), "Chickenhead", "string with starting hyphen is camelized correctly (capitalized)");
str = "-chicken-head-man";
t.eq(OpenLayers.String.camelize(str), "ChickenHeadMan", "string with starting hypen and multiple middle hyphens is camelized correctly");
str = "chicken-";
t.eq(OpenLayers.String.camelize(str), "chicken", "string ending in hyphen is camelized correctly (hyphen dropped)");
str = "chicken-head-man-";
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens and end hyphen is camelized correctly (end hyphen dropped)");
}
function test_String_format(t) {
var unchanged = [
"", "${ ", "${", " ${", "${${", "${}", "${${}}", " ${ ${",

View File

@@ -289,16 +289,16 @@
// move 10 pixels
trigger("mousemove", 0, 10);
t.eq(log.length, 0, "a) no event fired yet");
t.eq(log.length, 1, "a) has fired an event");
t.delay_call(
delay, function() {
// confirm measurepartial is fired
t.eq(log.length, 1, "a) event logged");
t.eq(log.length, 1, "a) one event logged");
t.ok(log[0] && log[0].type == "measurepartial", "a) correct type");
// mousemove within the partialDelay fires no event, so the
// measure below is the one of the initial point
t.ok(log[0] && log[0].measure == 0, "a) correct measure");
t.eq(log[0]?log[0].measure:-1 , 10, "a) correct measure");
// b) move 10 pixels
trigger("mousemove", 0, 20);

View File

@@ -11,6 +11,7 @@
t.eq(control.displayClass, "olControlPermalink", "displayClass is correct");
t.eq(control.base, document.location.href, "base is correct");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink('permalink', 'test.html');
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
@@ -18,6 +19,7 @@
t.eq(control.base, 'test.html', "base is correct");
t.ok(OpenLayers.Util.isElement(control.element), "element is a dom object");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink('permalink');
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
@@ -25,6 +27,7 @@
t.eq(control.base, document.location.href, "base is correct");
t.ok(OpenLayers.Util.isElement(control.element), "element is a dom object");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink(OpenLayers.Util.getElement('permalink'));
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
@@ -32,6 +35,7 @@
t.eq(control.base, document.location.href, "base is correct");
t.ok(OpenLayers.Util.isElement(control.element), "element is a dom object");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink({anchor: true});
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
@@ -39,18 +43,21 @@
t.eq(control.base, document.location.href, "base is correct");
t.ok(control.element == null, "element is null");
t.ok(control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink({anchor: false});
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
t.eq(control.displayClass, "olControlPermalink", "displayClass is correct");
t.eq(control.base, document.location.href, "base is correct");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink({});
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
t.eq(control.displayClass, "olControlPermalink", "displayClass is correct");
t.eq(control.base, document.location.href, "base is correct");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink({element: 'permalink', base: 'test.html'});
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
@@ -58,6 +65,7 @@
t.eq(control.base, 'test.html', "base is correct");
t.ok(OpenLayers.Util.isElement(control.element), "element is a dom object");
t.ok(!control.anchor, "anchor is correct");
control.destroy();
control = new OpenLayers.Control.Permalink({element: 'permalink', base: 'test.html', anchor: true});
t.ok(control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object");
@@ -65,6 +73,7 @@
t.eq(control.base, 'test.html', "base is correct");
t.ok(OpenLayers.Util.isElement(control.element), "element is a dom object");
t.ok(control.anchor, "anchor is correct");
control.destroy();
}
function test_Control_Permalink_uncentered (t) {
t.plan( 1 );
@@ -74,12 +83,14 @@
map.addControl(control);
map.events.triggerEvent("changelayer", {});
t.ok(true, "permalink didn't bomb out.");
map.destroy();
}
function test_Control_Permalink_initwithelem (t) {
t.plan( 1 );
control = new OpenLayers.Control.Permalink(OpenLayers.Util.getElement('permalink'));
t.ok(true, "If the above line doesn't throw an error, we're safe.");
control.destroy();
}
function test_Control_Permalink_updateLinks (t) {
t.plan( 3 );
@@ -100,6 +111,7 @@
map.layers[1].setVisibility(false);
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?zoom=2&lat=0&lon=1.75781&layers=BF"), 'setVisibility sets permalink');
map.destroy();
}
function test_Control_Permalink_updateLinksBase (t) {
t.plan( 2 );
@@ -114,6 +126,7 @@
map.pan(5, 0, {animate:false});
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?zoom=2&lat=0&lon=1.75781&layers=B';
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with base");
map.destroy();
}
function test_Control_Permalink_noElement (t) {
t.plan( 2 );
@@ -122,6 +135,7 @@
map = new OpenLayers.Map('map');
map.addControl(control);
t.eq(map.controls[4].div.firstChild.nodeName, "A", "Permalink control creates div with 'a' inside." );
map.destroy();
}
function test_Control_Permalink_base_with_query (t) {
t.plan( 3 );
@@ -147,6 +161,7 @@
map.pan(5, 0, {animate:false});
map.pan(-5, 0, {animate:false});
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with base and querystring ending with '?'");
map.destroy();
}
@@ -163,6 +178,7 @@
map.pan(5, 0, {animate:false});
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?zoom=2&lat=0&lon=1.75781&layers=B';
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with existing zoom in base");
map.destroy();
}
function test_Control_Permalink_customized(t) {
@@ -189,6 +205,7 @@
t.eq(this.map.controls[this.map.controls.length-1].CLASS_NAME, "CustomArgParser", "Custom ArgParser added correctly.");
t.eq(control.div.firstChild.getAttribute("href"), "./edit.html?zoom=2&lat=0&lon=1.75781&layers=B&customParam=foo", "Custom parameter encoded correctly.");
map.destroy();
}
function test_Control_Permalink_createParams(t) {
@@ -300,6 +317,7 @@
map.layers[1].setVisibility(false);
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getParameterString(control.createParams()), "zoom=2&lat=0&lon=1.75781&layers=BF"), 'setVisibility sets permalink');
map.destroy();
}
function test_Control_Permalink_AnchorBaseElement (t) {
@@ -320,7 +338,80 @@
map.layers[1].setVisibility(false);
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"#zoom=2&lat=0&lon=1.75781&layers=BF"), 'setVisibility sets permalink');
map.destroy();
}
function test_center_from_map(t) {
t.plan(7);
var previous = window.location.hash;
window.location.hash = "";
var err;
try {
var map = new OpenLayers.Map({
layers: [new OpenLayers.Layer(null, {isBaseLayer: true})],
controls: [
new OpenLayers.Control.Permalink({anchor: true})
],
center: [1, 2],
zoom: 3
});
} catch (e) {
err = e;
}
if (err) {
t.fail("Map construction failure: " + err.message);
} else {
t.ok(true, "Map construction works");
}
// confirm that map center is correctly set
var center = map.getCenter();
t.eq(center.lon, 1, "map x");
t.eq(center.lat, 2, "map y")
t.eq(map.getZoom(), 3, "map z");
// confirm that location from map options has been added to url
var params = OpenLayers.Util.getParameters(window.location.hash.replace("#", "?"));
t.eq(params.lon, "1", "url x");
t.eq(params.lat, "2", "url y");
t.eq(params.zoom, "3", "url z");
map.destroy();
window.location.hash = previous;
}
function test_center_from_url(t) {
t.plan(6);
// In cases where the location is specified in the URL and given in
// the map options, we respect the location in the URL.
var previous = window.location.hash;
window.location.hash = "#zoom=6&lat=5&lon=4&layers=B"
var map = new OpenLayers.Map({
layers: [new OpenLayers.Layer(null, {isBaseLayer: true})],
controls: [new OpenLayers.Control.Permalink({anchor: true})],
center: [0, 0],
zoom: 0
});
// confirm that map center is correctly set
var center = map.getCenter();
t.eq(center.lon, 4, "map x");
t.eq(center.lat, 5, "map y")
t.eq(map.getZoom(), 6, "map z");
var params = OpenLayers.Util.getParameters(window.location.hash.replace("#", "?"));
t.eq(params.lon, "4", "x set");
t.eq(params.lat, "5", "y set");
t.eq(params.zoom, "6", "z set");
map.destroy();
window.location.hash = previous;
}
</script>
</head>
<body>

View File

@@ -475,6 +475,35 @@
}
function test_exceptions(t) {
t.plan(1);
var map = new OpenLayers.Map("map", {
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
}
);
var a = new OpenLayers.Layer.WMS("dummy","http://myhost/wms", {
layers: "x",
exceptions: "text/xml"
});
map.addLayer(a);
var click = new OpenLayers.Control.WMSGetFeatureInfo({
});
map.addControl(click);
var _request = OpenLayers.Request.GET;
OpenLayers.Request.GET = function(options) {
t.eq(options.params["EXCEPTIONS"], "text/xml", "Exceptions parameter taken from the WMS layer if provided");
};
click.activate();
click.getInfoForClick({xy: {x: 50, y: 50}});
OpenLayers.Request.GET = _request;
map.destroy();
}
function test_drillDown(t) {
t.plan(6);
var map = new OpenLayers.Map("map", {

74
tests/Control/Zoom.html Normal file
View File

@@ -0,0 +1,74 @@
<!DOCTYPE html>
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_constructor(t) {
t.plan(5);
var control = new OpenLayers.Control.Zoom();
t.ok(control instanceof OpenLayers.Control, "instance of Control");
t.ok(control instanceof OpenLayers.Control.Zoom, "instance of Zoom");
t.eq(control.displayClass, "olControlZoom", "displayClass");
control.destroy();
control = new OpenLayers.Control.Zoom({
zoomInText: "zoom in!",
zoomOutText: "zoom out!"
});
t.eq(control.zoomInText, "zoom in!", "zoomInText");
t.eq(control.zoomOutText, "zoom out!", "zoomOutText");
control.destroy();
}
function test_addControl(t) {
t.plan(2);
var map = new OpenLayers.Map("map");
var control = new OpenLayers.Control.Zoom();
map.addControl(control);
t.ok(control.map === map, "Control.map set");
t.ok(!!~OpenLayers.Util.indexOf(map.controls, control), "map.controls contains control");
map.destroy();
}
function test_zoomIn(t) {
t.plan(2);
var map = new OpenLayers.Map({
div: "map",
layers: [new OpenLayers.Layer(null, {isBaseLayer: true})]
});
var control = new OpenLayers.Control.Zoom();
map.addControl(control);
map.setCenter([0, 0], 0);
t.eq(map.getZoom(), 0, "initial center");
control.events.triggerEvent("buttonclick", {buttonElement: control.zoomInLink});
t.eq(map.getZoom(), 1, "after zoom in");
map.destroy();
}
function test_zoomOut(t) {
t.plan(2);
var map = new OpenLayers.Map({
div: "map",
layers: [new OpenLayers.Layer(null, {isBaseLayer: true})]
});
var control = new OpenLayers.Control.Zoom();
map.addControl(control);
map.setCenter([0, 0], 1);
t.eq(map.getZoom(), 1, "initial center");
control.events.triggerEvent("buttonclick", {buttonElement: control.zoomOutLink});
t.eq(map.getZoom(), 0, "after zoom out");
map.destroy();
}
</script>
</head>
<body>
<div id="map" style="width: 512px; height: 256px;"/>
</body>
</html>

View File

@@ -198,21 +198,35 @@
t.ok(style.t, "getStyle returns copy of style rather than reference");
}
function test_Format_KML_extendedData(t) {
t.plan(2);
t.plan(6);
var f = new OpenLayers.Format.KML();
var features = f.read(OpenLayers.Util.getElement("kml_extendeddata").value);
t.eq(features[0].attributes.all_bridges.value, "3030", "read value from extendeddata correctly.");
t.eq(features[0].attributes.all_bridges.displayName, "all bridges", "read displayName from extendeddata correctly.");
t.eq(features[0].attributes.holeYardage.value, "234", "read value from extendeddata correctly.");
t.eq(features[0].attributes.holeYardage.displayName, "<b><i>The yardage is </i></b>", "read displayName from extendeddata correctly.");
t.eq(f.read(f.write(features[0]))[0].attributes.holeYardage.value, features[0].attributes.holeYardage.value, "attribute value written correctly");
t.eq(f.read(f.write(features[0]))[0].attributes.holeYardage.displayName, features[0].attributes.holeYardage.displayName, "attribute displayName written correctly");
f.kvpAttributes = true;
features = f.read(OpenLayers.Util.getElement("kml_extendeddata").value);
t.eq(features[0].attributes.holeYardage, "234", "read kvp value from extendeddata correctly.");
t.eq(f.read(f.write(features[0]))[0].attributes.holeYardage, features[0].attributes.holeYardage, "kvp attribute value written correctly");
}
function test_Format_KML_extendedData_SchemaData(t) {
t.plan(4);
t.plan(10);
var f = new OpenLayers.Format.KML();
var features = f.read(OpenLayers.Util.getElement("kml_extendeddata2").value);
t.eq(features[0].attributes.TrailHeadName.value, "Pi in the sky", "read value from extendeddata (schema data) correctly.");
t.eq(features[0].attributes.TrailHeadName.displayName, "TrailHeadName", "read displayName from extendeddata correctly");
t.eq(features[0].attributes.ElevationGain.value, "10", "read value from extendeddata (schema data) correctly.");
t.eq(features[0].attributes.ElevationGain.displayName, "ElevationGain", "read displayName from extendeddata correctly");
t.eq(f.read(f.write(features[0]))[0].attributes.TrailHeadName.value, features[0].attributes.TrailHeadName.value, "attribute value from extendeddata (schema data) written correctly");
t.eq(f.read(f.write(features[0]))[0].attributes.ElevationGain.value, features[0].attributes.ElevationGain.value, "attribute value from extendeddata (schema data) written correctly");
f.kvpAttributes = true;
features = f.read(OpenLayers.Util.getElement("kml_extendeddata2").value);
t.eq(features[0].attributes.TrailHeadName, "Pi in the sky", "read kvp value from extendeddata (schema data) correctly.");
t.eq(features[0].attributes.ElevationGain, "10", "read kvp value from extendeddata (schema data) correctly.");
t.eq(f.read(f.write(features[0]))[0].attributes.TrailHeadName, features[0].attributes.TrailHeadName, "kvp attribute value from extendeddata (schema data) written correctly");
t.eq(f.read(f.write(features[0]))[0].attributes.ElevationGain, features[0].attributes.ElevationGain, "kvp attribute value from extendeddata (schema data) written correctly");
}
function test_Format_KML_placemarkName(t) {
@@ -287,49 +301,61 @@
</head>
<body>
<textarea id="kml_extendeddata" style="display:none">
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<Placemark>
<styleUrl>#default</styleUrl>
<ExtendedData>
<Data name='all_bridges'>
<displayName><![CDATA[all bridges]]></displayName>
<value><![CDATA[3030]]></value>
</Data>
<Data name='latitude'>
<displayName><![CDATA[latitude]]></displayName>
<value><![CDATA[43]]></value>
</Data>
<Data name='longitude'>
<displayName><![CDATA[longitude]]></displayName>
<value><![CDATA[-107.55]]></value>
</Data>
<Data name='functionally_obsolete__percent'>
<displayName><![CDATA[functionally obsolete, percent]]></displayName>
<value><![CDATA[8]]></value>
</Data>
<Data name='structurally_deficient__percent'>
<displayName><![CDATA[structurally deficient, percent]]></displayName>
<value><![CDATA[13]]></value>
</Data>
<Data name='state'>
<displayName><![CDATA[state]]></displayName>
<value><![CDATA[Wyoming]]></value>
</Data>
</ExtendedData>
<Point>
<coordinates>-107.55,43.0</coordinates>
</Point>
</Placemark>
</Document>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Entity-Replacement</name>
<Placemark>
<name>Club house</name>
<ExtendedData>
<Data name="holeNumber">
<displayName><![CDATA[
<b>This is hole </b>
]]></displayName>
<value>1</value>
</Data>
<Data name="holePar">
<displayName><![CDATA[
<i>The par for this hole is </i>
]]></displayName>
<value>4</value>
</Data>
<Data name="holeYardage">
<displayName><![CDATA[<b><i>The yardage is </i></b>]]></displayName>
<value>234</value>
</Data>
</ExtendedData>
<Point>
<coordinates>-111.956,33.5043</coordinates>
</Point>
</Placemark>
<Placemark>
<name>By the lake</name>
<ExtendedData>
<Data name="holeNumber">
<displayName><![CDATA[
<b>This is hole </b>
]]></displayName>
<value>5</value>
</Data>
<Data name="holePar">
<displayName><![CDATA[
<i>The par for this hole is </i>
]]></displayName>
<value>5</value>
</Data>
<Data name="holeYardage">
<displayName><![CDATA[
<b><i>The yardage is </i></b>
]]></displayName>
<value>523</value>
</Data>
</ExtendedData>
<Point>
<coordinates>-111.95,33.5024</coordinates>
</Point>
</Placemark>
</Document>
</kml>
</textarea>
<textarea id="kml_extendeddata2" style="display:none">

View File

@@ -41,7 +41,7 @@
// Chromium 10: left is 0
var testdiv = OpenLayers.Util.createDiv('testdiv', new OpenLayers.Pixel(5, 5));
map.div.appendChild(testdiv);
var left = parseInt(OpenLayers.Element.getStyle(testdiv, 'borderLeftWidth'));
var left = parseInt(OpenLayers.Element.getStyle(testdiv, 'border-left-width'));
map.div.removeChild(testdiv);
var testAll = !isNaN(left);

View File

@@ -53,7 +53,8 @@
//initialize the layer using the JSON object from an arcgis server
//SEE: ArcGISCache.json
var layer = new OpenLayers.Layer.ArcGISCache(name, url, {
layerInfo: layerInfo
layerInfo: layerInfo,
params: {foo: "bar"}
});
var map = new OpenLayers.Map('map', {
maxExtent: layer.maxExtent,
@@ -105,7 +106,7 @@
map.zoomToExtent(o.bounds, true);
var resultUrl = layer.getURL(o.bounds);
t.ok( resultUrl == o.url, "correct tile returned for " + o.bounds);
t.ok( resultUrl == o.url + "?foo=bar", "correct tile returned for " + o.bounds);
}
}

View File

@@ -1,6 +1,6 @@
<html>
<head>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false&amp;v=3.6"></script>
<script src="../../OLLoader.js"></script>
<script type="text/javascript">

View File

@@ -32,7 +32,7 @@
t.eq( layer.buffer, 0, "buffer default is 0");
t.eq( layer.ratio, 1.5, "ratio default is 1.5");
t.eq( layer.numLoadingTiles, 0, "numLoadingTiles starts at 0");
t.eq( layer.tileClass, OpenLayers.Tile.Image, "tileClass default is OpenLayers.Tile.Image");
t.ok( layer.tileClass === OpenLayers.Tile.Image, "tileClass default is OpenLayers.Tile.Image");
var obj = {};
var func = function() {};
@@ -63,7 +63,7 @@
});
map.addLayer(layer);
t.eq(layer.tileClass, myTileClass, "tileClass is set");
t.ok(layer.tileClass === myTileClass, "tileClass is set");
var instance = layer.addTile(new OpenLayers.Bounds(-10, 10, 50, 100),
new OpenLayers.Pixel(10, 12));
@@ -506,7 +506,7 @@
}
function test_Layer_Grid_addTileMonitoringHooks(t) {
t.plan(15);
t.plan(17);
layer = new OpenLayers.Layer.Grid();
layer.events = {
@@ -519,6 +519,13 @@
events: {
register: function(name, obj, func) {
g_registered[name] = [obj, func];
},
on: function(obj) {
for (var o in obj) {
if (obj.hasOwnProperty(o)) {
tile.events.register(o, obj.scope, obj[o]);
}
}
}
}
}
@@ -551,6 +558,11 @@
entry = g_registered["loadend"];
t.ok( entry && entry[0] == layer && entry[1] == tile.onLoadEnd, "loadend correctly registered");
g_events = [];
tile.onLoadError.apply(layer);
t.eq(g_events[0][0], "tileerror", "tileerror triggered");
t.ok(g_events[0][1].tile === tile, "tile passed as tile property to event object");
layer.numLoadingTiles = 2;
g_events = [];
tile.onLoadEnd.apply(layer);

View File

@@ -12,7 +12,7 @@
var options = { chicken: 151, foo: "bar" };
function test_Layer_HTTPRequest_constructor (t) {
t.plan( 5 );
t.plan( 6 );
layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
@@ -28,7 +28,10 @@
(layer.params["layers"] == "basic") &&
(layer.params["format"] == "image/png")), "layer.params correctly set" );
layer = new OpenLayers.Layer.HTTPRequest(name, url, null, {params: params});
t.ok( ((layer.params["map"] == '/mapdata/vmap_wms.map') &&
(layer.params["layers"] == "basic") &&
(layer.params["format"] == "image/png")), "layer.params correctly set from options" );
}
function test_Layer_HTTPRequest_clone (t) {

View File

@@ -6,7 +6,7 @@
function test_initialize(t) {
t.plan(3);
var protocol = new OpenLayers.Protocol.CSW({formatOptions: {foo: "bar"},});
var protocol = new OpenLayers.Protocol.CSW({formatOptions: {foo: "bar"}});
t.ok(protocol instanceof OpenLayers.Protocol.CSW.v2_0_2,
"initialize returns instance of default versioned protocol");
var format = protocol.format;

View File

@@ -79,7 +79,9 @@
// test extent changes
var extent = new OpenLayers.Bounds(4,3,2,1);
r.setExtent(extent);
t.eq(r.root.getAttributeNS(null, "transform").replace(/ /g, ""), "translate(-6,-6)", "rendererRoot viewBox is correct after a new setExtent");
var el = r.createNode("g");
el.setAttributeNS(null, "transform", "translate(-6,-6)");
t.eq(r.root.getAttributeNS(null, "transform"), el.getAttributeNS(null, "transform"), "rendererRoot viewBox is correct after a new setExtent");
OpenLayers.Renderer.Elements.prototype.setExtent =
OpenLayers.Renderer.Elements.prototype._setExtent;

View File

@@ -141,7 +141,7 @@ Test.AnotherWay.quicksearch = function(){
Test.AnotherWay.filterTestList = function(str){
Test.AnotherWay.unfilterTestList();
var re = new RegExp(str, 'i');
var candidates = document.querySelectorAll('#testtable tr td:nth-child(2) a');
var candidates = document.querySelectorAll('#testtable tr a');
for (var idx = 0, len = candidates.length; idx<len; idx++) {
var tr = candidates[idx].parentNode.parentNode;
var html = candidates[idx].innerHTML;
@@ -164,10 +164,10 @@ Test.AnotherWay.unfilterTestList = function() {
};
// bind our quicksearch init method to body onload.
(function(win){
(function(win) {
if (win.addEventListener) {
win.addEventListener('load', Test.AnotherWay.bindQuicksearchListener);
} else if (input.attachEvent) {
} else if (win.attachEvent) {
win.attachEvent('onload', Test.AnotherWay.bindQuicksearchListener);
} else {
win.onload = function(){

View File

@@ -375,7 +375,7 @@
// test for https://github.com/openlayers/openlayers/pull/36
// (more an integration test than a unit test)
function test_olImageLoadError(t) {
t.plan(2);
t.plan(6);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS("invalid", "", {layers: 'basic'});
@@ -386,10 +386,25 @@
var bounds = new OpenLayers.Bounds(1, 2, 3, 4);
var tile = new OpenLayers.Tile.Image(layer, position, bounds, null, size);
var log = [];
tile.events.register("loaderror", this, function(e) {
log.push([
e.object.imgDiv.style.visibility,
OpenLayers.Element.hasClass(e.object.imgDiv, 'olImageLoadError')
]);
});
tile.events.register("loadend", this, function(e) {
log.push(e);
})
tile.draw();
t.delay_call(0.1, function() {
t.eq(log.length, 2, "loaderror and loadend events triggered");
t.eq(log[0][0], "hidden", "tile still hidden when loaderror is triggered");
t.eq(log[0][1], true, "tile has olImageLoadError class already when loaderror is triggered");
t.ok(log[1].object === tile, "loadend event triggered after loaderror");
// check initial state
t.ok(OpenLayers.Element.hasClass(tile.imgDiv, 'olImageLoadError'),
'tile image has the olImageLoadError class (init state)');

View File

@@ -7,7 +7,7 @@
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
var isIE = (navigator.userAgent.indexOf("MSIE") != -1);
var isIElt9 = (parseFloat(navigator.appVersion.split("MSIE")[1]) < 9);
var map, layer;
var position = new OpenLayers.Pixel(20,30);
@@ -96,17 +96,17 @@
var eventPane = tile.frame.childNodes[0];
t.ok(OpenLayers.String.contains(eventPane.style.backgroundImage,
tile.blankImageUrl),
tile._blankImageUrl),
"backgroundImage of eventPane is set.");
t.eq(parseInt(eventPane.style.zIndex, 10), 1, "zIndex of eventPane is set.");
if(isIE) {
if(isIElt9) {
t.ok(iFrame != null, "IFrame successfully created.");
t.eq(iFrame.style.backgroundColor, '#ffffff', "backgroundColor correctly set.");
t.eq(iFrame.style.filter, 'chroma(color=#FFFFFF)', "filter correctly set.");
} else {
t.ok(iFrame instanceof HTMLElement, "IFrame successfully created.");
t.ok(true, 'Skip IFrame backgroundColor test outside IE');
t.ok(true, 'Skip IFrame filter test outside IE');
t.ok(true, 'Skip IFrame backgroundColor test outside IE < 9');
t.ok(true, 'Skip IFrame filter test outside IE < 9');
}
t.eq( iFrame.scrolling, 'no', "no scrolling");
t.eq( parseFloat(iFrame.marginWidth), 0, "no margin width");

View File

@@ -1,5 +1,20 @@
<html>
<head>
<script>
/**
* Because browsers that implement requestAnimationFrame may not execute
* animation functions while a window is not displayed (e.g. in a hidden
* iframe as in these tests), we mask the native implementations here. The
* native requestAnimationFrame functionality is tested in Util.html and
* in PanZoom.html (where a popup is opened before panning). The panTo tests
* here will test the fallback setTimeout implementation for animation.
*/
window.requestAnimationFrame =
window.webkitRequestAnimationFrame =
window.mozRequestAnimationFrame =
window.oRequestAnimationFrame =
window.msRequestAnimationFrame = null;
</script>
<script src="OLLoader.js"></script>
<script type="text/javascript">

View File

@@ -1121,6 +1121,30 @@
t.eq(OpenLayers.Util.getFormattedLonLat(181, "lon"), "179°00'00\"W", "crossing dateline from the east results in correct west coordinate");
}
/**
* To test that we can safely call OpenLayers.Util.extend with an Event
* instance, we need to capture a real event.
*/
var loadEvent;
window.onload = function(evt) {
loadEvent = evt || window.event;
}
function test_extend_event(t) {
t.plan(2);
t.ok(loadEvent, "loadEvent recorded");
var extended, err;
try {
extended = OpenLayers.Util.extend({foo: "bar"}, loadEvent);
} catch (e) {
err = e;
}
if (err) {
t.fail("Failed to extend with an event: " + err.message);
} else {
t.eq(extended && extended.foo, "bar", "extended with event");
}
}
</script>
</head>
<body>

View File

@@ -1,40 +0,0 @@
<html>
<head>
<script src="../../OLLoader.js"></script>
<script src="../../../lib/deprecated.js"></script>
<script type="text/javascript">
function test_String_camelize(t) {
t.plan(7);
var str = "chickenhead";
t.eq(OpenLayers.String.camelize(str), "chickenhead", "string with no hyphens is left alone");
str = "chicken-head";
t.eq(OpenLayers.String.camelize(str), "chickenHead", "string with one middle hyphen is camelized correctly");
str = "chicken-head-man";
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens is camelized correctly");
str = "-chickenhead";
t.eq(OpenLayers.String.camelize(str), "Chickenhead", "string with starting hyphen is camelized correctly (capitalized)");
str = "-chicken-head-man";
t.eq(OpenLayers.String.camelize(str), "ChickenHeadMan", "string with starting hypen and multiple middle hyphens is camelized correctly");
str = "chicken-";
t.eq(OpenLayers.String.camelize(str), "chicken", "string ending in hyphen is camelized correctly (hyphen dropped)");
str = "chicken-head-man-";
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens and end hyphen is camelized correctly (end hyphen dropped)");
}
</script>
</head>
<body>
</body>
</html>

View File

@@ -1,40 +0,0 @@
<html>
<head>
<script src="../../OLLoader.js"></script>
<script src="../../../lib/deprecated.js"></script>
<script type="text/javascript">
function test_String_camelize(t) {
t.plan(7);
var str = "chickenhead";
t.eq(OpenLayers.String.camelize(str), "chickenhead", "string with no hyphens is left alone");
str = "chicken-head";
t.eq(OpenLayers.String.camelize(str), "chickenHead", "string with one middle hyphen is camelized correctly");
str = "chicken-head-man";
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens is camelized correctly");
str = "-chickenhead";
t.eq(OpenLayers.String.camelize(str), "Chickenhead", "string with starting hyphen is camelized correctly (capitalized)");
str = "-chicken-head-man";
t.eq(OpenLayers.String.camelize(str), "ChickenHeadMan", "string with starting hypen and multiple middle hyphens is camelized correctly");
str = "chicken-";
t.eq(OpenLayers.String.camelize(str), "chicken", "string ending in hyphen is camelized correctly (hyphen dropped)");
str = "chicken-head-man-";
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens and end hyphen is camelized correctly (end hyphen dropped)");
}
</script>
</head>
<body>
</body>
</html>

View File

@@ -31,6 +31,7 @@
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0];
tile.draw(true); // the tile queue defers the drawing
t.eq( tile.bounds.left, -22.5, "left side matches" );
t.eq( tile.bounds.right, -11.25, "top side matches" );
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );

View File

@@ -31,6 +31,7 @@
map.addLayer(wmslayer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = wmslayer.grid[0][0];
tile.draw(true); // the tile queue defers the drawing
t.eq( tile.bounds.left, -22.5, "left side matches" );
t.eq( tile.bounds.right, -11.25, "right side matches" );
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );

View File

@@ -45,6 +45,7 @@
<li>Control/WMTSGetFeatureInfo.html</li>
<li>Control/PanPanel.html</li>
<li>Control/SLDSelect.html</li>
<li>Control/Zoom.html</li>
<li>Events.html</li>
<li>Events/buttonclick.html</li>
<li>Extras.html</li>
@@ -225,7 +226,6 @@
<li>deprecated/Ajax.html</li>
<li>deprecated/BaseTypes/Class.html</li>
<li>deprecated/BaseTypes/Element.html</li>
<li>deprecated/BaseTypes/String.html</li>
<li>deprecated/Control/MouseToolbar.html</li>
<li>deprecated/Geometry/Rectangle.html</li>
<li>deprecated/Layer/GML.html</li>

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="../../examples/style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false&amp;v=3.6"></script>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map;

View File

@@ -20,7 +20,7 @@
padding: 0 0.5em 0.5em 0.5em;
}
</style>
<script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../../lib/OpenLayers.js"></script>
</head>
<body>

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="../../examples/style.css" type="text/css">
<script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?v=3.6&amp;sensor=false"></script>
<script src="../../lib/OpenLayers.js"></script>
</head>
<body onload="init()">

View File

@@ -3,7 +3,7 @@
<title>Google v3 Resize Test</title>
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="../../examples/style.css" type="text/css" />
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false&amp;v=3.6"></script>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map;

View File

@@ -429,6 +429,43 @@ span.olGoogleAttribution.hybrid a, span.olGoogleAttribution.satellite a {
background-position: -26px -24px;
}
div.olControlZoom {
position: absolute;
top: 8px;
left: 8px;
}
div.olControlZoom a {
display: block;
margin: 2px;
padding: 0 4px;
color: white;
font-size: 18px;
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
font-weight: bold;
text-decoration: none;
text-align: center;
height: 22px;
width: 15px;
line-height: 22px;
background: #666666; /* fallback for IE - IE6 requires background shorthand*/
background: rgba(0, 0, 0, 0.3);
border: 1px solid;
border-color: #ffffff; /* fallback for IE */
border-color: rgba(255, 255, 255, 0.6);
filter: alpha(opacity=60);
}
div.olControlZoom a:hover {
background: #444444; /* fallback for IE */
background: rgba(0, 0, 0, 0.5);
filter: alpha(opacity=80);
}
a.olControlZoomIn {
border-radius: 5px 5px 0 0;
}
a.olControlZoomOut {
border-radius: 0 0 5px 5px;
}
/**
* Animations
*/