This commit is contained in:
Gregers Gram Rygg
2012-05-22 17:11:40 +02:00
14 changed files with 118 additions and 39 deletions

28
examples/mapquest.html Normal file
View File

@@ -0,0 +1,28 @@
<!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 MapQuest Demo</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<h1 id="title">OpenLayers with MapQuest Tiles</h1>
<div id="shortdesc">
This example demonstrates the use of MapQuest tiles with OpenLayers.
</div>
<div id="tags">
MapQuest, OSM, XYZ
</div>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
See the <a href="mapquest.js" target="_blank">mapquest.js source</a> for
detail on using MapQuest tiles in OpenLayers.
</p>
</div>
<script src="../lib/OpenLayers.js"></script>
<script src="mapquest.js"></script>
</body>

36
examples/mapquest.js Normal file
View File

@@ -0,0 +1,36 @@
var map = new OpenLayers.Map({
div: "map",
projection: "EPSG:900913",
layers: [
new OpenLayers.Layer.XYZ(
"OpenStreetMap",
[
"http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
"http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
"http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
"http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"
],
{
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize"
}
),
new OpenLayers.Layer.XYZ(
"Imagery",
[
"http://oatile1.mqcdn.com/naip/${z}/${x}/${y}.png",
"http://oatile2.mqcdn.com/naip/${z}/${x}/${y}.png",
"http://oatile3.mqcdn.com/naip/${z}/${x}/${y}.png",
"http://oatile4.mqcdn.com/naip/${z}/${x}/${y}.png"
],
{
attribution: "Tiles Courtesy of <a href='http://open.mapquest.co.uk/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png' border='0'>",
transitionEffect: "resize"
}
)
],
center: [0, 0],
zoom: 1
});
map.addControl(new OpenLayers.Control.LayerSwitcher());

View File

@@ -414,4 +414,4 @@
/**
* Constant: VERSION_NUMBER
*/
OpenLayers.VERSION_NUMBER="Release 2.12-rc3";
OpenLayers.VERSION_NUMBER="Release 2.12-rc4";

View File

