Skip to content

Commit cffcbb4

Browse files
committed
Revert "Use an OSM layer instead of TMS with a custom getURL. Non functional change."
This reverts commit 00adfc7.
1 parent 00adfc7 commit cffcbb4

23 files changed

+211
-606
lines changed

authors.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
ahocevar = ahocevar <[email protected]>
2+
bartvde = bartvde <[email protected]>
3+
crschmidt = crschmidt <[email protected]>
4+
elemoine = Éric Lemoine <[email protected]>
5+
erilem = Éric Lemoine <[email protected]>
6+
euzuro = euzuro <USER@DOMAIN>
7+
follower = follower <USER@DOMAIN>
8+
fredj = Frédéric Junod <[email protected]>
9+
jrf = jrf <USER@DOMAIN>
10+
pagameba = Paul Spencer <[email protected]>
11+
pgiraud = pgiraud <[email protected]>
12+
sderle = Schuyler Erle <[email protected]>
13+
tschaub = Tim Schaub <[email protected]>

build/full.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
[first]
55
OpenLayers/SingleFile.js
6+
OpenLayers.js
67
OpenLayers/BaseTypes.js
78
OpenLayers/BaseTypes/Class.js
89
OpenLayers/Util.js
@@ -14,5 +15,4 @@ Rico/Corner.js
1415

1516
[exclude]
1617
Firebug
17-
OpenLayers.js
1818
OpenLayers/Lang

build/library.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
[first]
66
OpenLayers/SingleFile.js
7+
OpenLayers.js
78
OpenLayers/BaseTypes.js
89
OpenLayers/BaseTypes/Class.js
910
OpenLayers/Util.js
@@ -15,7 +16,6 @@ Rico/Corner.js
1516

1617
[exclude]
1718
Firebug
18-
OpenLayers.js
1919
OpenLayers/Format/GeoRSS.js
2020
OpenLayers/Format/GML.js
2121
OpenLayers/Format/WKT.js

build/lite.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
[first]
88
OpenLayers/SingleFile.js
9+
OpenLayers.js
910
OpenLayers/BaseTypes.js
1011
OpenLayers/BaseTypes/Class.js
1112
OpenLayers/Util.js

examples/Jugl.js

Lines changed: 81 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/donut.html

Lines changed: 0 additions & 59 deletions
This file was deleted.

examples/donut.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

examples/example-list.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
<script type="text/javascript" src="Jugl.js"></script>
9999
<script type="text/javascript" src="example-list.js"></script>
100100
<script type="text/javascript">
101+
// import
102+
var Jugl = window["http://jugl.tschaub.net/trunk/lib/Jugl.js"];
101103
var template, target;
102104

103105
function listExamples(examples) {
@@ -199,7 +201,7 @@
199201
}
200202
}
201203
window.onload = function() {
202-
template = new jugl.Template("template");
204+
template = new Jugl.Template("template");
203205
target = document.getElementById("examples");
204206
listExamples(info.examples);
205207
document.getElementById("exwin").src = "../examples/example.html";

examples/strategy-cluster.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<script src="animator.js"></script>
6767
<script type="text/javascript">
6868
var map, template;
69+
var Jugl = window["http://jugl.tschaub.net/trunk/lib/Jugl.js"];
6970
OpenLayers.ProxyHost = (window.location.host == "localhost") ?
7071
"/cgi-bin/proxy.cgi?url=" : "proxy.cgi?url=";
7172

@@ -134,7 +135,7 @@
134135
map.setCenter(new OpenLayers.LonLat(0, 0), 1);
135136

136137
// template setup
137-
template = new jugl.Template("template");
138+
template = new Jugl.Template("template");
138139

139140
}
140141

examples/sundials-spherical-mercator.html

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@
3131
20037508.34, 20037508.34)
3232
};
3333
map = new OpenLayers.Map('map', options);
34-
var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");
34+
var mapnik = new OpenLayers.Layer.TMS(
35+
"OpenStreetMap (Mapnik)",
36+
"http://tile.openstreetmap.org/",
37+
{
38+
type: 'png', getURL: osm_getTileURL,
39+
displayOutsideMaxExtent: true,
40+
attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>'
41+
}
42+
);
3543
var gmap = new OpenLayers.Layer.Google("Google", {sphericalMercator:true});
3644
var sundials = new OpenLayers.Layer.Vector("KML", {
3745
projection: map.displayProjection,
@@ -88,6 +96,20 @@
8896
delete feature.popup;
8997
}
9098
}
99+
function osm_getTileURL(bounds) {
100+
var res = this.map.getResolution();
101+
var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
102+
var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
103+
var z = this.map.getZoom();
104+
var limit = Math.pow(2, z);
105+
106+
if (y < 0 || y >= limit) {
107+
return OpenLayers.Util.getImagesLocation() + "404.png";
108+
} else {
109+
x = ((x % limit) + limit) % limit;
110+
return this.url + z + "/" + x + "/" + y + "." + this.type;
111+
}
112+
}
91113
</script>
92114
</head>
93115
<body onload="init()">

