Compare commits
80 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48445f0878 | ||
|
|
a0cd93cb41 | ||
|
|
0a01ef899e | ||
|
|
5987d5ea33 | ||
|
|
b5153746f6 | ||
|
|
fb663b5127 | ||
|
|
1f9cb14069 | ||
|
|
6fe0826a54 | ||
|
|
e61545167d | ||
|
|
d564f2da47 | ||
|
|
5320cd290c | ||
|
|
a50b175b66 | ||
|
|
739b821570 | ||
|
|
82f786c630 | ||
|
|
eb783aab37 | ||
|
|
a668730ec1 | ||
|
|
3aca63eabe | ||
|
|
7ca9d2ec83 | ||
|
|
0500b9cba2 | ||
|
|
581df4e5f1 | ||
|
|
a7da80c24b | ||
|
|
00dfc669d2 | ||
|
|
2ed1ce98b3 | ||
|
|
9f0b0e0ed7 | ||
|
|
f6a50a37fc | ||
|
|
deaebf8733 | ||
|
|
a6ff5584ad | ||
|
|
402021f24f | ||
|
|
abfbe30b2b | ||
|
|
a98ee2580d | ||
|
|
426e1cf2f9 | ||
|
|
e31c7aaf0b | ||
|
|
6e9ba61679 | ||
|
|
6ddeb07e90 | ||
|
|
2408752e27 | ||
|
|
39536e788a | ||
|
|
e2378ad68a | ||
|
|
44819f20e8 | ||
|
|
6a2fa9aaf1 | ||
|
|
ea9a6a6a23 | ||
|
|
4847d66d6a | ||
|
|
c4541115f9 | ||
|
|
d500981f09 | ||
|
|
8e51ada8de | ||
|
|
633e31da36 | ||
|
|
c1779d1520 | ||
|
|
29d6d8f017 | ||
|
|
f56dab0644 | ||
|
|
2ec05163ed | ||
|
|
1e8c8e8404 | ||
|
|
cd21f42dab | ||
|
|
1459ac5de9 | ||
|
|
484fc207cf | ||
|
|
cfd7858861 | ||
|
|
17581c714d | ||
|
|
1a12d90455 | ||
|
|
7035551fcf | ||
|
|
b11580aca3 | ||
|
|
b8f4577a78 | ||
|
|
4df6b8aa2b | ||
|
|
d2601b3684 | ||
|
|
1a0cbdfd25 | ||
|
|
9956bffe71 | ||
|
|
24047ee512 | ||
|
|
07d39aca00 | ||
|
|
7ae04f7423 | ||
|
|
d8d2b225e4 | ||
|
|
5952a7e3af | ||
|
|
8d1fe36b0f | ||
|
|
fa3b3a3d0c | ||
|
|
36ec579e39 | ||
|
|
b1cfe16347 | ||
|
|
9d3aea6a2f | ||
|
|
a90c976375 | ||
|
|
08981babaa | ||
|
|
3623889f3a | ||
|
|
1bb0952c68 | ||
|
|
d28f293cd9 | ||
|
|
5ffbe842c2 | ||
|
|
0da9f792c7 |
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
rm ../doc/reference.html
|
rm ../doc/reference.html
|
||||||
CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MouseToolbar Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util"
|
CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MouseToolbar Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds"
|
||||||
echo "<html>
|
echo "<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OpenLayers Class Reference Documentation</title>
|
<title>OpenLayers Class Reference Documentation</title>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
OpenLayers.Control.MouseToolbar
|
OpenLayers.Control.MouseToolbar
|
||||||
|
|
||||||
Control to set up mouse handling. This includes clicks, double clicks, scrollwheel events, and mouse movement. There are a number of functions which act as the default handlers for these events: if you wish to create your own mouse control which behaves differently, you should create a subclass of MouseToolbar, replacing the functions whose behavior you wish to change. Additionally, a toolbar of images can be clicked to start events, as well as using the keyboard shortcuts. Note that if you wish to use the MouseToolbar, you *must* add a 'controls' option to the map constructor, otherwise you will have both MouseDefaults and MouseToolbar on the map, which will not work.
|
Control to set up mouse handling. This includes clicks, double clicks, scrollwheel events, and mouse movement. There are a number of functions which act as the default handlers for these events: if you wish to create your own mouse control which behaves differently, you should create a subclass of MouseToolbar, replacing the functions whose behavior you wish to change. Additionally, a toolbar of images can be clicked to start events, as well as using the keyboard shortcuts.
|
||||||
|
|
||||||
* Constructor
|
* Constructor
|
||||||
OpenLayers.Control.MouseToolbar({OpenLayers.Pixel|position}, {String|direction}) -- Creates a new control. The direction of the control can be either "vertical" or "horizontal". The default is vertical.
|
OpenLayers.Control.MouseToolbar({OpenLayers.Pixel|position}, {String|direction}) -- Creates a new control. The direction of the control can be either "vertical" or "horizontal". The default is vertical.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ of different layers.
|
|||||||
clone() -- {OpenLayers.Layer} -- create a clone of the layer.
|
clone() -- {OpenLayers.Layer} -- create a clone of the layer.
|
||||||
setName({String|name}) -- none -- Set the name of the layer to something different.
|
setName({String|name}) -- none -- Set the name of the layer to something different.
|
||||||
moveTo({OpenLayers.Bounds|bounds}, {Boolean|zoomChanged}) -- none -- Not implemented here, but the general function called on dragging or setCenter, to move the Layer to a new geographic location.
|
moveTo({OpenLayers.Bounds|bounds}, {Boolean|zoomChanged}) -- none -- Not implemented here, but the general function called on dragging or setCenter, to move the Layer to a new geographic location.
|
||||||
|
reproject() -- none -- Subclassed by vector layers to redraw vectors when base layer changes.
|
||||||
setMap(map) -- none -- Set the map property of the layer. Also set the parameters which are inherited from the map.
|
setMap(map) -- none -- Set the map property of the layer. Also set the parameters which are inherited from the map.
|
||||||
getVisibility() -- {Boolean} -- Return true or false based on visibility of the layer.
|
getVisibility() -- {Boolean} -- Return true or false based on visibility of the layer.
|
||||||
setVisibility({Boolean|visible}) -- none -- Set the layer visibility, and trigger the appropriate events.
|
setVisibility({Boolean|visible}) -- none -- Set the layer visibility, and trigger the appropriate events.
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
OpenLayers.Util
|
|
||||||
|
|
||||||
Utility class. Stores a bunch of methods and settings that don't fit anywhere else.
|
|
||||||
|
|
||||||
* Options
|
|
||||||
|
|
||||||
OpenLayers.Util.onImageLoadErrorColor -- A string to set img.style.backgroundColor to if the onerror event fires for the image (useful for 500 errors from WMS, for example).
|
|
||||||
68
examples/LayerSwitcher.html
Normal file
68
examples/LayerSwitcher.html
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
|
||||||
|
<style type="text/css">
|
||||||
|
#map {
|
||||||
|
width: 800px;
|
||||||
|
height: 475px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- gmaps api key for http://openlayers.org/~euzuro -->
|
||||||
|
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghQELW4Ku31wWCtlZquTlkHLCFh9LBTYvc_eIShlmo0YZwSitw0fQ1ZyXA'></script>
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
var lon = 5;
|
||||||
|
var lat = 40;
|
||||||
|
var zoom = 5;
|
||||||
|
var map, layer, glayer;
|
||||||
|
|
||||||
|
OpenLayers.ProxyHost = "/proxy/?url=";
|
||||||
|
function init(){
|
||||||
|
map = new OpenLayers.Map( $('map') );
|
||||||
|
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
glayer = new OpenLayers.Layer.Google("goog");
|
||||||
|
map.addLayer(glayer);
|
||||||
|
|
||||||
|
layer = new OpenLayers.Layer.WFS( "wfs",
|
||||||
|
"http://labs.metacarta.com/search/WFS?",
|
||||||
|
{maxfeatures: 1},
|
||||||
|
{ featureClass: OpenLayers.Feature.WFS});
|
||||||
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
|
||||||
|
map.setCenter(new OpenLayers.LonLat(0, 0), 2);
|
||||||
|
|
||||||
|
map.addControl( new OpenLayers.Control.LayerSwitcher() );
|
||||||
|
}
|
||||||
|
|
||||||
|
function add() {
|
||||||
|
|
||||||
|
markers2 = new OpenLayers.Layer.Markers("markers2");
|
||||||
|
map.addLayer(markers2);
|
||||||
|
|
||||||
|
|
||||||
|
var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17));
|
||||||
|
marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41), icon);
|
||||||
|
markers.addMarker(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function remove() {
|
||||||
|
markers.removeMarker(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<div id="map"></div>
|
||||||
|
<div style="background-color:green" onclick="add()"> click to add the marker to the map</div>
|
||||||
|
<div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,613 +0,0 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<style type="text/css">
|
|
||||||
#map {
|
|
||||||
width: 512px;
|
|
||||||
height: 512px;
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghSPUCi5aRYVveCcVYxzezM4iaj_gxQ9t-UajFL70jfcpquH5l1IJ-Zyyw'></script>
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
<!--
|
|
||||||
var map, canvas;
|
|
||||||
var click;
|
|
||||||
function init(){
|
|
||||||
map = new OpenLayers.Map('map');
|
|
||||||
|
|
||||||
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
|
||||||
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
|
|
||||||
var g = new OpenLayers.Layer.Google("Google");
|
|
||||||
canvas = new OpenLayers.Layer.Canvas("Canvas Layer");
|
|
||||||
map.addLayers([ol_wms, g,canvas]);
|
|
||||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
|
||||||
// map.setCenter(new OpenLayers.LonLat(0, 0), 0);
|
|
||||||
map.zoomToMaxExtent();
|
|
||||||
canvas.drawLine(new OpenLayers.LonLat(-71,42), new OpenLayers.LonLat(0,0));
|
|
||||||
canvas.setStrokeColor("red");
|
|
||||||
canvas.setStrokeWidth(5);
|
|
||||||
canvas.setAlpha(.5);
|
|
||||||
map.events.register("click", map, function(e) {
|
|
||||||
if (click) {
|
|
||||||
canvas.drawLine(click, this.getLonLatFromPixel(e.xy));
|
|
||||||
click = null;
|
|
||||||
$('status').innerHTML = "";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
click = this.getLonLatFromPixel(e.xy);
|
|
||||||
$('status').innerHTML = "Point 1 stored: "+click+". <a href='#' onclick='click=null;return false'>Reset</a>";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function drawIt() {
|
|
||||||
canvas.drawLine(
|
|
||||||
new OpenLayers.LonLat(parseFloat($('lon1').value), parseFloat($('lat1').value)),
|
|
||||||
new OpenLayers.LonLat(parseFloat($('lon2').value), parseFloat($('lat2').value))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// -->
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body onload="init()">
|
|
||||||
<h1>OpenLayers Example</h1>
|
|
||||||
<div style="float:right">
|
|
||||||
<br />
|
|
||||||
Start Lon: <input type="text" id="lon1" />
|
|
||||||
Start Lat: <input type="text" id="lat1" /><br />
|
|
||||||
End Lon: <input type="text" id="lon2" />
|
|
||||||
End Lat: <input type="text" id="lat2" /><br />
|
|
||||||
<input type="submit" value="Add line" onclick="drawIt()" />
|
|
||||||
<div id="status"></div>
|
|
||||||
<center>
|
|
||||||
<table border="1" cellpadding="0" cellspacing="1">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#000000">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#000000');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#000033">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#000033');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#000066">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#000066');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#000099">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#000099');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0000cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0000CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0000ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0000FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#330000">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#330000');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#330033">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#330033');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#330066">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#330066');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#330099">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#330099');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3300cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3300CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3300ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3300FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#660000">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#660000');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#660033">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#660033');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#660066">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#660066');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#660099">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#660099');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#6600cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#6600CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#6600ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#6600FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#990000">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#990000');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#990033">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#990033');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#990066">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#990066');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#990099">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#990099');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#9900cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#9900CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#9900ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#9900FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc0000">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC0000');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc0033">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC0033');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc0066">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC0066');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc0099">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC0099');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc00cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC00CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc00ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC00FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff0000">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF0000');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff0033">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF0033');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff0066">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF0066');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff0099">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF0099');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff00cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF00CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff00ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF00FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#003300">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#003300');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#003333">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#003333');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#003366">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#003366');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#003399">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#003399');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0033cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0033CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0033ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0033FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#333300">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#333300');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#333333">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#333333');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#333366">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#333366');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#333399">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#333399');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3333cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3333CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3333ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3333FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#663300">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#663300');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#663333">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#663333');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#663366">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#663366');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#663399">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#663399');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#6633cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#6633CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#6633ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#6633FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#993300">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#993300');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#993333">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#993333');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#993366">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#993366');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#993399">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#993399');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#9933cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#9933CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#9933ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#9933FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc3300">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC3300');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc3333">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC3333');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc33cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC33CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc33ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC33FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff3300">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF3300');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff3333">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF3333');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff3366">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF3366');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff3399">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF3399');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff33cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF33CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff33ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF33FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#006600">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#006600');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#006633">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#006633');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#006666">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#006666');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#006699">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#006699');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0066cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0066CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#336699">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#336699');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3366cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3366CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3366ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3366FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#666600">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#666600');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#666633">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#666633');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#666666">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#666666');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#666699">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#666699');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#6666cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#6666CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#6666ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#6666FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#996600">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#996600');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#996633">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#996633');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#9966ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#9966FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc6600">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC6600');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc6633">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC6633');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc6666">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC6666');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc6699">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC6699');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc66cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC66CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#cc66ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#CC66FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff6600">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF6600');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#ff6633">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#FF6633');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#009900">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#009900');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#009933">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#009933');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#009966">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#009966');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#009999">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#009999');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0099cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0099CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#0099ff">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#0099FF');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#339900">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#339900');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#339933">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#339933');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#339966">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#339966');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#339999">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#339999');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
<td bgcolor="#3399cc">
|
|
||||||
<font size="-3">
|
|
||||||
<a href="#" onclick="canvas.setStrokeColor('#3399CC');return false"> </a>
|
|
||||||
</font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div id="map"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
|
|
||||||
<style type="text/css">
|
|
||||||
#map {
|
|
||||||
width: 100%;
|
|
||||||
height: 512px;
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
<!--
|
|
||||||
|
|
||||||
var lon = 5;
|
|
||||||
var lat = 40;
|
|
||||||
var zoom = 5;
|
|
||||||
var map, mmlayer, layer;
|
|
||||||
|
|
||||||
function init(){
|
|
||||||
map = new OpenLayers.Map( $('map') ,
|
|
||||||
{controls:[new OpenLayers.Control.MouseDefaults()]});
|
|
||||||
|
|
||||||
mmlayer = new OpenLayers.Layer.MultiMap( "MultiMap");
|
|
||||||
map.addLayer(mmlayer);
|
|
||||||
|
|
||||||
markers = new OpenLayers.Layer.Markers("markers");
|
|
||||||
map.addLayer(markers);
|
|
||||||
|
|
||||||
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
|
|
||||||
map.addControl( new OpenLayers.Control.LayerSwitcher() );
|
|
||||||
map.addControl( new OpenLayers.Control.PanZoomBar() );
|
|
||||||
}
|
|
||||||
|
|
||||||
function add() {
|
|
||||||
|
|
||||||
marker = new OpenLayers.Marker(new OpenLayers.LonLat(2, 41));
|
|
||||||
markers.addMarker(marker);
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove() {
|
|
||||||
markers.removeMarker(marker);
|
|
||||||
}
|
|
||||||
// -->
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body onload="init()">
|
|
||||||
<h1>OpenLayers MultiMap Example</h1>
|
|
||||||
<div id="map"></div>
|
|
||||||
<div style="background-color:green" onclick="add()"> click to add the marker to the map</div>
|
|
||||||
<div style="background-color:red" onclick="remove()"> click to remove the marker from the map</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changer() {
|
function changer() {
|
||||||
@@ -71,9 +70,9 @@
|
|||||||
function mousedown(evt) {
|
function mousedown(evt) {
|
||||||
if (popup == null) {
|
if (popup == null) {
|
||||||
popup = feature.createPopup();
|
popup = feature.createPopup();
|
||||||
popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
|
|
||||||
popup.setBackgroundColor("yellow");
|
popup.setBackgroundColor("yellow");
|
||||||
popup.setOpacity(0.7);
|
popup.setOpacity(0.7);
|
||||||
|
popup.events.register("mousedown", popup, onPopupMouseDown);
|
||||||
markers.map.addPopup(popup);
|
markers.map.addPopup(popup);
|
||||||
} else {
|
} else {
|
||||||
markers.map.removePopup(popup);
|
markers.map.removePopup(popup);
|
||||||
|
|||||||
90
examples/test.html
Normal file
90
examples/test.html
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<script src="../lib/Prototype.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var one, two, div, msg;
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
|
||||||
|
one = $("one");
|
||||||
|
two = $("two");
|
||||||
|
div = $("div");
|
||||||
|
msg = $("msg");
|
||||||
|
|
||||||
|
Event.observe(div, "click", bar);
|
||||||
|
|
||||||
|
one.checked = true;
|
||||||
|
two.checked = false;
|
||||||
|
|
||||||
|
Event.observe(one, "change", oneClick);
|
||||||
|
Event.observe(two, "change", twoClick);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function bar(e) {
|
||||||
|
message("clicked div");
|
||||||
|
|
||||||
|
Event.stop(e);
|
||||||
|
|
||||||
|
var status = "one: ";
|
||||||
|
status += (one.checked) ? "checked" : "unchecked";
|
||||||
|
status += " two: ";
|
||||||
|
status += (two.checked) ? "checked" : "unchecked";
|
||||||
|
message(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
function oneClick(e) {
|
||||||
|
message("clicked one");
|
||||||
|
}
|
||||||
|
|
||||||
|
function twoClick(e) {
|
||||||
|
message("clicked two");
|
||||||
|
}
|
||||||
|
|
||||||
|
function message(txt) {
|
||||||
|
msg.innerHTML += " ** " + txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<body onload="init()" onclick="message('clicked body')" onmouseup="message('<br>')">
|
||||||
|
|
||||||
|
<div> The idea here is to simulate the layerswitcher radiobuttons UI
|
||||||
|
without all the overhead of openlayers.
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
There are event handlers attached to the following elements:
|
||||||
|
<br>
|
||||||
|
* Body - Prints message "clicked body" to message area
|
||||||
|
<br>
|
||||||
|
* Blue Div - Prints message "clicked div" to message area, stops
|
||||||
|
the event propagation, prints a message with the
|
||||||
|
status of the two radiobuttons
|
||||||
|
<br>
|
||||||
|
* Radio One - Prints message "clicked one" to message area
|
||||||
|
<br>
|
||||||
|
* Radio Two - Prints message "clicked two" to message area
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<b>
|
||||||
|
The problem, as you will see if you click the radio buttons
|
||||||
|
themselves, is that their "checked" status seems to update, but
|
||||||
|
their visual UI bit does not. Can we fix this!?!
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="div" style="background-color:blue; margin:50px">
|
||||||
|
<input id="one" type="radio" name="foo"/>
|
||||||
|
<span> one </span>
|
||||||
|
<br>
|
||||||
|
<input id="two" type="radio" name="foo"/>
|
||||||
|
<span> two </span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="msg" style="background-color:pink; margin-top:200px">
|
||||||
|
Events:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml" style="width:100%">
|
||||||
<head>
|
<head>
|
||||||
<title>XHTML Example</title>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body style="width:100%">
|
<body style="width:100%">
|
||||||
<div style="width:100%; height:500px" id="map"></div>
|
<div style="width:100%; height:500px" id="map"></div>
|
||||||
@@ -14,10 +13,5 @@
|
|||||||
map.addLayer(wms);
|
map.addLayer(wms);
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
</script>
|
</script>
|
||||||
<p>
|
|
||||||
<a href="http://validator.w3.org/check/referer"><img
|
|
||||||
src="http://www.w3.org/Icons/valid-xhtml10"
|
|
||||||
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
|
|
||||||
</p>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script>
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
@@ -67,14 +67,12 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
|
|||||||
"OpenLayers/Tile/Image.js",
|
"OpenLayers/Tile/Image.js",
|
||||||
"OpenLayers/Tile/WFS.js",
|
"OpenLayers/Tile/WFS.js",
|
||||||
"OpenLayers/Layer/EventPane.js",
|
"OpenLayers/Layer/EventPane.js",
|
||||||
"OpenLayers/Layer/FixedZoomLevels.js",
|
|
||||||
"OpenLayers/Layer/Google.js",
|
"OpenLayers/Layer/Google.js",
|
||||||
"OpenLayers/Layer/VirtualEarth.js",
|
"OpenLayers/Layer/VirtualEarth.js",
|
||||||
"OpenLayers/Layer/Yahoo.js",
|
// "OpenLayers/Layer/Yahoo.js",
|
||||||
"OpenLayers/Layer/HTTPRequest.js",
|
"OpenLayers/Layer/HTTPRequest.js",
|
||||||
"OpenLayers/Layer/Grid.js",
|
"OpenLayers/Layer/Grid.js",
|
||||||
"OpenLayers/Layer/KaMap.js",
|
"OpenLayers/Layer/KaMap.js",
|
||||||
"OpenLayers/Layer/MultiMap.js",
|
|
||||||
"OpenLayers/Layer/Markers.js",
|
"OpenLayers/Layer/Markers.js",
|
||||||
"OpenLayers/Layer/Text.js",
|
"OpenLayers/Layer/Text.js",
|
||||||
"OpenLayers/Layer/WorldWind.js",
|
"OpenLayers/Layer/WorldWind.js",
|
||||||
@@ -83,7 +81,6 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
|
|||||||
"OpenLayers/Layer/WMS/Untiled.js",
|
"OpenLayers/Layer/WMS/Untiled.js",
|
||||||
"OpenLayers/Layer/GeoRSS.js",
|
"OpenLayers/Layer/GeoRSS.js",
|
||||||
"OpenLayers/Layer/Boxes.js",
|
"OpenLayers/Layer/Boxes.js",
|
||||||
"OpenLayers/Layer/Canvas.js",
|
|
||||||
"OpenLayers/Popup/Anchored.js",
|
"OpenLayers/Popup/Anchored.js",
|
||||||
"OpenLayers/Popup/AnchoredBubble.js",
|
"OpenLayers/Popup/AnchoredBubble.js",
|
||||||
"OpenLayers/Control.js",
|
"OpenLayers/Control.js",
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ OpenLayers.Pixel.prototype = {
|
|||||||
* @param {float} y
|
* @param {float} y
|
||||||
*/
|
*/
|
||||||
initialize: function(x, y) {
|
initialize: function(x, y) {
|
||||||
this.x = parseFloat(x);
|
this.x = x;
|
||||||
this.y = parseFloat(y);
|
this.y = y;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,8 +123,8 @@ OpenLayers.Size.prototype = {
|
|||||||
* @param {float} h
|
* @param {float} h
|
||||||
*/
|
*/
|
||||||
initialize: function(w, h) {
|
initialize: function(w, h) {
|
||||||
this.w = parseFloat(w);
|
this.w = w;
|
||||||
this.h = parseFloat(h);
|
this.h = h;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,8 +193,8 @@ OpenLayers.LonLat.prototype = {
|
|||||||
* @param {float} lat
|
* @param {float} lat
|
||||||
*/
|
*/
|
||||||
initialize: function(lon, lat) {
|
initialize: function(lon, lat) {
|
||||||
this.lon = parseFloat(lon);
|
this.lon = lon;
|
||||||
this.lat = parseFloat(lat);
|
this.lat = lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -315,10 +315,10 @@ OpenLayers.Bounds.prototype = {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
initialize: function(left, bottom, right, top) {
|
initialize: function(left, bottom, right, top) {
|
||||||
this.left = parseFloat(left);
|
this.left = left;
|
||||||
this.bottom = parseFloat(bottom);
|
this.bottom = bottom;
|
||||||
this.right = parseFloat(right);
|
this.right = right;
|
||||||
this.top = parseFloat(top);
|
this.top = top;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
OpenLayers.Control = Class.create();
|
OpenLayers.Control = Class.create();
|
||||||
OpenLayers.Control.prototype = {
|
OpenLayers.Control.prototype = {
|
||||||
|
|
||||||
/** @type String */
|
|
||||||
id: null,
|
|
||||||
|
|
||||||
/** this gets set in the addControl() function in OpenLayers.Map
|
/** this gets set in the addControl() function in OpenLayers.Map
|
||||||
* @type OpenLayers.Map */
|
* @type OpenLayers.Map */
|
||||||
map: null,
|
map: null,
|
||||||
@@ -31,8 +28,6 @@ OpenLayers.Control.prototype = {
|
|||||||
*/
|
*/
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
Object.extend(this, options);
|
Object.extend(this, options);
|
||||||
|
|
||||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +57,6 @@ OpenLayers.Control.prototype = {
|
|||||||
draw: function (px) {
|
draw: function (px) {
|
||||||
if (this.div == null) {
|
if (this.div == null) {
|
||||||
this.div = OpenLayers.Util.createDiv();
|
this.div = OpenLayers.Util.createDiv();
|
||||||
this.div.id = this.id;
|
|
||||||
}
|
}
|
||||||
if (px != null) {
|
if (px != null) {
|
||||||
this.position = px.clone();
|
this.position = px.clone();
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
// create span
|
// create span
|
||||||
var labelSpan = document.createElement("span");
|
var labelSpan = document.createElement("span");
|
||||||
labelSpan.innerHTML = layer.name;
|
labelSpan.innerHTML = layer.name;
|
||||||
labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "baseline";
|
labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "auto";
|
||||||
Event.observe(labelSpan, "click",
|
Event.observe(labelSpan, "click",
|
||||||
this.onInputClick.bindAsEventListener(inputElem));
|
this.onInputClick.bindAsEventListener(inputElem));
|
||||||
// create line break
|
// create line break
|
||||||
|
|||||||
@@ -141,12 +141,9 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
* @param {Event} evt
|
* @param {Event} evt
|
||||||
*/
|
*/
|
||||||
defaultMouseOut: function (evt) {
|
defaultMouseOut: function (evt) {
|
||||||
if (this.mouseDragStart != null &&
|
if (this.mouseDragStart != null
|
||||||
OpenLayers.Util.mouseLeft(evt, this.map.div)) {
|
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
|
||||||
if (this.zoomBox) {
|
this.defaultMouseUp(evt);
|
||||||
this.removeZoomBox();
|
|
||||||
}
|
|
||||||
this.mouseDragStart = null;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -191,18 +188,11 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
(end.lat)
|
(end.lat)
|
||||||
), this.map.getZoom() + 1);
|
), this.map.getZoom() + 1);
|
||||||
}
|
}
|
||||||
this.removeZoomBox();
|
this.map.viewPortDiv.removeChild(document.getElementById("zoomBox"));
|
||||||
|
this.zoomBox = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the zoombox from the screen and nullify our reference to it.
|
|
||||||
*/
|
|
||||||
removeZoomBox: function() {
|
|
||||||
this.map.viewPortDiv.removeChild(this.zoomBox);
|
|
||||||
this.zoomBox = null;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/
|
* Mouse ScrollWheel code thanks to http://adomas.org/javascript-mouse-wheel/
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
|
|
||||||
direction: "vertical",
|
direction: "vertical",
|
||||||
|
|
||||||
/** @type String */
|
|
||||||
buttonClicked: null,
|
|
||||||
|
|
||||||
initialize: function(position, direction) {
|
initialize: function(position, direction) {
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||||
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,
|
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,
|
||||||
@@ -39,8 +36,13 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
|
|
||||||
draw: function() {
|
draw: function() {
|
||||||
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
||||||
OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments);
|
|
||||||
this.buttons = new Object();
|
this.buttons = new Object();
|
||||||
|
this.map.events.register( "click", this, this.defaultClick );
|
||||||
|
this.map.events.register( "dblclick", this, this.defaultDblClick );
|
||||||
|
this.map.events.register( "mousedown", this, this.defaultMouseDown );
|
||||||
|
this.map.events.register( "mouseup", this, this.defaultMouseUp );
|
||||||
|
this.map.events.register( "mousemove", this, this.defaultMouseMove );
|
||||||
|
this.map.events.register( "mouseout", this, this.defaultMouseOut );
|
||||||
var sz = new OpenLayers.Size(28,28);
|
var sz = new OpenLayers.Size(28,28);
|
||||||
var centered = this.position;
|
var centered = this.position;
|
||||||
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area");
|
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area");
|
||||||
@@ -65,10 +67,10 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
btn.imgLocation = imgLocation;
|
btn.imgLocation = imgLocation;
|
||||||
btn.activeImgLocation = activeImgLocation;
|
btn.activeImgLocation = activeImgLocation;
|
||||||
|
|
||||||
btn.events = new OpenLayers.Events(this, btn, null, true);
|
btn.events = new OpenLayers.Events(this, btn);
|
||||||
btn.events.register("mousedown", this, this.buttonDown);
|
btn.events.register("mousedown", this, this.buttonClick);
|
||||||
btn.events.register("mouseup", this, this.buttonUp);
|
btn.events.register("mouseup", this, Event.stop);
|
||||||
btn.events.register("dblclick", this, Event.stop);
|
btn.events.register("click", this, Event.stop);
|
||||||
btn.action = id;
|
btn.action = id;
|
||||||
btn.title = title;
|
btn.title = title;
|
||||||
btn.alt = title;
|
btn.alt = title;
|
||||||
@@ -79,29 +81,12 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
return btn;
|
return btn;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
buttonClick: function(evt) {
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
buttonDown: function(evt) {
|
|
||||||
if (!Event.isLeftClick(evt)) return;
|
if (!Event.isLeftClick(evt)) return;
|
||||||
this.buttonClicked = evt.element.action;
|
this.switchModeTo(evt.element.action);
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
buttonUp: function(evt) {
|
|
||||||
if (!Event.isLeftClick(evt)) return;
|
|
||||||
if (this.buttonClicked != null) {
|
|
||||||
if (this.buttonClicked == evt.element.action) {
|
|
||||||
this.switchModeTo(evt.element.action);
|
|
||||||
}
|
|
||||||
Event.stop(evt);
|
|
||||||
this.buttonClicked = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Event} evt
|
* @param {Event} evt
|
||||||
*/
|
*/
|
||||||
@@ -109,7 +94,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
this.switchModeTo("pan");
|
this.switchModeTo("pan");
|
||||||
this.performedDrag = false;
|
this.performedDrag = false;
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
this.map.setCenter(newCenter, this.map.zoom + 2);
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
@@ -199,8 +184,6 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
|
|
||||||
switchModeTo: function(mode) {
|
switchModeTo: function(mode) {
|
||||||
if (mode != this.mode) {
|
if (mode != this.mode) {
|
||||||
|
|
||||||
|
|
||||||
if (this.mode && this.buttons[this.mode]) {
|
if (this.mode && this.buttons[this.mode]) {
|
||||||
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation);
|
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation);
|
||||||
}
|
}
|
||||||
@@ -217,15 +200,6 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
if (this.buttons[mode]) {
|
if (this.buttons[mode]) {
|
||||||
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation);
|
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation);
|
||||||
}
|
}
|
||||||
switch (this.mode) {
|
|
||||||
case "zoombox":
|
|
||||||
this.map.div.style.cursor = "crosshair";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.map.div.style.cursor = "default";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -285,21 +259,12 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
this.map.div.style.cursor = "default";
|
this.map.div.style.cursor = "default";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
defaultMouseOut: function (evt) {
|
defaultMouseOut: function (evt) {
|
||||||
if (this.mouseDragStart != null
|
if (this.mouseDragStart != null
|
||||||
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
|
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
|
||||||
if (this.zoomBox) {
|
this.defaultMouseUp(evt);
|
||||||
this.removeZoomBox();
|
|
||||||
if (this.startViaKeyboard) this.leaveMode();
|
|
||||||
}
|
|
||||||
this.mouseDragStart = null;
|
|
||||||
this.map.div.style.cursor = "default";
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultClick: function (evt) {
|
defaultClick: function (evt) {
|
||||||
if (this.performedDrag) {
|
if (this.performedDrag) {
|
||||||
this.performedDrag = false;
|
this.performedDrag = false;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ OpenLayers.Control.PanZoom.prototype =
|
|||||||
*/
|
*/
|
||||||
_addButton:function(id, img, xy, sz) {
|
_addButton:function(id, img, xy, sz) {
|
||||||
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
|
var imgLocation = OpenLayers.Util.getImagesLocation() + img;
|
||||||
|
// var btn = new ol.AlphaImage("_"+id, imgLocation, xy, sz);
|
||||||
var btn = OpenLayers.Util.createAlphaImageDiv(
|
var btn = OpenLayers.Util.createAlphaImageDiv(
|
||||||
"OpenLayers_Control_PanZoom_" + id,
|
"OpenLayers_Control_PanZoom_" + id,
|
||||||
xy, sz, imgLocation, "absolute");
|
xy, sz, imgLocation, "absolute");
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ OpenLayers.Control.PanZoomBar.X = 4;
|
|||||||
OpenLayers.Control.PanZoomBar.Y = 4;
|
OpenLayers.Control.PanZoomBar.Y = 4;
|
||||||
OpenLayers.Control.PanZoomBar.prototype =
|
OpenLayers.Control.PanZoomBar.prototype =
|
||||||
Object.extend( new OpenLayers.Control.PanZoom(), {
|
Object.extend( new OpenLayers.Control.PanZoom(), {
|
||||||
|
|
||||||
/** @type Array(...) */
|
/** @type Array(...) */
|
||||||
buttons: null,
|
buttons: null,
|
||||||
|
|
||||||
@@ -86,7 +85,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
"absolute");
|
"absolute");
|
||||||
this.slider = slider;
|
this.slider = slider;
|
||||||
|
|
||||||
this.sliderEvents = new OpenLayers.Events(this, slider, null, true);
|
this.sliderEvents = new OpenLayers.Events(this, slider);
|
||||||
this.sliderEvents.register("mousedown", this, this.zoomBarDown);
|
this.sliderEvents.register("mousedown", this, this.zoomBarDown);
|
||||||
this.sliderEvents.register("mousemove", this, this.zoomBarDrag);
|
this.sliderEvents.register("mousemove", this, this.zoomBarDrag);
|
||||||
this.sliderEvents.register("mouseup", this, this.zoomBarUp);
|
this.sliderEvents.register("mouseup", this, this.zoomBarUp);
|
||||||
@@ -116,7 +115,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
|||||||
|
|
||||||
this.zoombarDiv = div;
|
this.zoombarDiv = div;
|
||||||
|
|
||||||
this.divEvents = new OpenLayers.Events(this, div, null, true);
|
this.divEvents = new OpenLayers.Events(this, div);
|
||||||
this.divEvents.register("mousedown", this, this.divClick);
|
this.divEvents.register("mousedown", this, this.divClick);
|
||||||
this.divEvents.register("mousemove", this, this.passEventToSlider);
|
this.divEvents.register("mousemove", this, this.passEventToSlider);
|
||||||
this.divEvents.register("dblclick", this, this.doubleClick);
|
this.divEvents.register("dblclick", this, this.doubleClick);
|
||||||
|
|||||||
@@ -37,14 +37,11 @@ OpenLayers.Events.prototype = {
|
|||||||
* is being added
|
* is being added
|
||||||
* @param {DOMElement} element A dom element to respond to browser events
|
* @param {DOMElement} element A dom element to respond to browser events
|
||||||
* @param {Array} eventTypes Array of custom application events
|
* @param {Array} eventTypes Array of custom application events
|
||||||
* @param {Boolean} fallThrough Allow events to fall through after these
|
|
||||||
* have been handled?
|
|
||||||
*/
|
*/
|
||||||
initialize: function (object, element, eventTypes, fallThrough) {
|
initialize: function (object, element, eventTypes) {
|
||||||
this.object = object;
|
this.object = object;
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.eventTypes = eventTypes;
|
this.eventTypes = eventTypes;
|
||||||
this.fallThrough = fallThrough;
|
|
||||||
this.listeners = new Object();
|
this.listeners = new Object();
|
||||||
|
|
||||||
// if eventTypes is specified, create a listeners list for each
|
// if eventTypes is specified, create a listeners list for each
|
||||||
@@ -162,7 +159,8 @@ OpenLayers.Events.prototype = {
|
|||||||
|
|
||||||
// execute all callbacks registered for specified type
|
// execute all callbacks registered for specified type
|
||||||
var listeners = this.listeners[type];
|
var listeners = this.listeners[type];
|
||||||
if ((listeners != null) && (listeners.length > 0)) {
|
if (listeners != null) {
|
||||||
|
|
||||||
for (var i = 0; i < listeners.length; i++) {
|
for (var i = 0; i < listeners.length; i++) {
|
||||||
var callback = listeners[i];
|
var callback = listeners[i];
|
||||||
var continueChain;
|
var continueChain;
|
||||||
@@ -178,10 +176,6 @@ OpenLayers.Events.prototype = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// don't fall through to other DOM elements
|
|
||||||
if (!this.fallThrough) {
|
|
||||||
Event.stop(evt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -211,9 +205,8 @@ OpenLayers.Events.prototype = {
|
|||||||
this.element.offsets = Position.page(this.element);
|
this.element.offsets = Position.page(this.element);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Pixel(
|
return new OpenLayers.Pixel(
|
||||||
(evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) - this.element.offsets[0],
|
evt.clientX - this.element.offsets[0],
|
||||||
(evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) - this.element.offsets[1]
|
evt.clientY - this.element.offsets[1]);
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ OpenLayers.Feature.prototype= {
|
|||||||
this.layer = layer;
|
this.layer = layer;
|
||||||
this.lonlat = lonlat;
|
this.lonlat = lonlat;
|
||||||
this.data = (data != null) ? data : new Object();
|
this.data = (data != null) ? data : new Object();
|
||||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
this.id = OpenLayers.Util.createUniqueID('Feature_');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -44,27 +44,12 @@ OpenLayers.Layer.prototype = {
|
|||||||
/** @type String */
|
/** @type String */
|
||||||
projection: null,
|
projection: null,
|
||||||
|
|
||||||
/** @type String */
|
|
||||||
units: null,
|
|
||||||
|
|
||||||
/** @type Array */
|
|
||||||
scales: null,
|
|
||||||
|
|
||||||
/** @type Array */
|
|
||||||
resolutions: null,
|
|
||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
/** @type OpenLayers.Bounds */
|
||||||
maxExtent: null,
|
maxExtent: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Bounds */
|
|
||||||
minExtent: null,
|
|
||||||
|
|
||||||
/** @type float */
|
/** @type float */
|
||||||
maxResolution: null,
|
maxResolution: null,
|
||||||
|
|
||||||
/** @type float */
|
|
||||||
minResolution: null,
|
|
||||||
|
|
||||||
/** @type int */
|
/** @type int */
|
||||||
numZoomLevels: null,
|
numZoomLevels: null,
|
||||||
|
|
||||||
@@ -74,6 +59,8 @@ OpenLayers.Layer.prototype = {
|
|||||||
/** @type float */
|
/** @type float */
|
||||||
maxScale: null,
|
maxScale: null,
|
||||||
|
|
||||||
|
/** @type String */
|
||||||
|
units: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -92,13 +79,13 @@ OpenLayers.Layer.prototype = {
|
|||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
//generate unique id based on name
|
||||||
|
this.id = OpenLayers.Util.createUniqueID("Layer_");
|
||||||
|
|
||||||
if (this.div == null) {
|
if (this.div == null) {
|
||||||
this.div = OpenLayers.Util.createDiv();
|
this.div = OpenLayers.Util.createDiv();
|
||||||
this.div.style.width = "100%";
|
this.div.style.width = "100%";
|
||||||
this.div.style.height = "100%";
|
this.div.style.height = "100%";
|
||||||
this.div.id = this.id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -203,9 +190,6 @@ OpenLayers.Layer.prototype = {
|
|||||||
this[properties[i]] = this.map[properties[i]];
|
this[properties[i]] = this.map[properties[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.isBaseLayer) {
|
|
||||||
this.initResolutions();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,7 +210,7 @@ OpenLayers.Layer.prototype = {
|
|||||||
if ((visible) && (this.map != null)) {
|
if ((visible) && (this.map != null)) {
|
||||||
var extent = this.map.getExtent();
|
var extent = this.map.getExtent();
|
||||||
if (extent != null) {
|
if (extent != null) {
|
||||||
this.moveTo(this.map.getExtent(), true);
|
this.moveTo(this.map.getExtent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((this.map != null) &&
|
if ((this.map != null) &&
|
||||||
@@ -236,6 +220,15 @@ OpenLayers.Layer.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************/
|
||||||
|
/* */
|
||||||
|
/* Layer Options */
|
||||||
|
/* */
|
||||||
|
/* Accessor functions to Layer Options parameters */
|
||||||
|
/* */
|
||||||
|
/********************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Boolean} isBaseLayer
|
* @param {Boolean} isBaseLayer
|
||||||
*/
|
*/
|
||||||
@@ -246,168 +239,92 @@ OpenLayers.Layer.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
getProjection: function() {
|
||||||
|
return this.projection;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type OpenLayers.Bounds
|
||||||
|
*/
|
||||||
|
getMaxExtent: function() {
|
||||||
|
return this.maxExtent;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type float
|
||||||
|
*/
|
||||||
|
getMaxResolution: function() {
|
||||||
|
return this.maxResolution;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns The total number of zoom levels this layer can reach
|
||||||
|
* @type int
|
||||||
|
*/
|
||||||
|
getNumZoomLevels: function() {
|
||||||
|
return this.numZoomLevels;
|
||||||
|
},
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Baselayer Functions */
|
/* Baselayer Functions */
|
||||||
/* */
|
/* */
|
||||||
|
/* The following functions must all be implemented */
|
||||||
|
/* by all base layers */
|
||||||
|
/* */
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
/** This method's responsibility is to set up the 'resolutions' array
|
|
||||||
* for the layer -- this array is what the layer will use to interface
|
|
||||||
* between the zoom levels of the map and the resolution display of the
|
|
||||||
* layer.
|
|
||||||
*
|
|
||||||
* The user has several options that determine how the array is set up.
|
|
||||||
*
|
|
||||||
* For a detailed explanation, see the following wiki from the
|
|
||||||
* openlayers.org homepage:
|
|
||||||
*
|
|
||||||
* http://trac.openlayers.org/wiki/SettingZoomLevels
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
initResolutions: function() {
|
|
||||||
|
|
||||||
if ((this.scales != null) || (this.resolutions != null)) {
|
|
||||||
//preset levels
|
|
||||||
if (this.scales != null) {
|
|
||||||
this.resolutions = new Array();
|
|
||||||
for(var i = 0; i < this.scales.length; i++) {
|
|
||||||
this.resolutions[i] =
|
|
||||||
OpenLayers.Util.getResolutionFromScale(this.scales[i],
|
|
||||||
this.units);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.numZoomLevels = this.resolutions.length;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//maxResolution and numZoomLevels
|
|
||||||
|
|
||||||
this.resolutions = new Array();
|
|
||||||
|
|
||||||
// determine maxResolution
|
|
||||||
if (this.minScale) {
|
|
||||||
this.maxResolution =
|
|
||||||
OpenLayers.Util.getResolutionFromScale(this.minScale,
|
|
||||||
this.units);
|
|
||||||
} else if (this.maxResolution == "auto") {
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
var wRes = this.maxExtent.getWidth() / viewSize.w;
|
|
||||||
var hRes = this.maxExtent.getHeight()/ viewSize.h;
|
|
||||||
this.maxResolution = Math.max(wRes, hRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine minResolution
|
|
||||||
if (this.maxScale != null) {
|
|
||||||
this.minResolution =
|
|
||||||
OpenLayers.Util.getResolutionFromScale(this.maxScale);
|
|
||||||
} else if ((this.minResolution == "auto") &&
|
|
||||||
(this.minExtent != null)){
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
var wRes = this.minExtent.getWidth() / viewSize.w;
|
|
||||||
var hRes = this.minExtent.getHeight()/ viewSize.h;
|
|
||||||
this.minResolution = Math.max(wRes, hRes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine numZoomLevels
|
|
||||||
if (this.minResolution != null) {
|
|
||||||
var ratio = this.maxResolution / this.minResolution;
|
|
||||||
this.numZoomLevels =
|
|
||||||
Math.floor(Math.log(ratio) / Math.log(2)) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// now we have numZoomLevels and maxResolution,
|
|
||||||
// we can populate the resolutions array
|
|
||||||
for (var i=0; i < this.numZoomLevels; i++) {
|
|
||||||
this.resolutions.push(this.maxResolution / Math.pow(2, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns The currently selected resolution of the map, taken from the
|
* @returns Degrees per Pixel
|
||||||
* resolutions array, indexed by current zoom level.
|
|
||||||
* @type float
|
* @type float
|
||||||
*/
|
*/
|
||||||
getResolution: function() {
|
getResolution: function() {
|
||||||
var zoom = this.map.getZoom();
|
var viewSize = this.map.getSize();
|
||||||
return this.resolutions[zoom];
|
var extent = this.getExtent();
|
||||||
|
return Math.max( extent.getWidth() / viewSize.w,
|
||||||
|
extent.getHeight() / viewSize.h );
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Calculates based on resolution, center, and mapsize
|
/** Calculates using px-> lonlat translation functions on tl and br
|
||||||
|
* corners of viewport
|
||||||
*
|
*
|
||||||
* @param {float} resolution Specific resolution to get an extent for.
|
|
||||||
* If null, this.getResolution() is called
|
|
||||||
* @returns A Bounds object which represents the lon/lat bounds of the
|
* @returns A Bounds object which represents the lon/lat bounds of the
|
||||||
* current viewPort.
|
* current viewPort.
|
||||||
* @type OpenLayers.Bounds
|
* @type OpenLayers.Bounds
|
||||||
*/
|
*/
|
||||||
getExtent: function(resolution) {
|
getExtent: function () {
|
||||||
var extent = null;
|
var extent = null;
|
||||||
|
|
||||||
var center = this.map.getCenter();
|
|
||||||
if (center != null) {
|
|
||||||
|
|
||||||
if (resolution == null) {
|
var size = this.map.getSize();
|
||||||
resolution = this.getResolution();
|
|
||||||
}
|
|
||||||
var size = this.map.getSize();
|
|
||||||
var w_deg = size.w * resolution;
|
|
||||||
var h_deg = size.h * resolution;
|
|
||||||
|
|
||||||
extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
|
var tlPx = new OpenLayers.Pixel(0,0);
|
||||||
center.lat - h_deg / 2,
|
var tlLL = this.getLonLatFromViewPortPx(tlPx);
|
||||||
center.lon + w_deg / 2,
|
|
||||||
center.lat + h_deg / 2);
|
|
||||||
|
|
||||||
|
var brPx = new OpenLayers.Pixel(size.w, size.h);
|
||||||
|
var brLL = this.getLonLatFromViewPortPx(brPx);
|
||||||
|
|
||||||
|
if ((tlLL != null) && (brLL != null)) {
|
||||||
|
extent = new OpenLayers.Bounds(tlLL.lon,
|
||||||
|
brLL.lat,
|
||||||
|
brLL.lon,
|
||||||
|
tlLL.lat);
|
||||||
}
|
}
|
||||||
|
|
||||||
return extent;
|
return extent;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Bounds} bounds
|
|
||||||
*
|
|
||||||
* @returns The index of the zoomLevel (entry in the resolutions array)
|
|
||||||
* that still contains the passed-in extent. We do this by
|
|
||||||
* calculating the ideal resolution for the given exteng (based
|
|
||||||
* on the map size) and then find the smallest resolution that
|
|
||||||
* is greater than this ideal resolution.
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getZoomForExtent: function(extent) {
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
var idealResolution = Math.max( extent.getWidth() / viewSize.w,
|
|
||||||
extent.getHeight() / viewSize.h );
|
|
||||||
|
|
||||||
return this.getZoomForResolution(idealResolution);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {float} resolution
|
* @param {OpenLayers.Pixel} viewPortPx
|
||||||
*
|
*
|
||||||
* @returns The index of the zoomLevel (entry in the resolutions array)
|
* @returns An OpenLayers.LonLat which is the passed-in view port
|
||||||
* that is the smallest resolution that is greater than the
|
* OpenLayers.Pixel, translated into lon/lat by the layer
|
||||||
* passed-in resolution.
|
* @type OpenLayers.LonLat
|
||||||
* @type int
|
*/
|
||||||
*/
|
|
||||||
getZoomForResolution: function(resolution) {
|
|
||||||
|
|
||||||
for(var i=1; i <= this.resolutions.length; i++) {
|
|
||||||
if ( this.resolutions[i] < resolution) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (i - 1);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Pixel} viewPortPx
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.LonLat which is the passed-in view port
|
|
||||||
* OpenLayers.Pixel, translated into lon/lat by the layer
|
|
||||||
* @type OpenLayers.LonLat
|
|
||||||
*/
|
|
||||||
getLonLatFromViewPortPx: function (viewPortPx) {
|
getLonLatFromViewPortPx: function (viewPortPx) {
|
||||||
var size = this.map.getSize();
|
var size = this.map.getSize();
|
||||||
var center = this.map.getCenter();
|
var center = this.map.getCenter();
|
||||||
@@ -421,12 +338,12 @@ OpenLayers.Layer.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.LonLat} lonlat
|
* @param {OpenLayers.LonLat} lonlat
|
||||||
*
|
*
|
||||||
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
|
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
|
||||||
* translated into view port pixels
|
* translated into view port pixels
|
||||||
* @type OpenLayers.Pixel
|
* @type OpenLayers.Pixel
|
||||||
*/
|
*/
|
||||||
getViewPortPxFromLonLat: function (lonlat) {
|
getViewPortPxFromLonLat: function (lonlat) {
|
||||||
var resolution = this.map.getResolution();
|
var resolution = this.map.getResolution();
|
||||||
var extent = this.map.getExtent();
|
var extent = this.map.getExtent();
|
||||||
@@ -437,17 +354,16 @@ OpenLayers.Layer.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the opacity for the entire layer (all images)
|
* @param {OpenLayers.Bounds} bounds
|
||||||
* @param {Float} opacity
|
*
|
||||||
*/
|
* @return {int}
|
||||||
setOpacity: function(opacity) {
|
*/
|
||||||
this.opacity = opacity;
|
getZoomForExtent: function (bounds) {
|
||||||
for(var i=0; i<this.div.childNodes.length; ++i) {
|
// this should be implemented by subclasses
|
||||||
var element = this.div.childNodes[i];
|
|
||||||
OpenLayers.Util.setOpacity(element, opacity);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer"
|
CLASS_NAME: "OpenLayers.Layer"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
|
||||||
* text of the license. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class
|
|
||||||
*
|
|
||||||
* @requires OpenLayers/Layer.js
|
|
||||||
*/
|
|
||||||
OpenLayers.Layer.Canvas = Class.create();
|
|
||||||
OpenLayers.Layer.Canvas.prototype =
|
|
||||||
Object.extend( new OpenLayers.Layer(), {
|
|
||||||
|
|
||||||
/** Canvas layer is never a base layer.
|
|
||||||
*
|
|
||||||
* @type Boolean
|
|
||||||
*/
|
|
||||||
isBaseLayer: false,
|
|
||||||
isFixed: true,
|
|
||||||
/** internal marker list
|
|
||||||
* @type Array(OpenLayers.Marker) */
|
|
||||||
canvas: null,
|
|
||||||
|
|
||||||
lines: new Array(),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*
|
|
||||||
* @param {String} name
|
|
||||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
|
||||||
*/
|
|
||||||
initialize: function(name, options) {
|
|
||||||
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
destroy: function() {
|
|
||||||
// xxx actually destroy the canvas to scavenge ram?
|
|
||||||
canvas = null;
|
|
||||||
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Bounds} bounds
|
|
||||||
* @param {Boolean} zoomChanged
|
|
||||||
* @param {Boolean} minor
|
|
||||||
*/
|
|
||||||
moveTo:function(bounds, zoomChanged, minor) {
|
|
||||||
this.redraw();
|
|
||||||
},
|
|
||||||
|
|
||||||
setStrokeColor: function(color) {
|
|
||||||
var ctx = this.canvas.getContext("2d");
|
|
||||||
ctx.strokeStyle = color;
|
|
||||||
},
|
|
||||||
setStrokeWidth: function(width) {
|
|
||||||
var ctx = this.canvas.getContext("2d");
|
|
||||||
ctx.lineWidth = width;
|
|
||||||
},
|
|
||||||
setAlpha: function(alpha) {
|
|
||||||
var ctx = this.canvas.getContext("2d");
|
|
||||||
ctx.globalAlpha = alpha;
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
clearCanvas: function() {
|
|
||||||
if(this.canvas != null) {
|
|
||||||
this.canvas.getContext("2d").clearRect(0,0,this.map.getSize().w, this.map.getSize().h);
|
|
||||||
// xxx use real width and height
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
drawLine: function(start, end) {
|
|
||||||
var ctx = this.canvas.getContext("2d");
|
|
||||||
this.addLine(start, end);
|
|
||||||
this.lines.push(new Array(start,end, ctx.strokeStyle, ctx.lineWidth, ctx.globalAlpha));
|
|
||||||
},
|
|
||||||
addLine: function(start, end) {
|
|
||||||
var ctx = this.canvas.getContext("2d");
|
|
||||||
var startpx = this.map.getPixelFromLonLat(start);
|
|
||||||
var endpx = this.map.getPixelFromLonLat(end);
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.moveTo(startpx.x, startpx.y);
|
|
||||||
ctx.lineTo(endpx.x, endpx.y);
|
|
||||||
ctx.closePath();
|
|
||||||
ctx.stroke();
|
|
||||||
},
|
|
||||||
|
|
||||||
/** clear all the marker div's from the layer and then redraw all of them.
|
|
||||||
* Use the map to recalculate new placement of markers.
|
|
||||||
*/
|
|
||||||
redraw: function() {
|
|
||||||
// xxx rebuild the canvas if smaller than the view
|
|
||||||
// xxx may wish to overside the canvas with overflow=hidden by default
|
|
||||||
if(!this.canvas) {
|
|
||||||
this.canvas = document.createElement("CANVAS");
|
|
||||||
this.canvas.setAttribute("width",this.map.getSize().w);
|
|
||||||
this.canvas.setAttribute("height",this.map.getSize().h);
|
|
||||||
this.div.appendChild(this.canvas);
|
|
||||||
} else {
|
|
||||||
this.clearCanvas();
|
|
||||||
}
|
|
||||||
for(var i=0; i < this.lines.length; i++) {
|
|
||||||
this.setStrokeColor(this.lines[i][2]);
|
|
||||||
this.setStrokeWidth(this.lines[i][3]);
|
|
||||||
this.setAlpha(this.lines[i][4]);
|
|
||||||
this.addLine(this.lines[i][0], this.lines[i][1]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/** @final @type String */
|
|
||||||
CLASS_NAME: "OpenLayers.Layer.Canvas"
|
|
||||||
});
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
|
||||||
* text of the license. */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some Layers will already have established zoom levels (like google
|
|
||||||
* or ve). Instead of trying to determine them and populate a resolutions[]
|
|
||||||
* Array with those values, we will hijack the resolution functionality
|
|
||||||
* here.
|
|
||||||
*
|
|
||||||
* When you subclass FixedZoomLevels:
|
|
||||||
*
|
|
||||||
* The initResolutions() call gets nullified, meaning no resolutions[] array
|
|
||||||
* is set up. Which would be a big problem getResolution() in Layer, since
|
|
||||||
* it merely takes map.zoom and indexes into resolutions[]... but....
|
|
||||||
*
|
|
||||||
* The getResolution() call is also overridden. Instead of using the
|
|
||||||
* resolutions[] array, we simply calculate the current resolution based
|
|
||||||
* on the current extent and the current map size. But how will we be able
|
|
||||||
* to calculate the current extent without knowing the resolution...?
|
|
||||||
*
|
|
||||||
* The getExtent() function is also overridden. Instead of calculating extent
|
|
||||||
* based on the center point and the current resolution, we instead
|
|
||||||
* calculate the extent by getting the lonlats at the top-left and
|
|
||||||
* bottom-right by using the getLonLatFromViewPortPx() translation function,
|
|
||||||
* taken from the pixel locations (0,0) and the size of the map. But how
|
|
||||||
* will we be able to do lonlat-px translation without resolution....?
|
|
||||||
*
|
|
||||||
* The getZoomForResolution() method is overridden. Instead of indexing into
|
|
||||||
* the resolutions[] array, we call OpenLayers.Layer.getExent(), passing in
|
|
||||||
* the desired resolution. With this extent, we then call getZoomForExtent()
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Whenever you implement a layer using OpenLayers.Layer.FixedZoomLevels,
|
|
||||||
* it is your responsibility to provide the following three functions:
|
|
||||||
*
|
|
||||||
* - getLonLatFromViewPortPx()
|
|
||||||
* - getViewPortPxFromLonLat()
|
|
||||||
* - getZoomForExtent()
|
|
||||||
*
|
|
||||||
* ...those three functions should generally be provided by any reasonable
|
|
||||||
* API that you might be working from.
|
|
||||||
*
|
|
||||||
* @class
|
|
||||||
*/
|
|
||||||
OpenLayers.Layer.FixedZoomLevels = Class.create();
|
|
||||||
OpenLayers.Layer.FixedZoomLevels.prototype = {
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
/* */
|
|
||||||
/* Baselayer Functions */
|
|
||||||
/* */
|
|
||||||
/* The following functions must all be implemented */
|
|
||||||
/* by all base layers */
|
|
||||||
/* */
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
initialize: function() {
|
|
||||||
//this class is only just to add the following functions...
|
|
||||||
// nothing to actually do here... but it is probably a good
|
|
||||||
// idea to have layers that use these functions call this
|
|
||||||
// inititalize() anyways, in case at some point we decide we
|
|
||||||
// do want to put some functionality or state in here.
|
|
||||||
},
|
|
||||||
|
|
||||||
initResolutions: function() {
|
|
||||||
// resolutions are set automatically in the black-box. this is the
|
|
||||||
// definition of a fixed-zoom-levels layer
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns Degrees per Pixel
|
|
||||||
* @type float
|
|
||||||
*/
|
|
||||||
getResolution: function() {
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
var extent = this.getExtent();
|
|
||||||
return Math.max( extent.getWidth() / viewSize.w,
|
|
||||||
extent.getHeight() / viewSize.h );
|
|
||||||
},
|
|
||||||
|
|
||||||
/** Calculates using px-> lonlat translation functions on tl and br
|
|
||||||
* corners of viewport
|
|
||||||
*
|
|
||||||
* @returns A Bounds object which represents the lon/lat bounds of the
|
|
||||||
* current viewPort.
|
|
||||||
* @type OpenLayers.Bounds
|
|
||||||
*/
|
|
||||||
getExtent: function () {
|
|
||||||
var extent = null;
|
|
||||||
|
|
||||||
|
|
||||||
var size = this.map.getSize();
|
|
||||||
|
|
||||||
var tlPx = new OpenLayers.Pixel(0,0);
|
|
||||||
var tlLL = this.getLonLatFromViewPortPx(tlPx);
|
|
||||||
|
|
||||||
var brPx = new OpenLayers.Pixel(size.w, size.h);
|
|
||||||
var brLL = this.getLonLatFromViewPortPx(brPx);
|
|
||||||
|
|
||||||
if ((tlLL != null) && (brLL != null)) {
|
|
||||||
extent = new OpenLayers.Bounds(tlLL.lon,
|
|
||||||
brLL.lat,
|
|
||||||
brLL.lon,
|
|
||||||
tlLL.lat);
|
|
||||||
}
|
|
||||||
|
|
||||||
return extent;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {float} resolution
|
|
||||||
*
|
|
||||||
* @returns A suitable zoom level for the specified resolution.
|
|
||||||
* If no baselayer is set, returns null.
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getZoomForResolution: function(resolution) {
|
|
||||||
|
|
||||||
var extent = OpenLayers.Layer.prototype.getExtent.apply(this,
|
|
||||||
[resolution]);
|
|
||||||
|
|
||||||
return this.getZoomForExtent(extent);
|
|
||||||
},
|
|
||||||
|
|
||||||
/** @final @type String */
|
|
||||||
CLASS_NAME: "FixedZoomLevels.js"
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -70,22 +70,8 @@ OpenLayers.Layer.GeoRSS.prototype =
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
location = new OpenLayers.LonLat(parseFloat(location[1]), parseFloat(location[0]));
|
location = new OpenLayers.LonLat(parseFloat(location[1]), parseFloat(location[0]));
|
||||||
|
var title = OpenLayers.Util.getNodes(itemlist[i], "title")[0].firstChild.nodeValue;
|
||||||
/* Provide defaults for title and description */
|
var description = OpenLayers.Util.getNodes(itemlist[i], "description")[0].firstChild.nodeValue;
|
||||||
var title = "No title";
|
|
||||||
try {
|
|
||||||
title = OpenLayers.Util.getNodes(itemlist[i],
|
|
||||||
"title")[0].firstChild.nodeValue;
|
|
||||||
}
|
|
||||||
catch (e) { alert(e); }
|
|
||||||
|
|
||||||
var description = "No description";
|
|
||||||
try {
|
|
||||||
description = OpenLayers.Util.getNodes(itemlist[i],
|
|
||||||
"description")[0].firstChild.nodeValue;
|
|
||||||
}
|
|
||||||
catch (e) { alert(e); }
|
|
||||||
|
|
||||||
try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { }
|
try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { }
|
||||||
data.icon = OpenLayers.Marker.defaultIcon();
|
data.icon = OpenLayers.Marker.defaultIcon();
|
||||||
data.popupSize = new OpenLayers.Size(250, 100);
|
data.popupSize = new OpenLayers.Size(250, 100);
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Google = Class.create();
|
OpenLayers.Layer.Google = Class.create();
|
||||||
OpenLayers.Layer.Google.prototype =
|
OpenLayers.Layer.Google.prototype =
|
||||||
Object.extend( new OpenLayers.Layer.EventPane(),
|
Object.extend( new OpenLayers.Layer.EventPane(), {
|
||||||
Object.extend( new OpenLayers.Layer.FixedZoomLevels(), {
|
|
||||||
|
|
||||||
/** @type Boolean */
|
/** @type Boolean */
|
||||||
isFixed: true,
|
isFixed: true,
|
||||||
@@ -40,8 +39,6 @@ OpenLayers.Layer.Google.prototype =
|
|||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
initialize: function(name, options) {
|
||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
|
||||||
arguments);
|
|
||||||
if (this.maxExtent == null) {
|
if (this.maxExtent == null) {
|
||||||
this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
|
this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
|
||||||
}
|
}
|
||||||
@@ -253,6 +250,7 @@ OpenLayers.Layer.Google.prototype =
|
|||||||
var gZoom = Math.min(Math.max(gZoom, this.minZoomLevel),
|
var gZoom = Math.min(Math.max(gZoom, this.minZoomLevel),
|
||||||
this.maxZoomLevel);
|
this.maxZoomLevel);
|
||||||
|
|
||||||
|
|
||||||
zoom = this.getOLZoomFromGZoom(gZoom);
|
zoom = this.getOLZoomFromGZoom(gZoom);
|
||||||
}
|
}
|
||||||
return zoom;
|
return zoom;
|
||||||
@@ -440,4 +438,4 @@ OpenLayers.Layer.Google.prototype =
|
|||||||
},
|
},
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.Google"
|
CLASS_NAME: "OpenLayers.Layer.Google"
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -267,8 +267,8 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
// if the test grid coordinates are within the bounds of the
|
// if the test grid coordinates are within the bounds of the
|
||||||
// grid, get a reference to the tile.
|
// grid, get a reference to the tile.
|
||||||
var tile = null;
|
var tile = null;
|
||||||
if ((testRow < this.grid.length) && (testRow >= 0) &&
|
if ((testRow < this.grid.length) &&
|
||||||
(testCell < this.grid[0].length) && (testCell >= 0)) {
|
(testCell < this.grid[0].length)) {
|
||||||
tile = this.grid[testRow][testCell];
|
tile = this.grid[testRow][testCell];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,6 +393,65 @@ OpenLayers.Layer.Grid.prototype =
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/********************************************************/
|
||||||
|
/* */
|
||||||
|
/* Baselayer Functions */
|
||||||
|
/* */
|
||||||
|
/********************************************************/
|
||||||
|
|
||||||
|
/** Calculates based on resolution, center, and mapsize
|
||||||
|
*
|
||||||
|
* @returns A Bounds object which represents the lon/lat bounds of the
|
||||||
|
* current viewPort.
|
||||||
|
* @type OpenLayers.Bounds
|
||||||
|
*/
|
||||||
|
getExtent: function () {
|
||||||
|
var extent = null;
|
||||||
|
|
||||||
|
var center = this.map.getCenter();
|
||||||
|
if (center != null) {
|
||||||
|
|
||||||
|
var res = this.map.getResolution();
|
||||||
|
var size = this.map.getSize();
|
||||||
|
var w_deg = size.w * res;
|
||||||
|
var h_deg = size.h * res;
|
||||||
|
|
||||||
|
extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
|
||||||
|
center.lat - h_deg / 2,
|
||||||
|
center.lon + w_deg / 2,
|
||||||
|
center.lat + h_deg / 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return extent;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {OpenLayers.Bounds} bounds
|
||||||
|
*
|
||||||
|
* @return {int}
|
||||||
|
*/
|
||||||
|
getZoomForExtent: function (bounds) {
|
||||||
|
|
||||||
|
var maxRes = this.map.getMaxResolution();
|
||||||
|
var viewSize = this.map.getSize();
|
||||||
|
|
||||||
|
var width = bounds.getWidth();
|
||||||
|
var height = bounds.getHeight();
|
||||||
|
|
||||||
|
var degPerPixel = (width > height) ? width / viewSize.w
|
||||||
|
: height / viewSize.h;
|
||||||
|
|
||||||
|
var zoom = Math.floor( (Math.log(maxRes/degPerPixel)) / Math.log(2) );
|
||||||
|
|
||||||
|
//make sure zoom is within bounds
|
||||||
|
zoom = Math.min( Math.max(zoom, 0),
|
||||||
|
this.getNumZoomLevels() - 1);
|
||||||
|
|
||||||
|
return zoom;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.Grid"
|
CLASS_NAME: "OpenLayers.Layer.Grid"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,6 +36,17 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
|||||||
this.params = Object.extend( new Object(), params);
|
this.params = Object.extend( new Object(), params);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** When the layer is added to the map, once it has taken all the
|
||||||
|
* relevant properties from the map (in Layer.setMap()), we will
|
||||||
|
* make the call to initialize the layer's resolutions array.
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Map} map
|
||||||
|
*/
|
||||||
|
setMap: function(map) {
|
||||||
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
|
this.initResolutions();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -127,6 +138,89 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
|||||||
return requestString;
|
return requestString;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** This method's responsibility is to set up the 'resolutions' array
|
||||||
|
* for the layer -- this array is what the layer will use to interface
|
||||||
|
* between the zoom levels of the map and the resolution display of the
|
||||||
|
* layer.
|
||||||
|
*
|
||||||
|
* The user has several options that determine how the array is set up.
|
||||||
|
*
|
||||||
|
* For a detailed explanation, see the following wiki from the
|
||||||
|
* openlayers.org homepage:
|
||||||
|
*
|
||||||
|
* http://trac.openlayers.org/wiki/SettingZoomLevels
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
initResolutions: function() {
|
||||||
|
|
||||||
|
if ((this.scales != null) || (this.resolutions != null)) {
|
||||||
|
//preset levels
|
||||||
|
if (this.scales != null) {
|
||||||
|
this.resolutions = new Array();
|
||||||
|
for(var i = 0; i < this.scales.length; i++) {
|
||||||
|
this.resolutions[i] =
|
||||||
|
OpenLayers.Util.getResolutionFromScale(this.scales[i],
|
||||||
|
this.units);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.numZoomLevels = this.resolutions.length;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//maxResolution and numZoomLevels
|
||||||
|
|
||||||
|
this.resolutions = new Array();
|
||||||
|
|
||||||
|
// determine maxResolution
|
||||||
|
if (this.minScale) {
|
||||||
|
this.maxResolution =
|
||||||
|
OpenLayers.Util.getResolutionFromScale(this.minScale,
|
||||||
|
this.units);
|
||||||
|
} else if (this.maxResolution == "auto") {
|
||||||
|
var viewSize = this.map.getSize();
|
||||||
|
var wRes = this.maxExtent.getWidth() / viewSize.w;
|
||||||
|
var hRes = this.maxExtent.getHeight()/ viewSize.h;
|
||||||
|
this.maxResolution = Math.max(wRes, hRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine minResolution
|
||||||
|
if (this.maxScale != null) {
|
||||||
|
this.minResolution =
|
||||||
|
OpenLayers.Util.getResolutionFromScale(this.maxScale);
|
||||||
|
} else if ((this.minResolution == "auto") &&
|
||||||
|
(this.minExtent != null)){
|
||||||
|
var viewSize = this.map.getSize();
|
||||||
|
var wRes = this.minExtent.getWidth() / viewSize.w;
|
||||||
|
var hRes = this.minExtent.getHeight()/ viewSize.h;
|
||||||
|
this.minResolution = Math.max(wRes, hRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine numZoomLevels
|
||||||
|
if (this.minResolution != null) {
|
||||||
|
var ratio = this.maxResolution / this.minResolution;
|
||||||
|
this.numZoomLevels =
|
||||||
|
Math.floor(Math.log(ratio) / Math.log(2)) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now we have numZoomLevels and maxResolution,
|
||||||
|
// we can populate the resolutions array
|
||||||
|
for (var i=0; i < this.numZoomLevels; i++) {
|
||||||
|
this.resolutions.push(this.maxResolution / Math.pow(2, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns The currently selected resolution of the map, taken from the
|
||||||
|
* resolutions array, indexed by current zoom level.
|
||||||
|
* @type float
|
||||||
|
*/
|
||||||
|
getResolution: function() {
|
||||||
|
var zoom = this.map.getZoom();
|
||||||
|
|
||||||
|
return this.resolutions[zoom];
|
||||||
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.HTTPRequest"
|
CLASS_NAME: "OpenLayers.Layer.HTTPRequest"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,338 +0,0 @@
|
|||||||
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
|
|
||||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
|
||||||
* text of the license. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class
|
|
||||||
*
|
|
||||||
* @requires OpenLayers/Layer/EventPane.js
|
|
||||||
*/
|
|
||||||
OpenLayers.Layer.MultiMap = Class.create();
|
|
||||||
OpenLayers.Layer.MultiMap.prototype =
|
|
||||||
Object.extend( new OpenLayers.Layer.EventPane(), {
|
|
||||||
|
|
||||||
/** @type MMMap */
|
|
||||||
multimap: null,
|
|
||||||
|
|
||||||
/** @type int */
|
|
||||||
minZoomLevel: 1,
|
|
||||||
|
|
||||||
/** @type int */
|
|
||||||
maxZoomLevel: 17,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*
|
|
||||||
* @param {String} name
|
|
||||||
*/
|
|
||||||
initialize:function(name) {
|
|
||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
|
||||||
|
|
||||||
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Map} map
|
|
||||||
*/
|
|
||||||
setMap:function(map) {
|
|
||||||
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
|
|
||||||
|
|
||||||
// once our layer has been added to the map, we can load the multimap
|
|
||||||
this.loadMMMap();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Bounds} bounds
|
|
||||||
* @param {Boolean} zoomChanged
|
|
||||||
* @param {Boolean} minor
|
|
||||||
*/
|
|
||||||
moveTo:function(bounds, zoomChanged, minor) {
|
|
||||||
|
|
||||||
if (this.multimap != null) {
|
|
||||||
var olCenter = this.map.getCenter();
|
|
||||||
var mmCenter = this.getMMLatLongFromOLLonLat(olCenter);
|
|
||||||
|
|
||||||
if (zoomChanged) {
|
|
||||||
var olZoom = this.map.getZoom();
|
|
||||||
var mmZoom = this.getMMZoomFromOLZoom(olZoom);
|
|
||||||
|
|
||||||
this.multimap.goToPosition(mmCenter, mmZoom);
|
|
||||||
} else {
|
|
||||||
this.multimap.goToPosition(mmCenter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
loadMMMap:function() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
// create MMMap, hide nav controls
|
|
||||||
this.multimap = new MultimapViewer(this.div);
|
|
||||||
} catch (e) {
|
|
||||||
// do nothing this is to keep from crashing
|
|
||||||
// if the MM library was not loaded.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (this.multimap == null) {
|
|
||||||
this.loadWarningMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/** If we can't load the multimap, then display an error message to the
|
|
||||||
* user and tell them where to go for help.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
loadWarningMessage:function() {
|
|
||||||
|
|
||||||
this.div.style.backgroundColor = "darkblue";
|
|
||||||
|
|
||||||
var html = "";
|
|
||||||
html += "The MM Layer was unable to load correctly.<br>";
|
|
||||||
html += "<br>";
|
|
||||||
html += "To get rid of this message, click on the MM Layer's "
|
|
||||||
html += "tab in the layer switcher in the upper-right corner.<br>";
|
|
||||||
html += "<br>";
|
|
||||||
html += "Most likely, this is because the MM library";
|
|
||||||
html += " script was either not correctly included.<br>";
|
|
||||||
html += "<br>";
|
|
||||||
html += "Demmlopers: For help getting this working correctly, ";
|
|
||||||
html += "<a href='http://trac.openlayers.org/wiki/MultiMapLayer' "
|
|
||||||
html += "target='_blank'>";
|
|
||||||
html += "click here";
|
|
||||||
html += "</a>";
|
|
||||||
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
|
|
||||||
msgW = Math.min(viewSize.w, 300);
|
|
||||||
msgH = Math.min(viewSize.h, 200);
|
|
||||||
var size = new OpenLayers.Size(msgW, msgH);
|
|
||||||
|
|
||||||
var centerPx = new OpenLayers.Pixel(viewSize.w/2, viewSize.h/2);
|
|
||||||
|
|
||||||
var topLeft = centerPx.add(-size.w/2, -size.h/2);
|
|
||||||
|
|
||||||
var div = OpenLayers.Util.createDiv("mmWarning",
|
|
||||||
topLeft,
|
|
||||||
size,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"auto");
|
|
||||||
|
|
||||||
div.style.padding = "7px";
|
|
||||||
div.style.backgroundColor = "yellow";
|
|
||||||
|
|
||||||
div.innerHTML = html;
|
|
||||||
this.div.appendChild(div);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
/* */
|
|
||||||
/* Baselayer Functions */
|
|
||||||
/* */
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Pixel} viewPortPx
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.LonLat which is the passed-in view port
|
|
||||||
* OpenLayers.Pixel, translated into lon/lat by MM
|
|
||||||
* If multimap is not loaded, returns null.
|
|
||||||
* @type OpenLayers.LonLat
|
|
||||||
*/
|
|
||||||
getLonLatFromViewPortPx: function (viewPortPx) {
|
|
||||||
var lonlat = null;
|
|
||||||
if (this.multimap != null) {
|
|
||||||
var pixel = this.getPixelFromOLPixel(viewPortPx);
|
|
||||||
var zoom = this.multimap.getZoomFactor();
|
|
||||||
pixel.x = pixel.x - (this.map.getSize().w/2);
|
|
||||||
pixel.y = pixel.y - (this.map.getSize().h/2);
|
|
||||||
var mmLatLong = this.multimap.getMapPositionAt(pixel);
|
|
||||||
lonlat = this.getOLLonLatFromMMLatLong(mmLatLong);
|
|
||||||
}
|
|
||||||
return lonlat;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.LonLat} lonlat
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
|
|
||||||
* translated into view port pixels BY MM
|
|
||||||
* If multimap is not loaded, returns null.
|
|
||||||
* @type OpenLayers.Pixel
|
|
||||||
*/
|
|
||||||
getViewPortPxFromLonLat: function (lonlat) {
|
|
||||||
var viewPortPx = null;
|
|
||||||
if (this.multimap != null) {
|
|
||||||
var mmLatLong = this.getMMLatLongFromOLLonLat(lonlat);
|
|
||||||
var pixel = this.multimap.geoPosToContainerPixels(mmLatLong);
|
|
||||||
viewPortPx = this.getOLPixelFromPixel(pixel);
|
|
||||||
}
|
|
||||||
return viewPortPx;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Bounds} bounds
|
|
||||||
*
|
|
||||||
* @returns Corresponding zoom lemml for a specified Bounds.
|
|
||||||
* If multimap is not loaded, returns null.
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getZoomForExtent: function (bounds) {
|
|
||||||
|
|
||||||
var zoom = null;
|
|
||||||
if (this.multimap != null) {
|
|
||||||
var maxRes = this.map.getMaxResolution();
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
|
|
||||||
var width = bounds.getWidth();
|
|
||||||
var height = bounds.getHeight();
|
|
||||||
|
|
||||||
var degPerPixel = (width > height) ? width / viewSize.w
|
|
||||||
: height / viewSize.h;
|
|
||||||
|
|
||||||
var mmZoom = Math.floor( (Math.log(maxRes/degPerPixel)) /
|
|
||||||
Math.log(2) );
|
|
||||||
|
|
||||||
//make sure zoom is within bounds
|
|
||||||
var mmZoom = Math.min(Math.max(mmZoom, this.minZoomLevel),
|
|
||||||
this.maxZoomLevel);
|
|
||||||
|
|
||||||
zoom = this.getOLZoomFromMMZoom(mmZoom);
|
|
||||||
}
|
|
||||||
return zoom;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
/* */
|
|
||||||
/* Translation Functions */
|
|
||||||
/* */
|
|
||||||
/* The following functions translate GMaps and OL */
|
|
||||||
/* formats for Pixel, LonLat, Bounds, and Zoom */
|
|
||||||
/* */
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
//
|
|
||||||
// TRANSLATION: GZoom <-> OpenLayers Zoom
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {int} mmZoom
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers Zoom lemml, translated from the passed in mmZoom
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getOLZoomFromMMZoom: function(mmZoom) {
|
|
||||||
if (mmZoom) return mmZoom - 1;
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {int} olZoom
|
|
||||||
*
|
|
||||||
* @returns A MMZoom lemml, translated from the passed in olZoom
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getMMZoomFromOLZoom: function(olZoom) {
|
|
||||||
if (olZoom) return olZoom + 1;
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
|
|
||||||
//
|
|
||||||
// TRANSLATION: MMLatLong <-> LonLat
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {MMLatLong} mmLatLong
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.LonLat, translated from the passed in MMLatLong
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type OpenLayers.LonLat
|
|
||||||
*/
|
|
||||||
getOLLonLatFromMMLatLong: function(mmLatLong) {
|
|
||||||
var olLonLat = null;
|
|
||||||
if (mmLatLong != null) {
|
|
||||||
olLonLat = new OpenLayers.LonLat(mmLatLong.lon,
|
|
||||||
mmLatLong.lat);
|
|
||||||
}
|
|
||||||
return olLonLat;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.LonLat} olLonLat
|
|
||||||
*
|
|
||||||
* @returns A MMLatLong, translated from the passed in OpenLayers.LonLat
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type MMLatLong
|
|
||||||
*/
|
|
||||||
getMMLatLongFromOLLonLat: function(olLonLat) {
|
|
||||||
var mmLatLong = null;
|
|
||||||
if (olLonLat != null) {
|
|
||||||
mmLatLong = new MMLatLon(olLonLat.lat, olLonLat.lon);
|
|
||||||
}
|
|
||||||
return mmLatLong;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// TRANSLATION: Pixel <-> OpenLayers.Pixel
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Pixel} pixel
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.Pixel, translated from the passed in Pixel
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type OpenLayers.Pixel
|
|
||||||
*/
|
|
||||||
getOLPixelFromPixel: function(pixel) {
|
|
||||||
var olPixel = null;
|
|
||||||
if (pixel != null) {
|
|
||||||
olPixel = new OpenLayers.Pixel(pixel.x, pixel.y);
|
|
||||||
}
|
|
||||||
return olPixel;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Pixel} olPixel
|
|
||||||
*
|
|
||||||
* @returns A Pixel, translated from the passed in OpenLayers.Pixel
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
*
|
|
||||||
* As it turns out, the only specifications we can see for the
|
|
||||||
* MM-compatible Pixel is an x & y property, which emmry
|
|
||||||
* OpenLayers.Pixel has by default. So just leamm it as-is.
|
|
||||||
*
|
|
||||||
* @type Pixel
|
|
||||||
*/
|
|
||||||
getPixelFromOLPixel: function(olPixel) {
|
|
||||||
var pixel = null;
|
|
||||||
if (olPixel != null) {
|
|
||||||
pixel = new MMPoint(olPixel.x, olPixel.y);
|
|
||||||
}
|
|
||||||
return pixel;
|
|
||||||
},
|
|
||||||
|
|
||||||
destroy: function() {
|
|
||||||
this.multimap = null;
|
|
||||||
OpenLayers.Layer.EventPane.prototype.destroy.apply(this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
/** @final @type String */
|
|
||||||
CLASS_NAME: "OpenLayers.Layer.MultiMap"
|
|
||||||
});
|
|
||||||
@@ -9,8 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Layer.VirtualEarth = Class.create();
|
OpenLayers.Layer.VirtualEarth = Class.create();
|
||||||
OpenLayers.Layer.VirtualEarth.prototype =
|
OpenLayers.Layer.VirtualEarth.prototype =
|
||||||
Object.extend( new OpenLayers.Layer.EventPane(),
|
Object.extend( new OpenLayers.Layer.EventPane(), {
|
||||||
Object.extend( new OpenLayers.Layer.FixedZoomLevels(), {
|
|
||||||
|
|
||||||
/** @type VEMap */
|
/** @type VEMap */
|
||||||
vemap: null,
|
vemap: null,
|
||||||
@@ -28,8 +27,6 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
|||||||
*/
|
*/
|
||||||
initialize:function(name) {
|
initialize:function(name) {
|
||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
||||||
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
|
|
||||||
arguments);
|
|
||||||
|
|
||||||
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
|
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
|
||||||
},
|
},
|
||||||
@@ -355,4 +352,4 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
|||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
|
CLASS_NAME: "OpenLayers.Layer.VirtualEarth"
|
||||||
}));
|
});
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ OpenLayers.Layer.WFS.prototype =
|
|||||||
|
|
||||||
/** combine the layer's url with its params and these newParams.
|
/** combine the layer's url with its params and these newParams.
|
||||||
*
|
*
|
||||||
* Add the SRS parameter from 'projection' -- this is probably
|
* Add the SRS parameter from getProjection() -- this is probably
|
||||||
* more eloquently done via a setProjection() method, but this
|
* more eloquently done via a setProjection() method, but this
|
||||||
* works for now and always.
|
* works for now and always.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ OpenLayers.Layer.WMS.prototype =
|
|||||||
format: "image/jpeg"
|
format: "image/jpeg"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** @type Boolean */
|
||||||
|
isBaseLayer: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
@@ -45,12 +48,9 @@ OpenLayers.Layer.WMS.prototype =
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// unless explicitly set in options, if the layer is transparent,
|
// if the layer is transparent, it will be an overlay
|
||||||
// it will be an overlay
|
this.isBaseLayer = ((this.params.TRANSPARENT != "true") &&
|
||||||
if ((options == null) || !(options.isBaseLayer)) {
|
(this.params.TRANSPARENT != true));
|
||||||
this.isBaseLayer = ((this.params.TRANSPARENT != "true") &&
|
|
||||||
(this.params.TRANSPARENT != true));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,7 +136,7 @@ OpenLayers.Layer.WMS.prototype =
|
|||||||
|
|
||||||
/** combine the layer's url with its params and these newParams.
|
/** combine the layer's url with its params and these newParams.
|
||||||
*
|
*
|
||||||
* Add the SRS parameter from projection -- this is probably
|
* Add the SRS parameter from getProjection() -- this is probably
|
||||||
* more eloquently done via a setProjection() method, but this
|
* more eloquently done via a setProjection() method, but this
|
||||||
* works for now and always.
|
* works for now and always.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
format: "image/jpeg"
|
format: "image/jpeg"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/** @type Boolean */
|
||||||
|
isBaseLayer: null,
|
||||||
|
|
||||||
/** @type DOMElement */
|
/** @type DOMElement */
|
||||||
imgDiv: null,
|
imgDiv: null,
|
||||||
|
|
||||||
@@ -33,12 +37,12 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
* @param {String} url
|
* @param {String} url
|
||||||
* @param {Object} params
|
* @param {Object} params
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, params, options) {
|
initialize: function(name, url, params) {
|
||||||
var newArguments = new Array();
|
var newArguments = new Array();
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0) {
|
||||||
//uppercase params
|
//uppercase params
|
||||||
params = OpenLayers.Util.upperCaseObject(params);
|
params = OpenLayers.Util.upperCaseObject(params);
|
||||||
newArguments.push(name, url, params, options);
|
newArguments.push(name, url, params);
|
||||||
}
|
}
|
||||||
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
||||||
newArguments);
|
newArguments);
|
||||||
@@ -50,12 +54,10 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// unless explicitly set in options, if the layer is transparent,
|
// if the layer is transparent, it will be an overlay
|
||||||
// it will be an overlay
|
this.isBaseLayer = ((this.params.TRANSPARENT != "true") &&
|
||||||
if ((options == null) || (options.isBaseLayer == null)) {
|
(this.params.TRANSPARENT != true));
|
||||||
this.isBaseLayer = ((this.params.TRANSPARENT != "true") &&
|
|
||||||
(this.params.TRANSPARENT != true));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,24 +185,6 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
this.moveTo();
|
this.moveTo();
|
||||||
},
|
},
|
||||||
|
|
||||||
/** combine the layer's url with its params and these newParams.
|
|
||||||
*
|
|
||||||
* Add the SRS parameter from 'projection' -- this is probably
|
|
||||||
* more eloquently done via a setProjection() method, but this
|
|
||||||
* works for now and always.
|
|
||||||
*
|
|
||||||
* @param {Object} newParams
|
|
||||||
*
|
|
||||||
* @type String
|
|
||||||
*/
|
|
||||||
getFullRequestString:function(newParams) {
|
|
||||||
var projection = this.map.getProjection();
|
|
||||||
this.params.SRS = (projection == "none") ? null : projection;
|
|
||||||
|
|
||||||
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
|
|
||||||
this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
/** This function first removes the previous image div, then adds a new
|
/** This function first removes the previous image div, then adds a new
|
||||||
* one according to the transparency property.
|
* one according to the transparency property.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,43 +2,49 @@
|
|||||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
||||||
* text of the license. */
|
* text of the license. */
|
||||||
|
|
||||||
|
// load Yahoo map control script
|
||||||
|
document.write("<script src='http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers'></script>");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
*
|
*
|
||||||
* @requires OpenLayers/Layer/EventPane.js
|
* @requires OpenLayers/Layer.js
|
||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Yahoo = Class.create();
|
OpenLayers.Layer.Yahoo = Class.create();
|
||||||
OpenLayers.Layer.Yahoo.prototype =
|
OpenLayers.Layer.Yahoo.prototype = Object.extend( new OpenLayers.Layer(), {
|
||||||
Object.extend( new OpenLayers.Layer.EventPane(), {
|
|
||||||
|
|
||||||
/** @type YMap */
|
/** Yahoo layer is always a base layer.
|
||||||
yahoomap: null,
|
*
|
||||||
|
* @type Boolean
|
||||||
|
*/
|
||||||
|
isBaseLayer: true,
|
||||||
|
|
||||||
/** @type int */
|
/** @type Boolean */
|
||||||
minZoomLevel: 0,
|
isFixed: true,
|
||||||
|
|
||||||
/** @type int */
|
/** @type GMap2 gmap stores the Google Map element */
|
||||||
maxZoomLevel: 15,
|
ymap:null,
|
||||||
|
|
||||||
|
/** @type Boolean */
|
||||||
|
dragging:false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
initialize:function(name) {
|
initialize: function(name) {
|
||||||
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.prototype.initialize.apply(this, [name]);
|
||||||
|
|
||||||
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Map} map
|
* @param {OpenLayers.Map} map
|
||||||
*/
|
*/
|
||||||
setMap:function(map) {
|
setMap:function(map) {
|
||||||
OpenLayers.Layer.EventPane.prototype.setMap.apply(this, arguments);
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
|
|
||||||
// once our layer has been added to the map, we can load the yahoomap
|
// once our layer has been added to the map, we can create the vemap
|
||||||
this.loadYMap();
|
this.map.events.register("addlayer", this, this.loadYMap);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,272 +54,97 @@ OpenLayers.Layer.Yahoo.prototype =
|
|||||||
*/
|
*/
|
||||||
moveTo:function(bounds, zoomChanged, minor) {
|
moveTo:function(bounds, zoomChanged, minor) {
|
||||||
|
|
||||||
if (this.yahoomap != null) {
|
if ((this.ymap != null) && (!this.dragging)) {
|
||||||
|
|
||||||
var olCenter = this.map.getCenter();
|
var olCenter = this.map.getCenter();
|
||||||
var mmCenter = this.getYLatLongFromOLLonLat(olCenter);
|
var yCenter = this.getYMapCenter();
|
||||||
|
|
||||||
if (zoomChanged) {
|
var olZoom = this.map.getZoom();
|
||||||
var olZoom = this.map.getZoom();
|
var yZoom = this.ymap.getZoomLevel();
|
||||||
var mmZoom = this.getYZoomFromOLZoom(olZoom);
|
|
||||||
this.yahoomap.setZoomLevel(mmZoom);
|
if ((!olCenter.equals(yCenter)) || (( 16 - olZoom) != yZoom)) {
|
||||||
|
this.ymap.drawZoomAndCenter(new YGeoPoint(olCenter.lat, olCenter.lon),
|
||||||
|
16 - olZoom);
|
||||||
}
|
}
|
||||||
this.yahoomap.drawZoomAndCenter(mmCenter, mmZoom);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
loadYMap:function() {
|
loadYMap:function() {
|
||||||
this.yahoomap = new YMap(this.div);
|
// create div and set to same size as map
|
||||||
|
var yDiv = OpenLayers.Util.createDiv(this.name);
|
||||||
|
var sz = this.map.getSize();
|
||||||
|
yDiv.style.width = sz.w;
|
||||||
|
yDiv.style.height = sz.h;
|
||||||
|
this.div.appendChild(yDiv);
|
||||||
|
|
||||||
|
// create GMap, hide nav controls
|
||||||
|
this.ymap = new YMap(this.div);
|
||||||
|
|
||||||
|
// catch pans and zooms from GMap
|
||||||
|
YEvent.Capture(this.ymap,
|
||||||
|
EventsList.endPan,
|
||||||
|
this.catchPanZoom,
|
||||||
|
this);
|
||||||
|
|
||||||
|
// catch pans and zooms from GMap
|
||||||
|
YEvent.Capture(this.ymap,
|
||||||
|
EventsList.endAutoPan,
|
||||||
|
this.catchPanZoom,
|
||||||
|
this);
|
||||||
|
|
||||||
|
|
||||||
if (this.yahoomap == null) {
|
// attach to the drag start and end and we<77>ll set a flag so that
|
||||||
this.loadWarningMessage();
|
// we dont get recursivity. this is because the events fall through
|
||||||
}
|
// the gmaps div and into the main layer div
|
||||||
|
YEvent.Capture(this.ymap,
|
||||||
|
EventsList.startPan,
|
||||||
|
this.dragStart,
|
||||||
|
this);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** If we can't load the yahoomap, then display an error message to the
|
/**
|
||||||
* user and tell them where to go for help.
|
* @private
|
||||||
*
|
*/
|
||||||
|
dragStart: function() {
|
||||||
|
this.dragging = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
* @private
|
* @private
|
||||||
*
|
*
|
||||||
|
* @param {Event} e
|
||||||
*/
|
*/
|
||||||
loadWarningMessage:function() {
|
catchPanZoom: function(e) {
|
||||||
|
this.dragging = false;
|
||||||
|
|
||||||
this.div.style.backgroundColor = "darkblue";
|
var olCenter = this.getYMapCenter();
|
||||||
|
var yZoom = this.ymap.getZoomLevel();
|
||||||
|
|
||||||
var html = "";
|
this.map.setCenter(olCenter, 16 - yZoom);
|
||||||
html += "The Y Layer was unable to load correctly.<br>";
|
|
||||||
html += "<br>";
|
|
||||||
html += "To get rid of this message, click on the Y Layer's "
|
|
||||||
html += "tab in the layer switcher in the upper-right corner.<br>";
|
|
||||||
html += "<br>";
|
|
||||||
html += "Most likely, this is because the Y library";
|
|
||||||
html += " script was either not correctly included.<br>";
|
|
||||||
html += "<br>";
|
|
||||||
html += "Demmlopers: For help getting this working correctly, ";
|
|
||||||
html += "<a href='http://trac.openlayers.org/wiki/YahooLayer' "
|
|
||||||
html += "target='_blank'>";
|
|
||||||
html += "click here";
|
|
||||||
html += "</a>";
|
|
||||||
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
|
|
||||||
msgW = Math.min(viewSize.w, 300);
|
|
||||||
msgH = Math.min(viewSize.h, 200);
|
|
||||||
var size = new OpenLayers.Size(msgW, msgH);
|
|
||||||
|
|
||||||
var centerPx = new OpenLayers.Pixel(viewSize.w/2, viewSize.h/2);
|
|
||||||
|
|
||||||
var topLeft = centerPx.add(-size.w/2, -size.h/2);
|
|
||||||
|
|
||||||
var div = OpenLayers.Util.createDiv("mmWarning",
|
|
||||||
topLeft,
|
|
||||||
size,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"auto");
|
|
||||||
|
|
||||||
div.style.padding = "7px";
|
|
||||||
div.style.backgroundColor = "yellow";
|
|
||||||
|
|
||||||
div.innerHTML = html;
|
|
||||||
this.div.appendChild(div);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
/* */
|
|
||||||
/* Baselayer Functions */
|
|
||||||
/* */
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Pixel} viewPortPx
|
* @private
|
||||||
*
|
*
|
||||||
* @returns An OpenLayers.LonLat which is the passed-in view port
|
* @returns An OpenLayers.LonLat with the center of the ymap, or null if
|
||||||
* OpenLayers.Pixel, translated into lon/lat by Y
|
* the YMap has not been centered yet
|
||||||
* If yahoomap is not loaded, returns null.
|
|
||||||
* @type OpenLayers.LonLat
|
* @type OpenLayers.LonLat
|
||||||
*/
|
*/
|
||||||
getLonLatFromViewPortPx: function (viewPortPx) {
|
getYMapCenter:function() {
|
||||||
var lonlat = null;
|
var olCenter = null;
|
||||||
if (this.yahoomap != null) {
|
var yCenter = this.ymap.getCenterLatLon();
|
||||||
var pixel = this.getPixelFromOLPixel(viewPortPx);
|
if (yCenter != null) {
|
||||||
var mmLatLong = this.yahoomap.convertXYLatLon(pixel);
|
olCenter = new OpenLayers.LonLat(yCenter.Lon, yCenter.Lat);
|
||||||
lonlat = this.getOLLonLatFromYLatLong(mmLatLong);
|
|
||||||
}
|
}
|
||||||
return lonlat;
|
return olCenter;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.LonLat} lonlat
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat,
|
|
||||||
* translated into view port pixels BY Y
|
|
||||||
* If yahoomap is not loaded, returns null.
|
|
||||||
* @type OpenLayers.Pixel
|
|
||||||
*/
|
|
||||||
getViewPortPxFromLonLat: function (lonlat) {
|
|
||||||
var viewPortPx = null;
|
|
||||||
if (this.yahoomap != null) {
|
|
||||||
var mmLatLong = this.getYLatLongFromOLLonLat(lonlat);
|
|
||||||
var pixel = this.yahoomap.convertLatLonXY(mmLatLong);
|
|
||||||
viewPortPx = this.getOLPixelFromPixel(pixel);
|
|
||||||
}
|
|
||||||
return viewPortPx;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Bounds} bounds
|
|
||||||
*
|
|
||||||
* @returns Corresponding zoom lemml for a specified Bounds.
|
|
||||||
* If yahoomap is not loaded, returns null.
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getZoomForExtent: function (bounds) {
|
|
||||||
|
|
||||||
var zoom = null;
|
|
||||||
if (this.yahoomap != null) {
|
|
||||||
var maxRes = this.map.getMaxResolution();
|
|
||||||
var viewSize = this.map.getSize();
|
|
||||||
|
|
||||||
var width = bounds.getWidth();
|
|
||||||
var height = bounds.getHeight();
|
|
||||||
|
|
||||||
var degPerPixel = (width > height) ? width / viewSize.w
|
|
||||||
: height / viewSize.h;
|
|
||||||
|
|
||||||
var mmZoom = Math.floor( (Math.log(maxRes/degPerPixel)) /
|
|
||||||
Math.log(2) );
|
|
||||||
|
|
||||||
//make sure zoom is within bounds
|
|
||||||
var mmZoom = Math.min(Math.max(mmZoom, this.minZoomLevel),
|
|
||||||
this.maxZoomLevel);
|
|
||||||
|
|
||||||
zoom = this.getOLZoomFromYZoom(mmZoom);
|
|
||||||
}
|
|
||||||
return zoom;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
/* */
|
|
||||||
/* Translation Functions */
|
|
||||||
/* */
|
|
||||||
/* The following functions translate GMaps and OL */
|
|
||||||
/* formats for Pixel, LonLat, Bounds, and Zoom */
|
|
||||||
/* */
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
//
|
|
||||||
// TRANSLATION: GZoom <-> OpenLayers Zoom
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {int} mmZoom
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers Zoom lemml, translated from the passed in mmZoom
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getOLZoomFromYZoom: function(mmZoom) {
|
|
||||||
return 18 - mmZoom;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {int} olZoom
|
|
||||||
*
|
|
||||||
* @returns A YZoom lemml, translated from the passed in olZoom
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getYZoomFromOLZoom: function(olZoom) {
|
|
||||||
return 18 - olZoom;
|
|
||||||
},
|
|
||||||
|
|
||||||
//
|
|
||||||
// TRANSLATION: YLatLong <-> LonLat
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {YLatLong} mmLatLong
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.LonLat, translated from the passed in YLatLong
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type OpenLayers.LonLat
|
|
||||||
*/
|
|
||||||
getOLLonLatFromYLatLong: function(mmLatLong) {
|
|
||||||
var olLonLat = null;
|
|
||||||
if (mmLatLong != null) {
|
|
||||||
olLonLat = new OpenLayers.LonLat(mmLatLong.Lon,
|
|
||||||
mmLatLong.Lat);
|
|
||||||
}
|
|
||||||
return olLonLat;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.LonLat} olLonLat
|
|
||||||
*
|
|
||||||
* @returns A YLatLong, translated from the passed in OpenLayers.LonLat
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type YLatLong
|
|
||||||
*/
|
|
||||||
getYLatLongFromOLLonLat: function(olLonLat) {
|
|
||||||
var mmLatLong = null;
|
|
||||||
if (olLonLat != null) {
|
|
||||||
mmLatLong = new YGeoPoint(olLonLat.lat, olLonLat.lon);
|
|
||||||
}
|
|
||||||
return mmLatLong;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// TRANSLATION: Pixel <-> OpenLayers.Pixel
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Pixel} pixel
|
|
||||||
*
|
|
||||||
* @returns An OpenLayers.Pixel, translated from the passed in Pixel
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
* @type OpenLayers.Pixel
|
|
||||||
*/
|
|
||||||
getOLPixelFromPixel: function(pixel) {
|
|
||||||
var olPixel = null;
|
|
||||||
if (pixel != null) {
|
|
||||||
olPixel = new OpenLayers.Pixel(pixel.x, pixel.y);
|
|
||||||
}
|
|
||||||
return olPixel;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {OpenLayers.Pixel} olPixel
|
|
||||||
*
|
|
||||||
* @returns A Pixel, translated from the passed in OpenLayers.Pixel
|
|
||||||
* Returns null if null value is passed in
|
|
||||||
*
|
|
||||||
* As it turns out, the only specifications we can see for the
|
|
||||||
* Y-compatible Pixel is an x & y property, which emmry
|
|
||||||
* OpenLayers.Pixel has by default. So just leamm it as-is.
|
|
||||||
*
|
|
||||||
* @type Pixel
|
|
||||||
*/
|
|
||||||
getPixelFromOLPixel: function(olPixel) {
|
|
||||||
var pixel = null;
|
|
||||||
if (olPixel != null) {
|
|
||||||
pixel = new YCoordPoint(olPixel.x, olPixel.y);
|
|
||||||
}
|
|
||||||
return pixel;
|
|
||||||
},
|
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Layer.Yahoo"
|
CLASS_NAME: "OpenLayers.Layer.Yahoo"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ OpenLayers.Map.prototype = {
|
|||||||
var bounds = this.getExtent();
|
var bounds = this.getExtent();
|
||||||
for (var i = 0; i < this.layers.length; i++) {
|
for (var i = 0; i < this.layers.length; i++) {
|
||||||
var layer = this.layers[i];
|
var layer = this.layers[i];
|
||||||
if (layer.getVisibility()) {
|
if ((layer == this.baseLayer) || !layer.isBaseLayer) {
|
||||||
layer.moveTo(bounds, zoomChanged, minor);
|
layer.moveTo(bounds, zoomChanged, minor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -684,7 +684,7 @@ OpenLayers.Map.prototype = {
|
|||||||
getProjection: function() {
|
getProjection: function() {
|
||||||
var projection = null;
|
var projection = null;
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
projection = this.baseLayer.projection;
|
projection = this.baseLayer.getProjection();
|
||||||
}
|
}
|
||||||
return projection;
|
return projection;
|
||||||
},
|
},
|
||||||
@@ -696,7 +696,7 @@ OpenLayers.Map.prototype = {
|
|||||||
getMaxResolution: function() {
|
getMaxResolution: function() {
|
||||||
var maxResolution = null;
|
var maxResolution = null;
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
maxResolution = this.baseLayer.maxResolution;
|
maxResolution = this.baseLayer.getMaxResolution();
|
||||||
}
|
}
|
||||||
return maxResolution;
|
return maxResolution;
|
||||||
},
|
},
|
||||||
@@ -707,7 +707,7 @@ OpenLayers.Map.prototype = {
|
|||||||
getMaxExtent: function () {
|
getMaxExtent: function () {
|
||||||
var maxExtent = null;
|
var maxExtent = null;
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
maxExtent = this.baseLayer.maxExtent;
|
maxExtent = this.baseLayer.getMaxExtent();
|
||||||
}
|
}
|
||||||
return maxExtent;
|
return maxExtent;
|
||||||
},
|
},
|
||||||
@@ -720,7 +720,7 @@ OpenLayers.Map.prototype = {
|
|||||||
getNumZoomLevels: function() {
|
getNumZoomLevels: function() {
|
||||||
var numZoomLevels = null;
|
var numZoomLevels = null;
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
numZoomLevels = this.baseLayer.numZoomLevels;
|
numZoomLevels = this.baseLayer.getNumZoomLevels();
|
||||||
}
|
}
|
||||||
return numZoomLevels;
|
return numZoomLevels;
|
||||||
},
|
},
|
||||||
@@ -781,35 +781,20 @@ OpenLayers.Map.prototype = {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Bounds} bounds
|
* @param {OpenLayers.Bounds} bounds
|
||||||
*
|
*
|
||||||
* @returns A suitable zoom level for the specified bounds.
|
* @returns A suitable zoom level for the specified bounds.
|
||||||
* If no baselayer is set, returns null.
|
* If no baselayer is set, returns null.
|
||||||
* @type int
|
* @type int
|
||||||
*/
|
*/
|
||||||
getZoomForExtent: function (bounds) {
|
getZoomForExtent: function (bounds) {
|
||||||
var zoom = null;
|
zoom = null;
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
zoom = this.baseLayer.getZoomForExtent(bounds);
|
zoom = this.baseLayer.getZoomForExtent(bounds);
|
||||||
}
|
}
|
||||||
return zoom;
|
return zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {float} resolution
|
|
||||||
*
|
|
||||||
* @returns A suitable zoom level for the specified resolution.
|
|
||||||
* If no baselayer is set, returns null.
|
|
||||||
* @type int
|
|
||||||
*/
|
|
||||||
getZoomForResolution: function(resolution) {
|
|
||||||
var zoom = null;
|
|
||||||
if (this.baseLayer != null) {
|
|
||||||
zoom = this.baseLayer.getZoomForResolution(resolution);
|
|
||||||
}
|
|
||||||
return zoom;
|
|
||||||
},
|
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Zooming Functions */
|
/* Zooming Functions */
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Popup = Class.create();
|
OpenLayers.Popup = Class.create();
|
||||||
|
|
||||||
|
OpenLayers.Popup.count = 0;
|
||||||
OpenLayers.Popup.WIDTH = 200;
|
OpenLayers.Popup.WIDTH = 200;
|
||||||
OpenLayers.Popup.HEIGHT = 200;
|
OpenLayers.Popup.HEIGHT = 200;
|
||||||
OpenLayers.Popup.COLOR = "white";
|
OpenLayers.Popup.COLOR = "white";
|
||||||
@@ -55,11 +56,8 @@ OpenLayers.Popup.prototype = {
|
|||||||
* @param {String} contentHTML
|
* @param {String} contentHTML
|
||||||
*/
|
*/
|
||||||
initialize:function(id, lonlat, size, contentHTML) {
|
initialize:function(id, lonlat, size, contentHTML) {
|
||||||
if (id == null) {
|
OpenLayers.Popup.count += 1;
|
||||||
id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
this.id = (id != null) ? id : "Popup" + OpenLayers.Popup.count;
|
||||||
}
|
|
||||||
|
|
||||||
this.id = id;
|
|
||||||
this.lonlat = lonlat;
|
this.lonlat = lonlat;
|
||||||
this.size = (size != null) ? size
|
this.size = (size != null) ? size
|
||||||
: new OpenLayers.Size(
|
: new OpenLayers.Size(
|
||||||
@@ -72,10 +70,10 @@ OpenLayers.Popup.prototype = {
|
|||||||
this.opacity = OpenLayers.Popup.OPACITY;
|
this.opacity = OpenLayers.Popup.OPACITY;
|
||||||
this.border = OpenLayers.Popup.BORDER;
|
this.border = OpenLayers.Popup.BORDER;
|
||||||
|
|
||||||
this.div = OpenLayers.Util.createDiv(this.id, null, null,
|
this.div = OpenLayers.Util.createDiv(this.id + "_div", null, null,
|
||||||
null, null, null, "hidden");
|
null, null, null, "hidden");
|
||||||
|
|
||||||
this.registerEvents();
|
this.events = new OpenLayers.Events(this, this.div, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,84 +229,5 @@ OpenLayers.Popup.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/** Do this in a separate function so that subclasses can
|
|
||||||
* choose to override it if they wish to deal differently
|
|
||||||
* with mouse events
|
|
||||||
*
|
|
||||||
* Note in the following handler functions that some special
|
|
||||||
* care is needed to deal correctly with mousing and popups.
|
|
||||||
*
|
|
||||||
* Because the user might select the zoom-rectangle option and
|
|
||||||
* then drag it over a popup, we need a safe way to allow the
|
|
||||||
* mousemove and mouseup events to pass through the popup when
|
|
||||||
* they are initiated from outside.
|
|
||||||
*
|
|
||||||
* Otherwise, we want to essentially kill the event propagation
|
|
||||||
* for all other events, though we have to do so carefully,
|
|
||||||
* without disabling basic html functionality, like clicking on
|
|
||||||
* hyperlinks or drag-selecting text.
|
|
||||||
*/
|
|
||||||
registerEvents:function() {
|
|
||||||
this.events = new OpenLayers.Events(this, this.div, null, true);
|
|
||||||
|
|
||||||
this.events.register("mousedown", this, this.onmousedown);
|
|
||||||
this.events.register("mousemove", this, this.onmousemove);
|
|
||||||
this.events.register("mouseup", this, this.onmouseup);
|
|
||||||
this.events.register("click", this,
|
|
||||||
OpenLayers.Util.safeStopPropagation);
|
|
||||||
this.events.register("mouseout", this, this.onmouseout);
|
|
||||||
this.events.register("dblclick", this,
|
|
||||||
OpenLayers.Util.safeStopPropagation);
|
|
||||||
},
|
|
||||||
|
|
||||||
/** When mouse goes down within the popup, make a note of
|
|
||||||
* it locally, and then do not propagate the mousedown
|
|
||||||
* (but do so safely so that user can select text inside)
|
|
||||||
*
|
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
onmousedown: function (evt) {
|
|
||||||
this.mousedown = true;
|
|
||||||
OpenLayers.Util.safeStopPropagation(evt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/** If the drag was started within the popup, then
|
|
||||||
* do not propagate the mousemove (but do so safely
|
|
||||||
* so that user can select text inside)
|
|
||||||
*
|
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
onmousemove: function (evt) {
|
|
||||||
if (this.mousedown) {
|
|
||||||
OpenLayers.Util.safeStopPropagation(evt);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/** When mouse comes up within the popup, after going down
|
|
||||||
* in it, reset the flag, and then (once again) do not
|
|
||||||
* propagate the event, but do so safely so that user can
|
|
||||||
* select text inside
|
|
||||||
*
|
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
onmouseup: function (evt) {
|
|
||||||
if (this.mousedown) {
|
|
||||||
this.mousedown = false;
|
|
||||||
OpenLayers.Util.safeStopPropagation(evt);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/** When mouse goes out of the popup set the flag to false so that
|
|
||||||
* if they let go and then drag back in, we won't be confused.
|
|
||||||
*
|
|
||||||
* @param {Event} evt
|
|
||||||
*
|
|
||||||
* @type Boolean
|
|
||||||
*/
|
|
||||||
onmouseout: function (evt) {
|
|
||||||
this.mousedown = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Popup"
|
CLASS_NAME: "OpenLayers.Popup"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
|||||||
var contentSize = this.size.clone();
|
var contentSize = this.size.clone();
|
||||||
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
|
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
|
||||||
|
|
||||||
var id = this.div.id + "_contentDiv";
|
var id = this.div.id + "-contentDiv";
|
||||||
this.contentDiv = OpenLayers.Util.createDiv(id, null, contentSize,
|
this.contentDiv = OpenLayers.Util.createDiv(id, null, contentSize,
|
||||||
null, "relative", null,
|
null, "relative", null,
|
||||||
"hidden");
|
"hidden");
|
||||||
|
|||||||
@@ -102,9 +102,6 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
this.layer.div.appendChild(this.imgDiv);
|
this.layer.div.appendChild(this.imgDiv);
|
||||||
if(this.layer.opacity != null) {
|
|
||||||
OpenLayers.Util.setOpacity(this.imgDiv, this.layer.opacity);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
@@ -125,29 +125,14 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
|
|||||||
return image;
|
return image;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the opacity of a DOM Element
|
|
||||||
* Note that for this function to work in IE, elements must "have layout"
|
|
||||||
* according to:
|
|
||||||
* http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/haslayout.asp
|
|
||||||
*
|
|
||||||
* @param {DOMElement} element Set the opacity on this DOM element
|
|
||||||
* @param {Float} opacity Opacity value (0.0 - 1.0)
|
|
||||||
*/
|
|
||||||
OpenLayers.Util.setOpacity = function(element, opacity) {
|
|
||||||
element.style.opacity = opacity;
|
|
||||||
element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenLayers.Util.onImageLoad = function() {
|
OpenLayers.Util.onImageLoad = function() {
|
||||||
this.style.backgroundColor = null;
|
this.style.backgroundColor = null;
|
||||||
this.style.display = "";
|
this.style.display = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
OpenLayers.Util.onImageLoadErrorColor = "pink";
|
|
||||||
|
|
||||||
OpenLayers.Util.onImageLoadError = function() {
|
OpenLayers.Util.onImageLoadError = function() {
|
||||||
this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
|
this.style.backgroundColor = "pink";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -516,15 +501,3 @@ OpenLayers.Util.getResolutionFromScale = function (scale, units) {
|
|||||||
* OpenLayers.DOTS_PER_INCH);
|
* OpenLayers.DOTS_PER_INCH);
|
||||||
return resolution;
|
return resolution;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Safely stop the propagation of an event *without* preventing
|
|
||||||
* the default browser action from occurring.
|
|
||||||
*
|
|
||||||
* @param {Event} evt
|
|
||||||
*/
|
|
||||||
OpenLayers.Util.safeStopPropagation = function(evt) {
|
|
||||||
if (evt.stopPropagation) {
|
|
||||||
evt.stopPropagation();
|
|
||||||
}
|
|
||||||
evt.cancelBubble = true;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
<li>test_Layer_KaMap.html</li>
|
<li>test_Layer_KaMap.html</li>
|
||||||
<li>test_Layer_WMS.html</li>
|
<li>test_Layer_WMS.html</li>
|
||||||
<li>test_Layer_Google.html</li>
|
<li>test_Layer_Google.html</li>
|
||||||
<li>test_Layer_MultiMap.html</li>
|
|
||||||
<li>test_Tile.html</li>
|
<li>test_Tile.html</li>
|
||||||
<li>test_Tile_Image.html</li>
|
<li>test_Tile_Image.html</li>
|
||||||
<li>test_Control.html</li>
|
<li>test_Control.html</li>
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ Test.AnotherWay._test_object_t.prototype.delay_call=function()
|
|||||||
Test.AnotherWay._test_object_t.prototype.open_window=function( url, fn, timeout_seconds )
|
Test.AnotherWay._test_object_t.prototype.open_window=function( url, fn, timeout_seconds )
|
||||||
{
|
{
|
||||||
if( timeout_seconds==null ) {
|
if( timeout_seconds==null ) {
|
||||||
timeout_seconds=4;
|
timeout_seconds=2;
|
||||||
}
|
}
|
||||||
var no_close=document.getElementById( "dont_close_test_windows" );
|
var no_close=document.getElementById( "dont_close_test_windows" );
|
||||||
var action={ action_kind: "window", wnd_url: url.toString(), wnd_wnd: null, wnd_fn: fn, wnd_timeout_milliseconds: timeout_seconds*1000, wnd_no_close: no_close.checked };
|
var action={ action_kind: "window", wnd_url: url.toString(), wnd_wnd: null, wnd_fn: fn, wnd_timeout_milliseconds: timeout_seconds*1000, wnd_no_close: no_close.checked };
|
||||||
@@ -785,7 +785,7 @@ Test.AnotherWay._set_iframe_location=function( iframe, loc, outside_path_correct
|
|||||||
Test.AnotherWay._start_loading_page=function()
|
Test.AnotherWay._start_loading_page=function()
|
||||||
{
|
{
|
||||||
var test_page=Test.AnotherWay._g_tests_queue[0];
|
var test_page=Test.AnotherWay._g_tests_queue[0];
|
||||||
test_page.loading_timeout_milliseconds=4000;
|
test_page.loading_timeout_milliseconds=2000;
|
||||||
test_page.timeout_id=setTimeout( Test.AnotherWay._loading_timeout, Test.AnotherWay._g_timeout_granularity );
|
test_page.timeout_id=setTimeout( Test.AnotherWay._loading_timeout, Test.AnotherWay._g_timeout_granularity );
|
||||||
test_page.wait_msg=Test.AnotherWay._print_counter_result( test_page.url, "loading...", test_page.loading_timeout_milliseconds, "loading" );
|
test_page.wait_msg=Test.AnotherWay._print_counter_result( test_page.url, "loading...", test_page.loading_timeout_milliseconds, "loading" );
|
||||||
if( test_page.convention=="jsan" ) {
|
if( test_page.convention=="jsan" ) {
|
||||||
|
|||||||
@@ -28,18 +28,6 @@
|
|||||||
t.ok( boundsCenter.equals(center), "bounds.getCenterLonLat() has correct value" );
|
t.ok( boundsCenter.equals(center), "bounds.getCenterLonLat() has correct value" );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_01a_Bounds_constructorFromStrings(t) {
|
|
||||||
t.plan( 6 );
|
|
||||||
bounds = new OpenLayers.Bounds("0","2","10","4");
|
|
||||||
t.ok( bounds instanceof OpenLayers.Bounds, "new OpenLayers.Bounds returns Bounds object" );
|
|
||||||
t.eq( bounds.CLASS_NAME, "OpenLayers.Bounds", "bounds.CLASS_NAME is set correctly" );
|
|
||||||
t.eq( bounds.left, 0, "bounds.left is set correctly" );
|
|
||||||
t.eq( bounds.bottom, 2, "bounds.bottom is set correctly" );
|
|
||||||
t.eq( bounds.right, 10, "bounds.right is set correctly" );
|
|
||||||
t.eq( bounds.top, 4, "bounds.top is set correctly" );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_02_Bounds_toBBOX(t) {
|
function test_02_Bounds_toBBOX(t) {
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
bounds = new OpenLayers.Bounds(1,2,3,4);
|
bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
|
|||||||
@@ -25,29 +25,26 @@
|
|||||||
}
|
}
|
||||||
function test_03_Control_MouseToolbar_control_events (t) {
|
function test_03_Control_MouseToolbar_control_events (t) {
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
if ((navigator.userAgent.indexOf("compatible") == -1)) {
|
var evt = {which: 1}; // control expects left-click
|
||||||
var evt = {which: 1}; // control expects left-click
|
map = new OpenLayers.Map('map');
|
||||||
map = new OpenLayers.Map('map');
|
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
||||||
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
||||||
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
||||||
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
map.addLayer(layer);
|
||||||
map.addLayer(layer);
|
|
||||||
|
|
||||||
control = new OpenLayers.Control.MouseToolbar();
|
control = new OpenLayers.Control.MouseToolbar();
|
||||||
map.addControl(control);
|
map.addControl(control);
|
||||||
|
|
||||||
var centerLL = new OpenLayers.LonLat(0,0);
|
var centerLL = new OpenLayers.LonLat(0,0);
|
||||||
map.setCenter(centerLL, 5);
|
map.setCenter(centerLL, 5);
|
||||||
|
|
||||||
|
evt.shiftKey = true;
|
||||||
|
evt.xy = new OpenLayers.Size(5,5);
|
||||||
|
control.defaultMouseDown(evt);
|
||||||
|
evt.xy = new OpenLayers.Size(15,15);
|
||||||
|
control.defaultMouseUp(evt);
|
||||||
|
t.eq(map.getZoom(), 5, "Map zoom set correctly after zoombox");
|
||||||
|
|
||||||
evt.shiftKey = true;
|
|
||||||
evt.xy = new OpenLayers.Size(5,5);
|
|
||||||
control.defaultMouseDown(evt);
|
|
||||||
evt.xy = new OpenLayers.Size(15,15);
|
|
||||||
control.defaultMouseUp(evt);
|
|
||||||
t.eq(map.getZoom(), 6, "Map zoom set correctly after zoombox");
|
|
||||||
} else {
|
|
||||||
t.ok(true, "IE does not run this test.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
t.ok( feature instanceof OpenLayers.Feature, "new OpenLayers.Feature returns Feature object" );
|
t.ok( feature instanceof OpenLayers.Feature, "new OpenLayers.Feature returns Feature object" );
|
||||||
t.eq( feature.layer, layer, "feature.layer set correctly" );
|
t.eq( feature.layer, layer, "feature.layer set correctly" );
|
||||||
t.ok( feature.id.startsWith("OpenLayers.Feature_"), "feature.id set correctly" );
|
t.ok( feature.id.startsWith("Feature_"), "feature.id set correctly" );
|
||||||
t.ok( feature.lonlat.equals(lonlat), "feature.lonlat set correctly" );
|
t.ok( feature.lonlat.equals(lonlat), "feature.lonlat set correctly" );
|
||||||
t.eq( feature.data.iconURL, iconURL, "feature.data.iconURL set correctly" );
|
t.eq( feature.data.iconURL, iconURL, "feature.data.iconURL set correctly" );
|
||||||
t.ok( feature.data.iconSize.equals(iconSize), "feature.data.iconSize set correctly" );
|
t.ok( feature.data.iconSize.equals(iconSize), "feature.data.iconSize set correctly" );
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
var layer;
|
var layer;
|
||||||
|
|
||||||
function test_01_Layer_constructor (t) {
|
function test_01_Layer_constructor (t) {
|
||||||
t.plan( 13 );
|
t.plan( 14 );
|
||||||
|
|
||||||
var options = { chicken: 151, foo: "bar", projection: "none" };
|
var options = { chicken: 151, foo: "bar", projection: "none" };
|
||||||
var layer = new OpenLayers.Layer('Test Layer', options);
|
var layer = new OpenLayers.Layer('Test Layer', options);
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||||
t.ok( layer.id != null, "Layer is given an id");
|
t.ok( layer.id != null, "Layer is given an id");
|
||||||
|
t.ok( layer.id.startsWith("Layer_"), "layer id starts correctly");
|
||||||
t.ok( layer.projection, "none", "default layer projection correctly set");
|
t.ok( layer.projection, "none", "default layer projection correctly set");
|
||||||
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
|
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
|
||||||
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
|
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
|
||||||
@@ -103,10 +104,10 @@
|
|||||||
|
|
||||||
var layer = new OpenLayers.Layer('Test Layer', options);
|
var layer = new OpenLayers.Layer('Test Layer', options);
|
||||||
|
|
||||||
t.eq(layer.projection, projection, "projection set correctly");
|
t.eq(layer.getProjection(), projection, "getProjection() works");
|
||||||
t.ok(layer.maxExtent.equals(maxExtent), "maxExtent set correctly");
|
t.ok(layer.getMaxExtent().equals(maxExtent), "getMaxExtent() works");
|
||||||
t.eq(layer.maxResolution, maxResolution, "maxResolution set correctly");
|
t.eq(layer.getMaxResolution(), maxResolution, "getMaxResolution() works");
|
||||||
t.eq(layer.numZoomLevels, numZoomLevels, "numZoomLevels set correctly");
|
t.eq(layer.getNumZoomLevels(), numZoomLevels, "getNumZoomLevels() works");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_05_Layer_visibility(t) {
|
function test_05_Layer_visibility(t) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
// t.plan( 2 );
|
// t.plan( 2 );
|
||||||
|
|
||||||
if (document.createEventObject) {
|
if (document.createEventObject) {
|
||||||
t.plan(2);
|
t.plan(3);
|
||||||
} else {
|
} else {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||||
zoom = layer.getZoomForExtent(bounds);
|
zoom = layer.getZoomForExtent(bounds);
|
||||||
|
|
||||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||||
zoom = layer.getZoomForExtent(bounds);
|
zoom = layer.getZoomForExtent(bounds);
|
||||||
|
|
||||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script>
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
|
||||||
<script type="text/javascript"><!--
|
|
||||||
var layer;
|
|
||||||
|
|
||||||
function test_01_Layer_MultiMap_constructor (t) {
|
|
||||||
t.plan( 4 );
|
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
|
||||||
map.addLayer(layer);
|
|
||||||
|
|
||||||
|
|
||||||
t.ok( layer instanceof OpenLayers.Layer.MultiMap, "new OpenLayers.Layer.MultiMap returns object" );
|
|
||||||
t.eq( layer.CLASS_NAME, "OpenLayers.Layer.MultiMap", "CLASS_NAME variable set correctly");
|
|
||||||
|
|
||||||
t.eq( layer.name, "Goog Layer", "layer.name is correct" );
|
|
||||||
|
|
||||||
t.ok ( layer.multimap != null, "MultiMap Object correctly loaded");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_02_Layer_MultiMap_isBaseLayer (t) {
|
|
||||||
t.plan(1);
|
|
||||||
|
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
|
||||||
|
|
||||||
t.ok(layer.isBaseLayer, "a default load of google layer responds as a base layer");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_03_Layer_MultiMap_Translation_zoom (t) {
|
|
||||||
|
|
||||||
t.plan( 4 );
|
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
|
||||||
map.addLayer(layer);
|
|
||||||
|
|
||||||
// these two lines specify an appropriate translation.
|
|
||||||
// the code afterwards works by itself to test that translation
|
|
||||||
// works correctly both ways.
|
|
||||||
var gZoom = 5;
|
|
||||||
var correspondingOLZoom = 4;
|
|
||||||
|
|
||||||
|
|
||||||
olZoom = layer.getOLZoomFromMMZoom(gZoom);
|
|
||||||
t.eq(olZoom, correspondingOLZoom, "Translation from GZoom to OL Zoom works");
|
|
||||||
t.eq(layer.getMMZoomFromOLZoom(olZoom), gZoom, "Translation from OL Zoom to GZoom works");
|
|
||||||
|
|
||||||
t.ok( layer.getMMZoomFromOLZoom(null) == null, "getGZoomFromOLZoom(null) returns null");
|
|
||||||
t.ok( layer.getOLZoomFromMMZoom(null) == null, "getOLZoomFromGZoom(null) returns null");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_04_Layer_MultiMap_Translation_lonlat (t) {
|
|
||||||
|
|
||||||
t.plan( 4 );
|
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
|
||||||
map.addLayer(layer);
|
|
||||||
|
|
||||||
// these two lines specify an appropriate translation.
|
|
||||||
// the code afterwards works by itself to test that translation
|
|
||||||
// works correctly both ways.
|
|
||||||
var gLatLng = new MMLatLon(50,100);
|
|
||||||
var correspondingOLLonLat = new OpenLayers.LonLat(100,50);
|
|
||||||
|
|
||||||
|
|
||||||
olLonLat = layer.getOLLonLatFromMMLatLong(gLatLng);
|
|
||||||
t.ok(olLonLat.equals(correspondingOLLonLat), "Translation from GLatLng to OpenLayers.LonLat works");
|
|
||||||
|
|
||||||
var transGLatLng = layer.getMMLatLongFromOLLonLat(olLonLat);
|
|
||||||
t.ok( (transGLatLng.lat == gLatLng.lat) && (transGLatLng.lon == transGLatLng.lon), "Translation from OpenLayers.LonLat to GLatLng works");
|
|
||||||
|
|
||||||
t.ok( layer.getMMLatLongFromOLLonLat(null) == null, "getGLatLngFromOLLonLat(null) returns null");
|
|
||||||
t.ok( layer.getOLLonLatFromMMLatLong(null) == null, "getOLLonLatFromGLatLng(null) returns null");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_05_Layer_MultiMap_Translation_pixel (t) {
|
|
||||||
|
|
||||||
t.plan( 4 );
|
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
|
||||||
var layer = new OpenLayers.Layer.MultiMap('Goog Layer');
|
|
||||||
map.addLayer(layer);
|
|
||||||
|
|
||||||
// these two lines specify an appropriate translation.
|
|
||||||
// the code afterwards works by itself to test that translation
|
|
||||||
// works correctly both ways.
|
|
||||||
var gPoint = new MMPoint(50,100);
|
|
||||||
var correspondingOLPixel = new OpenLayers.Pixel(50, 100);
|
|
||||||
|
|
||||||
|
|
||||||
olPixel = layer.getOLPixelFromPixel(gPoint);
|
|
||||||
t.ok( olPixel.equals(correspondingOLPixel), "Translation from GPoint to OpenLayers.Pixel works");
|
|
||||||
|
|
||||||
var transGPoint = layer.getPixelFromOLPixel(olPixel);
|
|
||||||
t.ok( ((transGPoint.x == transGPoint.x) && (transGPoint.y == transGPoint.y)), "Translation from OpenLayers.Pixel to GPoint works");
|
|
||||||
|
|
||||||
t.ok( layer.getPixelFromOLPixel(null) == null, "getGPointFromOLPixel(null) returns null");
|
|
||||||
t.ok( layer.getOLPixelFromPixel(null) == null, "getOLPixelFromGPoint(null) returns null");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function test_99_Layer_destroy (t) {
|
|
||||||
t.plan( 5 );
|
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
|
||||||
|
|
||||||
layer = new OpenLayers.Layer.MultiMap('Test Layer');
|
|
||||||
map.addLayer(layer);
|
|
||||||
|
|
||||||
layer.destroy();
|
|
||||||
|
|
||||||
t.eq( layer.name, null, "layer.name is null after destroy" );
|
|
||||||
t.eq( layer.div, null, "layer.div is null after destroy" );
|
|
||||||
t.eq( layer.map, null, "layer.map is null after destroy" );
|
|
||||||
t.eq( layer.options, null, "layer.options is null after destroy" );
|
|
||||||
t.eq( layer.multimap, null, "layer.gmap is null after destroy" );
|
|
||||||
}
|
|
||||||
// -->
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="map"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -150,31 +150,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_08_Layer_WMS_setOpacity (t) {
|
|
||||||
t.plan( 5 );
|
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
|
||||||
map.projection = "xx";
|
|
||||||
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
|
|
||||||
tParams = { layers: 'basic',
|
|
||||||
format: 'image/png'};
|
|
||||||
tOptions = { 'opacity': '0.5' };
|
|
||||||
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams, tOptions);
|
|
||||||
map.addLayer(tLayer);
|
|
||||||
map.zoomToMaxExtent();
|
|
||||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
|
||||||
t.eq(tLayer.div.firstChild.style.opacity, "0.5", "Opacity on tile is correct");
|
|
||||||
tLayer.setOpacity("0.6");
|
|
||||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
|
||||||
t.eq(tLayer.div.firstChild.style.opacity, "0.6", "Opacity on tile is changed correctly");
|
|
||||||
var pixel = new OpenLayers.Pixel(5,6);
|
|
||||||
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
|
||||||
tile.draw();
|
|
||||||
t.eq(tile.imgDiv.style.opacity, "0.6", "Tile opacity is set correctly");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function test_99_Layer_WMS_destroy (t) {
|
function test_99_Layer_WMS_destroy (t) {
|
||||||
|
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
|
|||||||
@@ -14,15 +14,6 @@
|
|||||||
t.eq( lonlat.lat, 5, "lonlat.lat is set correctly");
|
t.eq( lonlat.lat, 5, "lonlat.lat is set correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_01a_LonLat_constructorFromStrings (t) {
|
|
||||||
t.plan( 4 );
|
|
||||||
lonlat = new OpenLayers.LonLat("6", "5");
|
|
||||||
t.ok( lonlat instanceof OpenLayers.LonLat, "new OpenLayers.LonLat returns LonLat object" );
|
|
||||||
t.eq( lonlat.CLASS_NAME, "OpenLayers.LonLat", "lonlat.CLASS_NAME is set correctly");
|
|
||||||
t.eq( lonlat.lon, 6, "lonlat.lon is set correctly");
|
|
||||||
t.eq( lonlat.lat, 5, "lonlat.lat is set correctly");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_02_LonLat_toString(t) {
|
function test_02_LonLat_toString(t) {
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
lonlat = new OpenLayers.LonLat(5,6);
|
lonlat = new OpenLayers.LonLat(5,6);
|
||||||
|
|||||||
@@ -13,15 +13,6 @@
|
|||||||
t.eq( pixel.y, 6, "pixel.y is set correctly");
|
t.eq( pixel.y, 6, "pixel.y is set correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_01a_Pixel_constructorFromString (t) {
|
|
||||||
t.plan( 4 );
|
|
||||||
pixel = new OpenLayers.Pixel("5","6");
|
|
||||||
t.ok( pixel instanceof OpenLayers.Pixel, "new OpenLayers.Pixel returns Pixel object" );
|
|
||||||
t.eq( pixel.CLASS_NAME, "OpenLayers.Pixel", "pixel.CLASS_NAME is set correctly");
|
|
||||||
t.eq( pixel.x, 5, "pixel.x is set correctly");
|
|
||||||
t.eq( pixel.y, 6, "pixel.y is set correctly");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_02_Pixel_toString(t) {
|
function test_02_Pixel_toString(t) {
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
pixel = new OpenLayers.Pixel(5,6);
|
pixel = new OpenLayers.Pixel(5,6);
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
popup = new OpenLayers.Popup();
|
popup = new OpenLayers.Popup();
|
||||||
|
|
||||||
t.ok( popup instanceof OpenLayers.Popup, "new OpenLayers.Popup returns Popup object" );
|
t.ok( popup instanceof OpenLayers.Popup, "new OpenLayers.Popup returns Popup object" );
|
||||||
t.ok(popup.id.startsWith("OpenLayers.Popup"), "valid default popupid");
|
t.ok(popup.id.startsWith("Popup"), "good default popup.id");
|
||||||
var firstID = popup.id;
|
|
||||||
t.ok(popup.size.equals(size), "good default popup.size");
|
t.ok(popup.size.equals(size), "good default popup.size");
|
||||||
t.eq(popup.contentHTML, "", "good default popup.contentHTML");
|
t.eq(popup.contentHTML, "", "good default popup.contentHTML");
|
||||||
t.eq(popup.backgroundColor, OpenLayers.Popup.COLOR, "good default popup.backgroundColor");
|
t.eq(popup.backgroundColor, OpenLayers.Popup.COLOR, "good default popup.backgroundColor");
|
||||||
@@ -21,9 +20,12 @@
|
|||||||
t.eq(popup.border, OpenLayers.Popup.BORDER, "good default popup.border");
|
t.eq(popup.border, OpenLayers.Popup.BORDER, "good default popup.border");
|
||||||
|
|
||||||
|
|
||||||
|
var oldIndex = parseInt(popup.id.slice("Popup".length));
|
||||||
|
|
||||||
popup = new OpenLayers.Popup();
|
popup = new OpenLayers.Popup();
|
||||||
var newID = popup.id;
|
var newIndex = parseInt(popup.id.slice("Popup".length));
|
||||||
t.ok(newID != firstID, "default id generator creating unique ids");
|
|
||||||
|
t.eq(newIndex, oldIndex + 1, "default id generator incrementing correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_02_Popup_constructor (t) {
|
function test_02_Popup_constructor (t) {
|
||||||
@@ -73,7 +75,7 @@
|
|||||||
popup.setBorder(border);
|
popup.setBorder(border);
|
||||||
popup.draw(new OpenLayers.Pixel(x, y));
|
popup.draw(new OpenLayers.Pixel(x, y));
|
||||||
|
|
||||||
t.eq(popup.div.id, id, "popup.div.id set correctly");
|
t.eq(popup.div.id, id + "_div", "popup.div.id set correctly");
|
||||||
t.eq(popup.div.style.left, x + "px", "left position of popup.div set correctly");
|
t.eq(popup.div.style.left, x + "px", "left position of popup.div set correctly");
|
||||||
t.eq(popup.div.style.top, y + "px", "top position of popup.div set correctly");
|
t.eq(popup.div.style.top, y + "px", "top position of popup.div set correctly");
|
||||||
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
|
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
|
||||||
|
|||||||
@@ -13,15 +13,6 @@
|
|||||||
t.eq( size.h, 6, "size.h is set correctly");
|
t.eq( size.h, 6, "size.h is set correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_01a_Size_constructorFromString (t) {
|
|
||||||
t.plan( 4 );
|
|
||||||
size = new OpenLayers.Size("5","6");
|
|
||||||
t.ok( size instanceof OpenLayers.Size, "new OpenLayers.Size returns size object" );
|
|
||||||
t.eq( size.CLASS_NAME, "OpenLayers.Size", "size.CLASS_NAME is set correctly");
|
|
||||||
t.eq( size.w, 5, "size.w is set correctly");
|
|
||||||
t.eq( size.h, 6, "size.h is set correctly");
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_02_Size_toString(t) {
|
function test_02_Size_toString(t) {
|
||||||
t.plan( 1 );
|
t.plan( 1 );
|
||||||
size = new OpenLayers.Size(5,6);
|
size = new OpenLayers.Size(5,6);
|
||||||
|
|||||||
@@ -121,9 +121,11 @@ class Config:
|
|||||||
for line in open(filename)
|
for line in open(filename)
|
||||||
if line != "\n"] # Skip blank lines
|
if line != "\n"] # Skip blank lines
|
||||||
|
|
||||||
self.forceFirst = lines[lines.index("[first]") + 1:lines.index("[last]")]
|
self.forceFirst = \
|
||||||
|
lines[lines.index("[first]") + 1:lines.index("[last]")]
|
||||||
|
|
||||||
self.forceLast = lines[lines.index("[last]") + 1:lines.index("[exclude]")]
|
self.forceLast = \
|
||||||
|
lines[lines.index("[last]") + 1:lines.index("[exclude]")]
|
||||||
|
|
||||||
self.exclude = lines[lines.index("[exclude]") + 1:]
|
self.exclude = lines[lines.index("[exclude]") + 1:]
|
||||||
|
|
||||||
@@ -161,7 +163,9 @@ if __name__ == "__main__":
|
|||||||
allFiles.append(filepath)
|
allFiles.append(filepath)
|
||||||
|
|
||||||
## Header inserted at the start of each file in the output
|
## Header inserted at the start of each file in the output
|
||||||
HEADER = "/* " + "=" * 70 + " %s\n" + " " + "=" * 70 + " */\n\n"
|
HEADER = "/* " + "=" * 70 + "\n"\
|
||||||
|
" %s\n" +\
|
||||||
|
" " + "=" * 70 + " */\n\n"
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
|
|
||||||
@@ -196,10 +200,12 @@ if __name__ == "__main__":
|
|||||||
## Move forced first and last files to the required position
|
## Move forced first and last files to the required position
|
||||||
if cfg:
|
if cfg:
|
||||||
print "Re-ordering files...\n"
|
print "Re-ordering files...\n"
|
||||||
order = cfg.forceFirst + [item
|
order = cfg.forceFirst + \
|
||||||
|
[item
|
||||||
for item in order
|
for item in order
|
||||||
if ((item not in cfg.forceFirst) and
|
if ((item not in cfg.forceFirst) and
|
||||||
(item not in cfg.forceLast))] + cfg.forceLast
|
(item not in cfg.forceLast))] + \
|
||||||
|
cfg.forceLast
|
||||||
|
|
||||||
## Double check all dependencies have been met
|
## Double check all dependencies have been met
|
||||||
for fp in order:
|
for fp in order:
|
||||||
|
|||||||
Reference in New Issue
Block a user