@@ -13,7 +13,7 @@
/**
* Class: OpenLayers.Format.ArcXML
* Read/Wite ArcXML. Create a new instance with the <OpenLayers.Format.ArcXML>
* Read/Write ArcXML. Create a new instance with the <OpenLayers.Format.ArcXML>
* constructor.
*
* Inherits from:

View File

@@ -9,7 +9,7 @@
/**
* Class: OpenLayers.Format.ArcXML.Features
* Read/Wite ArcXML features. Create a new instance with the
* Read/Write ArcXML features. Create a new instance with the
* <OpenLayers.Format.ArcXML.Features> constructor.
*
* Inherits from:

View File

@@ -12,7 +12,7 @@
/**
* Class: OpenLayers.Format.Filter
* Read/Wite ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>
* Read/Write ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>
* constructor.
*
* Inherits from:

View File

@@ -16,7 +16,7 @@
/**
* Class: OpenLayers.Format.GML
* Read/Wite GML. Create a new instance with the <OpenLayers.Format.GML>
* Read/Write GML. Create a new instance with the <OpenLayers.Format.GML>
* constructor. Supports the GML simple features profile.
*
* Inherits from:

View File

@@ -15,7 +15,7 @@
/**
* Class: OpenLayers.Format.SLD
* Read/Wite SLD. Create a new instance with the <OpenLayers.Format.SLD>
* Read/Write SLD. Create a new instance with the <OpenLayers.Format.SLD>
* constructor.
*
* Inherits from:

View File

@@ -9,7 +9,7 @@
/**
* Class: OpenLayers.Format.XLS
* Read/Wite XLS (OpenLS). Create a new instance with the <OpenLayers.Format.XLS>
* Read/Write XLS (OpenLS). Create a new instance with the <OpenLayers.Format.XLS>
* constructor. Currently only implemented for Location Utility Services, more
* specifically only for Geocoding. No support for Reverse Geocoding as yet.
*

View File

@@ -139,7 +139,8 @@ OpenLayers.Handler = OpenLayers.Class({
var keyModifiers =
(evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |
(evt.ctrlKey ? OpenLayers.Handler.MOD_CTRL : 0) |
(evt.altKey ? OpenLayers.Handler.MOD_ALT : 0);
(evt.altKey ? OpenLayers.Handler.MOD_ALT : 0) |
(evt.metaKey ? OpenLayers.Handler.MOD_META : 0);
/* if it differs from the handler object's key mask,
bail out of the event handler */
@@ -232,12 +233,12 @@ OpenLayers.Handler = OpenLayers.Class({
* to get more information about the event that the handler is
* processing.
*
* This allows modifier keys on the event to be checked (alt, shift,
* and ctrl cannot be checked with the keyboard handler). For a
* This allows modifier keys on the event to be checked (alt, shift, ctrl,
* and meta cannot be checked with the keyboard handler). For a
* control to determine which modifier keys are associated with the
* event that a handler is currently processing, it should access
* (code)handler.evt.altKey || handler.evt.shiftKey ||
* handler.evt.ctrlKey(end).
* handler.evt.ctrlKey || handler.evt.metaKey(end).
*
* Parameters:
* evt - {Event} The browser event.
@@ -285,4 +286,10 @@ OpenLayers.Handler.MOD_CTRL = 2;
*/
OpenLayers.Handler.MOD_ALT = 4;
/**
* Constant: OpenLayers.Handler.MOD_META
* If set as the <keyMask>, <checkModifiers> returns false if Cmd is down.
*/
OpenLayers.Handler.MOD_META = 8;

View File

@@ -137,27 +137,31 @@ OpenLayers.Layer.Google.v3 = {
var cache = OpenLayers.Layer.Google.cache[this.map.id];
var container = this.map.viewPortDiv;
// move the Map Data popup to the container, if any
while (div.lastChild.style.display == "none") {
container.appendChild(div.lastChild);
}
// move the ToS and branding stuff up to the container div
var termsOfUse = div.lastChild;
container.appendChild(termsOfUse);
termsOfUse.style.zIndex = "1100";
termsOfUse.style.bottom = "";
termsOfUse.className = "olLayerGoogleCopyright olLayerGoogleV3";
termsOfUse.style.display = "";
cache.termsOfUse = termsOfUse;
var poweredBy = div.lastChild;
container.appendChild(poweredBy);
poweredBy.style.zIndex = "1100";
poweredBy.style.bottom = "";
poweredBy.className = "olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";
poweredBy.style.display = "";
cache.poweredBy = poweredBy;
// depends on value of zIndex, which is not robust
for (var i=div.children.length-1; i>=0; --i) {
if (div.children[i].style.zIndex == 1000001) {
var termsOfUse = div.children[i];
container.appendChild(termsOfUse);
termsOfUse.style.zIndex = "1100";
termsOfUse.style.bottom = "";
termsOfUse.className = "olLayerGoogleCopyright olLayerGoogleV3";
termsOfUse.style.display = "";
cache.termsOfUse = termsOfUse;
}
if (div.children[i].style.zIndex == 1000000) {
var poweredBy = div.children[i];
container.appendChild(poweredBy);
poweredBy.style.zIndex = "1100";
poweredBy.style.bottom = "";
poweredBy.className = "olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";
poweredBy.style.display = "";
cache.poweredBy = poweredBy;
}
if (div.children[i].style.zIndex == 10000002) {
container.appendChild(div.children[i]);
}
}
this.setGMapVisibility(this.visibility);

View File

@@ -449,7 +449,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
*/
createRenderRoot: function() {
var svg = this.nodeFactory(this.container.id + "_svgRoot", "svg");
svg.style.position = "absolute";
svg.style.display = "block";
return svg;
},

View File

@@ -7,7 +7,7 @@ var OpenLayers = {
/**
* Constant: VERSION_NUMBER
*/
VERSION_NUMBER: "Release 2.12-rc3",
VERSION_NUMBER: "Release 2.12-rc4",
/**
* Constant: singleFile

View File

@@ -123,7 +123,7 @@
}
function test_Handler_setEvent(t) {
t.plan(4);
t.plan(5);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
map.addControl(control);
@@ -135,7 +135,8 @@
xy: new OpenLayers.Pixel(Math.random(), Math.random()),
altKey: (Math.random() > 0.5),
shiftKey: (Math.random() > 0.5),
ctrlKey: (Math.random() > 0.5)
ctrlKey: (Math.random() > 0.5),
metaKey: (Math.random() > 0.5)
}
map.events.triggerEvent("click", testEvent);
t.ok(handler.evt.xy.x == testEvent.xy.x &&
@@ -147,6 +148,8 @@
"handler.evt.shiftKey correct");
t.eq(handler.evt.ctrlKey, testEvent.ctrlKey,
"handler.evt.ctrlKey correct");
t.eq(handler.evt.metaKey, testEvent.metaKey,
"handler.evt.metaKey correct");
}
function test_Handler_destroy(t) {
@@ -173,7 +176,7 @@
}
function test_Handler_checkModifiers(t) {
t.plan(26);
t.plan(62);
var handler = new OpenLayers.Handler({});
handler.keyMask = null;
var proceed = handler.checkModifiers({});
@@ -192,7 +195,8 @@
MOD_NONE: null,
MOD_SHIFT: "shiftKey",
MOD_CTRL: "ctrlKey",
MOD_ALT: "altKey"
MOD_ALT: "altKey",
MOD_META: "metaKey"
}
var proceed, evt, value, c, k;
for(c in constants) {
@@ -220,8 +224,8 @@
* is OpenLayers.Handler.MOD_SHIFT, checkModifiers should return
* true.
*/
var constants = ["MOD_SHIFT", "MOD_CTRL", "MOD_ALT"];
var keys = ["shiftKey", "ctrlKey", "altKey"];
var constants = ["MOD_SHIFT", "MOD_CTRL", "MOD_ALT", "MOD_META"];
var keys = ["shiftKey", "ctrlKey", "altKey", "metaKey"];
var proceed, evt, c1, c2, k1, k2;
for(var i=0; i<constants.length-1; ++i) {
c1 = constants[i];