lib/OpenLayers.js

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,62 @@
77
* @requires OpenLayers/BaseTypes.js
88
* @requires OpenLayers/Lang/en.js
99
* @requires OpenLayers/Console.js
10-
*/
11-
12-
/*
13-
* TODO: In 3.0, we will stop supporting build profiles that include
14-
* OpenLayers.js. This means we will not need the singleFile and scriptFile
15-
* variables, because we don't have to handle the singleFile case any more.
16-
*/
10+
*/
1711

1812
(function() {
1913
/**
2014
* Before creating the OpenLayers namespace, check to see if
2115
* OpenLayers.singleFile is true. This occurs if the
2216
* OpenLayers/SingleFile.js script is included before this one - as is the
23-
* case with old single file build profiles that included both
24-
* OpenLayers.js and OpenLayers/SingleFile.js.
17+
* case with single file builds.
2518
*/
2619
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
2720

2821
/**
29-
* Relative path of this script.
22+
* Cache for the script location returned from
23+
* OpenLayers._getScriptLocation
3024
*/
31-
var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";
25+
var scriptLocation;
3226

3327
/**
3428
* Namespace: OpenLayers
3529
* The OpenLayers object provides a namespace for all things OpenLayers
3630
*/
3731
window.OpenLayers = {
32+
33+
/**
34+
* Property: _scriptName
35+
* {String} Relative path of this script.
36+
*/
37+
_scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",
38+
3839
/**
39-
* Method: _getScriptLocation
40-
* Return the path to this script. This is also implemented in
41-
* OpenLayers/SingleFile.js
40+
* Function: _getScriptLocation
41+
* Return the path to this script.
4242
*
4343
* Returns:
4444
* {String} Path to this script
4545
*/
46-
_getScriptLocation: (function() {
47-
var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)");
48-
var s = document.getElementsByTagName('script');
49-
var m = s[s.length-1].getAttribute("src").match(r);
50-
var l = m ? m[1] : "";
51-
return (function() { return l; });
52-
})()
46+
_getScriptLocation: function () {
47+
if (scriptLocation != undefined) {
48+
return scriptLocation;
49+
}
50+
scriptLocation = "";
51+
var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
52+
53+
var scripts = document.getElementsByTagName('script');
54+
for (var i=0, len=scripts.length; i<len; i++) {
55+
var src = scripts[i].getAttribute('src');
56+
if (src) {
57+
var match = src.match(isOL);
58+
if(match) {
59+
scriptLocation = match[1];
60+
break;
61+
}
62+
}
63+
}
64+
return scriptLocation;
65+
}
5366
};
5467
/**
5568
* OpenLayers.singleFile is a flag indicating this file is being included
@@ -60,7 +73,7 @@
6073
*
6174
* When we *are* part of a SFL build we do not dynamically include the
6275
* OpenLayers library code as it will be appended at the end of this file.
63-
*/
76+
*/
6477
if(!singleFile) {
6578
var jsfiles = new Array(
6679
"OpenLayers/Util.js",

lib/OpenLayers/Control.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ OpenLayers.Control = OpenLayers.Class({
343343
this.displayClass.replace(/ /g, "") + "Active"
344344
);
345345
}
346-
this.events.triggerEvent("deactivate");
346+
// deal with the case where the control is destroyed
347+
if(this.events) {
348+
this.events.triggerEvent("deactivate");
349+
}
347350
return true;
348351
}
349352
return false;

lib/OpenLayers/Control/GetFeature.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
207207
*
208208
* Parameters:
209209
* options - {Object} A configuration object which at least has to contain
210-
* a <protocol> property (if not, it has to be set before a request is
211-
* made)
210+
* a <protocol> property
212211
*/
213212
initialize: function(options) {
214213
// concatenate events specific to vector with those from the base

lib/OpenLayers/Control/Panel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, {
9595
* APIMethod: destroy
9696
*/
9797
destroy: function() {
98+
this.deactivate();
9899
OpenLayers.Control.prototype.destroy.apply(this, arguments);
99100
for(var i = this.controls.length - 1 ; i >= 0; i--) {
100101
if(this.controls[i].events) {

0 commit comments

Comments
 (0)