Compare commits

..

12 Commits

Author SHA1 Message Date
euzuro
363efcf3db update one last license
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.2@1866 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-15 18:49:41 +00:00
euzuro
34b3da4d78 updating license reference for release
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.2@1865 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-15 18:43:34 +00:00
euzuro
c7105a410a tagging final 2.2 release
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.2@1864 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-15 18:36:48 +00:00
euzuro
9dfabad733 replacing branch with repository licence
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1788 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-09 10:11:35 +00:00
euzuro
a5a63727f5 replace license link from repository to release
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1786 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 19:43:36 +00:00
euzuro
8034d2d280 pulling up fixes for #366 #387 #392 from trunk so that we can release RC3
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1785 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 19:07:32 +00:00
euzuro
6bf55d5a43 committing changes to testing code, as brought up from trunk r1781-r1783
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1784 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-11-08 19:03:30 +00:00
crschmidt
526298ea2e Pullups for 2.2-rc2:
#371, Link to license broken
 #376, Fix tile.clear() calls that got overrun during removal of Prototype.js
 #374, Need to bring up new licenses into 2.2 Branch
 #336, create OpenLayers.Layer.Graphic to layers created with simple static images
 #375, No need to exlude Yahoo.js from singlefile build


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1740 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-27 14:26:28 +00:00
euzuro
d9847bbb37 bringing up r1719 from trunk
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1720 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-24 15:30:56 +00:00
euzuro
168f79482b brought up r1717 from trunk
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1718 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-23 17:48:35 +00:00
euzuro
b8064015f6 pullup of 1713 from trunk
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1714 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-22 17:15:12 +00:00
Schuyler Erle
d4d843e57f Branching OpenLayers 2.2 release.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.2@1708 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-10-20 18:36:39 +00:00
80 changed files with 1292 additions and 2117 deletions

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env python
import sys
sys.path.append("../tools")
import jsmin, mergejs
sourceDirectory = "../lib"
configFilename = "library.cfg"
outputFilename = "OpenLayers.js"
if len(sys.argv) > 1:
configFilename = sys.argv[1] + ".cfg"
if len(sys.argv) > 2:
outputFilename = sys.argv[2]
print "Adding license file."
merged = file("license.txt").read()
print "Merging libraries."
merged += mergejs.run(sourceDirectory, None, configFilename)
print "Compressing."
minimized = jsmin.jsmin(merged)
print "Writing to %s." % outputFilename
file(outputFilename, "w").write(minimized)
print "Done."

44
build/build.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
#
# Script to build compressed single file version of OpenLayers library
#
OUTPUT_FILENAME=OpenLayers.js
TMP_OUTPUT_FILENAME=tmp.${OUTPUT_FILENAME}
TOOLS_DIR=../tools
if [ "$1" != "" ]; then
CFG_FILENAME="$1.cfg"
else
CFG_FILENAME=library.cfg
fi
SRC_DIR=../lib
CMD_MERGE_JS=${TOOLS_DIR}/mergejs.py
CMD_SHRINKSAFE=${TOOLS_DIR}/shrinksafe.py
CMD_JSMIN=${TOOLS_DIR}/jsmin.py
LICENSE_HEADER_FILENAME=license.txt
## Generate "fat" single file library version
${CMD_MERGE_JS} -c ${CFG_FILENAME} ${TMP_OUTPUT_FILENAME} ${SRC_DIR}
## Compress ("shrink") the single file library version
echo
echo Shrinking and post-processing...
# (We also append the license header here.)
cat ${LICENSE_HEADER_FILENAME} > ${OUTPUT_FILENAME}
${CMD_JSMIN} <${TMP_OUTPUT_FILENAME} >> ${OUTPUT_FILENAME}
echo Cleaning up...
rm $TMP_OUTPUT_FILENAME
echo
echo Done.

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
rm ../doc/reference.html rm ../doc/reference.html
CLASSES="Map Layer Layer.Image Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Layer.TMS Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MousePosition Control.MouseToolbar Control.OverviewMap Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util Ajax" CLASSES="Map Layer Layer.Image 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.MousePosition Control.MouseToolbar Control.OverviewMap Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util Ajax"
echo "<html> echo "<html>
<head> <head>
<title>OpenLayers Class Reference Documentation</title> <title>OpenLayers Class Reference Documentation</title>

View File

@@ -2,7 +2,7 @@
OpenLayers.js -- OpenLayers Map Viewer Library OpenLayers.js -- OpenLayers Map Viewer Library
Copyright 2005-2006 MetaCarta, Inc., released under the BSD license. Copyright 2005-2006 MetaCarta, Inc., released under a modified BSD license.
Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt
for the full text of the license. for the full text of the license.

View File

@@ -1,38 +0,0 @@
OpenLayers.Control.OverviewMap
This control provides a locator or overview map linked to another map. By default, the overview map shows up in the lower right of the main map and can be expdaned with the '+' button.
* Constructor
OpenLayers.Control.OverviewMap(opts?) -- Creates a new overview map. The opts variable is an object with various options, as described in the options section below.
* Methods
isSuitableOverview() -- {Boolean} -- Determines if the overview map is suitable given the extent and resolution of the main map.
getRectPxBounds() -- {OpenLayers.Bounds|bounds} -- An OpenLayers.Bounds which is the extent rectangle's pixel bounds (relative to the parent element).
setRectPxBounds({OpenLayers.Bounds|bounds}) -- none -- Set extent rectangle pixel bounds.
getRectBoundsFromMapBounds({OpenLayers.Bounds|lonLatBounds}) -- {OpenLayers.Bounds|bounds} -- An OpenLayers.Bounds which is the passed-in map lon/lat extent translated into pixel bounds for the overview map.
getMapBoundsFromRectBounds({OpenLayers.Bounds|pxBounds]}) -- {OpenLayers.Bounds|bounds} -- An OpenLayers.Bounds which is the passed-in overview rect bounds translated into lon/lat bounds for the overview map.
getLonLatFromOverviewPx({OpenLayers.Pixel|pixel}) -- {OpenLayers.LonLat|lonlat} -- An OpenLayers.LonLat which is the passed-in overview map OpenLayers.Pixel translated into lon/lat by the overview map.
getOverviewPxFromLonLat({OpenLayers.LonLat|lonlat}) -- {OpenLayers.Pixel|pixel} -- An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into overview map pixels
* Events
* Rectangle events
They are defined on OverviewMap.rectEvents
mouseover -- rectangle is moused over
mouseout -- rectangle is no longer mousedout
mousemove -- mouse moves inside rectangle
mousedown -- mouse button is pressed over the rectangle.
mouseup -- mouse button is released over the rectangle.
click -- mouse clicked
dblclick -- mouse double clicked
* Map events
They are defined on OverviewMap.mapDivEvents
click -- mouse clicked
* Options:
* minRatio -- The ratio of the overview map resolution to the main map resolution at which to zoom farther out on the overview map.
* maxRatio -- The ratio of the overview map resolution to the main map resolution at which to zoom farther in on the overview map.
* layers -- Ordered list of layers in the overview map. If none, then the map base layer is used.

View File

@@ -1,4 +1,4 @@
OpenLayers.Control.PanZoomBar OpenLayers.Control.PanZoom
Creates a small toolset for controlling the location of the map with panning and zooming, including four directional arrows, a zoom in and zoom out, and a bar on which a slider can be moved to zoom in or out by multiple stops at once. Creates a small toolset for controlling the location of the map with panning and zooming, including four directional arrows, a zoom in and zoom out, and a bar on which a slider can be moved to zoom in or out by multiple stops at once.

View File

@@ -12,5 +12,5 @@ The Google Layer in OpenLayers allows you to include Google Maps functionality i
getGPointFromOLPixel({OpenLayers.Pixel|pixel}) -- GPoint -- Create GPoint from OpenLayers Pixel. getGPointFromOLPixel({OpenLayers.Pixel|pixel}) -- GPoint -- Create GPoint from OpenLayers Pixel.
* Parameters * Parameters
type -- one of G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, used to choose the type of map to display. (See <a href="http://www.google.com/apis/maps/documentation/reference.html#GMapType">GMapType in the Google documentation</a> for more.) type -- one of G_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, used to choose the type of map to display.

View File

@@ -1,15 +0,0 @@
OpenLayers.Layer.TMS
The TMS layer allows one to connect to a TMS -- Tiled Map Service -- server to obtain images.
* Constructor
OpenLayers.Layer.TMS(name, url, options) -- URL is the base URL to the layer. Options is a set of options, extending the parameters of the layer.
* Methods
getURL({OpenLayers.Bounds|bounds}) -- {String} -- Returns a TMS URL for the given bounds based on the properties of the layer.
All other methods are inherited from {OpenLayers.Layer.Grid}
* Options
tileOrigin -- The tileOrigin option will allow you to set your tileOrigin to something other than the lower left extent of your map.
layername -- Name of the layer in the TMS request.
type -- The extension images have.

View File

@@ -2,13 +2,14 @@
<head> <head>
<style type="text/css"> <style type="text/css">
body { font-family: sans-serif; font-weight: bold; font-size: .8em; }
body { body {
border: 0px; border: 0px;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }
#map { #map {
width: 100%; width: 65%;
height: 100%; height: 100%;
border: 0px; border: 0px;
padding: 0px; padding: 0px;
@@ -21,29 +22,86 @@
var lat = 900863; var lat = 900863;
var lon = 235829; var lon = 235829;
var zoom = 6; var zoom = 6;
var map, layer; var map, layer;
function init(){ function init(){
// these should be object methods or something
map = new OpenLayers.Map( $('map') ); map = new OpenLayers.Map( $('map') );
var basemap = new OpenLayers.Layer.WMS( "Boston", var basemap = new OpenLayers.Layer.WMS( "Boston",
"http://boston.freemap.in/cgi-bin/mapserv?", "http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/gmaps.map', layers: 'border,water,roads,rapid_transit,buildings', format: 'png', 'transparent': 'off'}, {map: '/www/freemap.in/boston/map/gmaps.map', layers: 'border,water,roads', format: 'png', 'transparent': 'off'},
// These are the important parts for creating a non-epsg:4326
// map: Maxextent is the boundary of the map/tile loading area,
// maxResolution is the units/pixel at the highest zoom, and
// projection is the projection to be used in WMS/WFS Requests.
{maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656), maxResolution: 296985/1024, projection:"EPSG:2805" } ); {maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656), maxResolution: 296985/1024, projection:"EPSG:2805" } );
var rapid = new OpenLayers.Layer.WMS( "Rapid Transit",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'rapid_transit', format: 'png', transparent:'true'} );
var buildings = new OpenLayers.Layer.WMS( "Buildings",
"http://boston.freemap.in/cgi-bin/mapserv?",
{map: '/www/freemap.in/boston/map/mass.map', layers: 'buildings', format: 'png', transparent:'true'} );
map.addLayer(basemap); map.addLayer(basemap);
map.addLayer(rapid);
map.addLayer(buildings);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.LayerSwitcher());
} }
function getaddress() {
if (!document.getElementById('address').value) {return; }
document.getElementById('status').innerHTML = "Finding address...";
var address = document.getElementById('address').value;
address = escape(address);
addr = "/geocode.cgi?address="+address;
var handler = XMLrequest();
if (handler) {
handler.onreadystatechange=function() {
if (handler.readyState == 4 && handler.status == 200) {
var latlon = handler.responseText;
latlon = latlon.split(",");
if (latlon[1]) {
map.setCenter(new OpenLayers.LonLat(parseFloat(latlon[1]), parseFloat(latlon[0])), 15);
document.getElementById('status').innerHTML = "";
} else {
document.getElementById('status').innerHTML = "Could not find address, sorry.";
}
}
}
handler.open("GET", addr, true);
handler.send('');
}
}
function XMLrequest() {
xmlhttp={};
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) { }
}
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {}
return xmlhttp;
}
function setLink() {
var link = document.getElementById("link");
var center = map.getCenter();
var zoom = map.getZoom();
link.innerHTML="http://boston.freemap.in/?zoom="+zoom+"&amp;lat="+center.lat+"&amp;lon="+center.lon;
}
// --> // -->
</script> </script>
</head> </head>
<body onload="init()"> <body onload="init()">
<div id="right" style="float:right;width:30%;padding:10px;" ><h1>Boston Free Map</h1><!--Search: <input type="text" id='address' name="address"><input type="submit" value="Go!" onclick="javascript:getaddress()"/>--><div id="status" style="height:20px;min-height:20px;">&nbsp;</div>
<div>Map powered by <a href="http://www.openlayers.org/">OpenLayers</a>
and <a href="http://mapserver.gis.umn.edu/">MapServer</a>.
Data downloaded from
<a href="http://www.mass.gov/mgis/">Office of Geographic and Environmental Information (MassGIS)</a>.</div>
<!--<a onclick="setLink(); return false" href="#" id="update">Update Link</a>
<div id="link"></div>-->
</div>
<div id="map"></div> <div id="map"></div>
</body> </body>
</html> </html>

View File

@@ -14,7 +14,7 @@
var map = new OpenLayers.Map('map'); var map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com:80/wms/vmap0?", {layers: 'basic'}); "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi", "http://wms.jpl.nasa.gov/wms.cgi",

View File

@@ -59,7 +59,7 @@
"http://terraservice.net/ogcmap.ashx", "http://terraservice.net/ogcmap.ashx",
{layers: "DRG"}); {layers: "DRG"});
shade = new OpenLayers.Layer.WMS("Shaded Relief", shade = new OpenLayers.Layer.WMS("Shaded Relief",
"http://ims.cr.usgs.gov/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3", "http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3",
{layers: "HR-NED.IMAGE", reaspect: "false", transparent: 'true'}, {layers: "HR-NED.IMAGE", reaspect: "false", transparent: 'true'},
{isBaseLayer: false, opacity: 0.3}); {isBaseLayer: false, opacity: 0.3});
map.addLayers([drg, shade]); map.addLayers([drg, shade]);

View File

@@ -1,43 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Cursor Example</title>
<style type="text/css">
#map {
width: 700px;
height: 400px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', { controls: [] });
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.MousePosition());
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} );
map.addLayers([ol_wms]);
OpenLayers.Event.observe($('map'),"click",mapclicked.bindAsEventListener(map));
function mapclicked(e){
var lonlat = map.getLonLatFromPixel(e.xy);
alert("Lat: " + lonlat.lat + " (Pixel.x:" + e.xy.x + ")" + "\n" + "Lon: " + lonlat.lon + " (Pixel.y:" + e.xy.y + ")" );
};
if (!map.getCenter()) map.zoomToMaxExtent();
}
// -->
</script>
</head>
<body onload="init()">
<h1>OpenLayers Cursor Example</h1>
<div id="map"></div>
</body>
</html>

View File

@@ -1,35 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( $('map') );
var urlArray = ["http://labs.metacarta.com/wms-c/Basic.py",
"http://monitor.metacarta.com/wms-c/Basic.py"];
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
urlArray,
{layers: 'basic'} );
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
// -->
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>

View File

@@ -1,47 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Overview Map Example</title>
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
<style>
#map{
width:100%;
height:500px;
border:1px solid;
}
</style>
</head>
<body>
<div id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
// my city
var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
map.addLayers([
nasa_wms,
wms
]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
var options = {
layers: [wms.clone()],
minRatio: 8,
maxRatio: 128
};
var overview = new OpenLayers.Control.OverviewMap(options);
map.addControl(overview);
map.setCenter(constantina, 4);
overview.maximizeControl();
</script>
</body>
</html>

View File

@@ -1,4 +1,4 @@
point title description icon point title description iconSize
10,20 my orange title my orange description 10,20 my orange title my orange description 21,25
2,4 my aqua title my aqua description 2,4 my aqua title my aqua description 21,25
42,-71 my purple title my purple description<br/>is great. http://www.openlayers.org/api/img/zoom-world-mini.png 42,-71 my purple title my purple description<br/>is great. 21,25

View File

@@ -1,39 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map( $('map'), {maxResolution:1.40625/2} );
layer = new OpenLayers.Layer.TMS( "TMS",
"http://labs.metacarta.com/wms-c/Basic.py/", {layername: 'basic', type:'png'} );
map.addLayer(layer);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
function addTMS() {
l=new OpenLayers.Layer.TMS($('layer').value, $('url').value, {layername: $('layer').value, type:$('type').value});
map.addLayer(l);
map.setBaseLayer(l);
}
// -->
</script>
</head>
<body onload="init()">
URL of TMS (Should end in /): <input type="text" id="url" size="60" /> layer_name <input type="text" id="layer" /> <select id="type"><option>png</option><option>jpg</option></select> <input type="submit" onclick="addTMS()"/><br />
Example: http://mapserver.refractions.net/cgi-bin/tms/, global_mosaic, jpg
<div id="map"></div>
</body>
</html>

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -86,7 +86,6 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
"OpenLayers/Layer/GeoRSS.js", "OpenLayers/Layer/GeoRSS.js",
"OpenLayers/Layer/Boxes.js", "OpenLayers/Layer/Boxes.js",
"OpenLayers/Layer/Canvas.js", "OpenLayers/Layer/Canvas.js",
"OpenLayers/Layer/TMS.js",
"OpenLayers/Popup/Anchored.js", "OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js", "OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Control.js", "OpenLayers/Control.js",

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -354,12 +354,12 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.div.appendChild(this.layersDiv); this.div.appendChild(this.layersDiv);
OpenLayers.Rico.Corner.round(this.div, {corners: "tl bl", Rico.Corner.round(this.div, {corners: "tl bl",
bgColor: "transparent", bgColor: "transparent",
color: this.activeColor, color: this.activeColor,
blend: false}); blend: false});
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75); Rico.Corner.changeOpacity(this.layersDiv, 0.75);
var imgLocation = OpenLayers.Util.getImagesLocation(); var imgLocation = OpenLayers.Util.getImagesLocation();
var sz = new OpenLayers.Size(18,18); var sz = new OpenLayers.Size(18,18);

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -20,6 +20,14 @@ OpenLayers.Control.MouseDefaults.prototype =
*/ */
initialize: function() { initialize: function() {
OpenLayers.Control.prototype.initialize.apply(this, arguments); OpenLayers.Control.prototype.initialize.apply(this, arguments);
//register mousewheel events specifically on the window and document
OpenLayers.Event.observe(window, "DOMMouseScroll",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(window, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(document, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
}, },
/** /**
@@ -32,24 +40,6 @@ OpenLayers.Control.MouseDefaults.prototype =
this.map.events.register( "mouseup", this, this.defaultMouseUp ); this.map.events.register( "mouseup", this, this.defaultMouseUp );
this.map.events.register( "mousemove", this, this.defaultMouseMove ); this.map.events.register( "mousemove", this, this.defaultMouseMove );
this.map.events.register( "mouseout", this, this.defaultMouseOut ); this.map.events.register( "mouseout", this, this.defaultMouseOut );
this.registerWheelEvents();
},
/**
*
*/
registerWheelEvents: function() {
//register mousewheel events specifically on the window and document
OpenLayers.Event.observe(window, "DOMMouseScroll",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(window, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
OpenLayers.Event.observe(document, "mousewheel",
this.onWheelEvent.bindAsEventListener(this));
}, },
/** /**
@@ -104,9 +94,6 @@ OpenLayers.Control.MouseDefaults.prototype =
* @param {Event} evt * @param {Event} evt
*/ */
defaultMouseMove: function (evt) { defaultMouseMove: function (evt) {
// record the mouse position, used in onWheelEvent
this.mousePosition = evt.xy.clone();
if (this.mouseDragStart != null) { if (this.mouseDragStart != null) {
if (this.zoomBox) { if (this.zoomBox) {
var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x);
@@ -168,21 +155,15 @@ OpenLayers.Control.MouseDefaults.prototype =
/** User spun scroll wheel up /** User spun scroll wheel up
* *
*/ */
defaultWheelUp: function(evt) { defaultWheelUp: function() {
if (this.map.getZoom() <= this.map.getNumZoomLevels()) { this.map.zoomIn();
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
this.map.getZoom() + 1);
}
}, },
/** User spun scroll wheel down /** User spun scroll wheel down
* *
*/ */
defaultWheelDown: function(evt) { defaultWheelDown: function() {
if (this.map.getZoom() > 0) { this.map.zoomOut();
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
this.map.getZoom() - 1);
}
}, },
/** Zoombox function. /** Zoombox function.
@@ -257,15 +238,10 @@ OpenLayers.Control.MouseDefaults.prototype =
delta = -e.detail / 3; delta = -e.detail / 3;
} }
if (delta) { if (delta) {
// add the mouse position to the event because mozilla has a bug
// with clientX and clientY (see https://bugzilla.mozilla.org/show_bug.cgi?id=352179)
// getLonLatFromViewPortPx(e) returns wrong values
e.xy = this.mousePosition;
if (delta < 0) { if (delta < 0) {
this.defaultWheelDown(e); this.defaultWheelDown();
} else { } else {
this.defaultWheelUp(e); this.defaultWheelUp();
} }
} }

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -48,10 +48,8 @@ OpenLayers.Control.MouseToolbar.prototype =
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan."); this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan.");
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
this.switchModeTo("pan"); this.switchModeTo("pan");
this.registerWheelEvents();
return this.div; return this.div;
}, },
_addButton:function(id, img, activeImg, xy, sz, title) { _addButton:function(id, img, activeImg, xy, sz, title) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -96,9 +96,9 @@ OpenLayers.Event = {
|| element.detachEvent)) || element.detachEvent))
name = 'keydown'; name = 'keydown';
if (element && element.removeEventListener) { if (element.removeEventListener) {
element.removeEventListener(name, observer, useCapture); element.removeEventListener(name, observer, useCapture);
} else if (element && element.detachEvent) { } else if (element.detachEvent) {
element.detachEvent('on' + name, observer); element.detachEvent('on' + name, observer);
} }
} }

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -508,8 +508,8 @@ OpenLayers.Layer.prototype = {
var center = this.map.getCenter(); var center = this.map.getCenter();
var res = this.map.getResolution(); var res = this.map.getResolution();
var delta_x = viewPortPx.x - Math.ceil(size.w / 2); var delta_x = viewPortPx.x - (size.w / 2);
var delta_y = viewPortPx.y - Math.ceil(size.h / 2); var delta_y = viewPortPx.y - (size.h / 2);
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
center.lat - delta_y * res); center.lat - delta_y * res);

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -45,7 +45,7 @@ OpenLayers.Layer.GeoRSS.prototype =
}, },
/** /**
* @param {XMLHttpRequest} ajaxRequest * @param {?} ajaxRequest
*/ */
parseData: function(ajaxRequest) { parseData: function(ajaxRequest) {
var doc = ajaxRequest.responseXML; var doc = ajaxRequest.responseXML;

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -107,33 +107,21 @@ OpenLayers.Layer.Grid.prototype =
|| !this.getGridBounds().containsBounds(bounds, true)) { || !this.getGridBounds().containsBounds(bounds, true)) {
this._initTiles(); this._initTiles();
} else { } else {
var buffer = (this.buffer) ? this.buffer*1.5 : 1;
while (true) { while (true) {
var tlLayer = this.grid[0][0].position; var tlLayer = this.grid[0][0].position;
var tlViewPort = var tlViewPort =
this.map.getViewPortPxFromLayerPx(tlLayer); this.map.getViewPortPxFromLayerPx(tlLayer);
if (tlViewPort.x > -this.tileSize.w * (buffer - 1)) { if (tlViewPort.x > -this.tileSize.w * (this.buffer - 1)) {
this.shiftColumn(true); this.shiftColumn(true);
} else if (tlViewPort.x < -this.tileSize.w * buffer) { } else if (tlViewPort.x < -this.tileSize.w * this.buffer) {
this.shiftColumn(false); this.shiftColumn(false);
} else if (tlViewPort.y > -this.tileSize.h * (buffer - 1)) { } else if (tlViewPort.y > -this.tileSize.h * (this.buffer - 1)) {
this.shiftRow(true); this.shiftRow(true);
} else if (tlViewPort.y < -this.tileSize.h * buffer) { } else if (tlViewPort.y < -this.tileSize.h * this.buffer) {
this.shiftRow(false); this.shiftRow(false);
} else { } else {
break; break;
} }
};
if (this.buffer == 0) {
for (var r=0, rl=this.grid.length; r<rl; r++) {
var row = this.grid[r];
for (var c=0, cl=row.length; c<cl; c++) {
var tile = row[c];
if (!tile.drawn && tile.bounds.intersectsBounds(bounds, false)) {
tile.draw();
}
}
}
} }
} }
} }
@@ -165,13 +153,7 @@ OpenLayers.Layer.Grid.prototype =
* @private * @private
*/ */
_initTiles:function() { _initTiles:function() {
// work out mininum number of rows and columns; this is the number of
// tiles required to cover the viewport plus one for panning
var viewSize = this.map.getSize(); var viewSize = this.map.getSize();
var minRows = Math.ceil(viewSize.h/this.tileSize.h) + 1;
var minCols = Math.ceil(viewSize.w/this.tileSize.w) + 1;
var bounds = this.map.getExtent(); var bounds = this.map.getExtent();
var extent = this.map.getMaxExtent(); var extent = this.map.getMaxExtent();
var resolution = this.map.getResolution(); var resolution = this.map.getResolution();
@@ -234,31 +216,12 @@ OpenLayers.Layer.Grid.prototype =
tileoffsetlon += tilelon; tileoffsetlon += tilelon;
tileoffsetx += this.tileSize.w; tileoffsetx += this.tileSize.w;
} while ((tileoffsetlon <= bounds.right + tilelon * this.buffer) } while (tileoffsetlon <= bounds.right + tilelon * this.buffer)
|| colidx < minCols)
tileoffsetlat -= tilelat; tileoffsetlat -= tilelat;
tileoffsety += this.tileSize.h; tileoffsety += this.tileSize.h;
} while((tileoffsetlat >= bounds.bottom - tilelat * this.buffer) } while(tileoffsetlat >= bounds.bottom - tilelat * this.buffer)
|| rowidx < minRows)
// remove extra rows
while (this.grid.length > rowidx) {
var row = this.grid.pop();
for (var i=0, l=row.length; i<l; i++) {
row[i].destroy();
}
}
// remove extra columns
while (this.grid[0].length > colidx) {
for (var i=0, l=this.grid.length; i<l; i++) {
var row = this.grid[i];
var tile = row.pop();
tile.destroy();
}
}
//now actually draw the tiles //now actually draw the tiles
this.spiralTileLoad(); this.spiralTileLoad();
}, },
@@ -362,9 +325,8 @@ OpenLayers.Layer.Grid.prototype =
for(var iRow=0; iRow < this.grid.length; iRow++) { for(var iRow=0; iRow < this.grid.length; iRow++) {
var row = this.grid[iRow]; var row = this.grid[iRow];
for(var iCol=0; iCol < row.length; iCol++) { for(var iCol=0; iCol < row.length; iCol++) {
row[iCol].destroy(); OpenLayers.Util.clearArray(row[iCol]);
} }
this.grid = [];
} }
} }
}, },

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -109,34 +109,21 @@ OpenLayers.Layer.HTTPRequest.prototype =
// use layer's url unless altUrl passed in // use layer's url unless altUrl passed in
var url = (altUrl == null) ? this.url : altUrl; var url = (altUrl == null) ? this.url : altUrl;
// if url is not a string, it should be an array of strings,
// in which case we will randomly select one of them in order
// to evenly distribute requests to different urls.
if (typeof url == "object") {
url = url[Math.floor(Math.random()*url.length)];
}
// requestString always starts with url // requestString always starts with url
var requestString = url; var requestString = url;
// create a new params hashtable with all the layer params and the // create a new params hashtable with all the layer params and the
// new params together. then convert to string // new params together. then convert to string
var allParams = OpenLayers.Util.extend(new Object(), this.params); var allParams = OpenLayers.Util.extend(new Object(), this.params);
allParams = OpenLayers.Util.extend(allParams, newParams); var allParams = OpenLayers.Util.extend(allParams, newParams);
// ignore parameters that are already in the url search string
var urlParams = OpenLayers.Util.upperCaseObject(
OpenLayers.Util.getArgs(url));
for(var key in allParams) {
if(key.toUpperCase() in urlParams) {
delete allParams[key];
}
}
var paramsString = OpenLayers.Util.getParameterString(allParams); var paramsString = OpenLayers.Util.getParameterString(allParams);
if (paramsString != "") { if (paramsString != "") {
var lastServerChar = url.charAt(url.length - 1); var lastServerChar = this.url.charAt(this.url.length - 1);
if ((lastServerChar == "&") || (lastServerChar == "?")) { if ((lastServerChar == "&") || (lastServerChar == "?")) {
requestString += paramsString; requestString += paramsString;
} else { } else {
if (url.indexOf('?') == -1) { if (this.url.indexOf('?') == -1) {
//serverPath has no ? -- add one //serverPath has no ? -- add one
requestString += '?' + paramsString; requestString += '?' + paramsString;
} else { } else {

View File

@@ -1,161 +1,161 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
/** /**
* @fileoverview Image Layer * @fileoverview Image Layer
* @author Tim Schaub * @author Tim Schaub
*/ */
/** /**
* @class * @class
* *
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
*/ */
OpenLayers.Layer.Image = OpenLayers.Class.create(); OpenLayers.Layer.Image = OpenLayers.Class.create();
OpenLayers.Layer.Image.prototype = OpenLayers.Layer.Image.prototype =
OpenLayers.Class.inherit(OpenLayers.Layer, { OpenLayers.Class.inherit(OpenLayers.Layer, {
/** By default, Layer.Image will be a baselayer /** By default, Layer.Image will be a baselayer
* *
* @type Boolean */ * @type Boolean */
isBaseLayer: true, isBaseLayer: true,
/** @type String */ /** @type String */
url: null, url: null,
/** @type OpenLayers.Bounds */ /** @type OpenLayers.Bounds */
extent: null, extent: null,
/** @type OpenLayers.Size */ /** @type OpenLayers.Size */
size: null, size: null,
/** @type OpenLayers.Tile.Image */ /** @type OpenLayers.Tile.Image */
tile: null, tile: null,
/** The ratio of height/width represented by a single pixel in the graphic /** The ratio of height/width represented by a single pixel in the graphic
* *
* @type Float */ * @type Float */
aspectRatio: null, aspectRatio: null,
/** /**
* @constructor * @constructor
* *
* @param {String} name * @param {String} name
* @param {String} url Relative or absolute path to the image * @param {String} url Relative or absolute path to the image
* @param {OpenLayers.Bounds} extent The extent represented by the image * @param {OpenLayers.Bounds} extent The extent represented by the image
* @param {OpenLayers.Size} size The size (in pixels) of the image * @param {OpenLayers.Size} size The size (in pixels) of the image
* @param {Object} options Hashtable of extra options to tag onto the layer * @param {Object} options Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, url, extent, size, options) { initialize: function(name, url, extent, size, options) {
this.url = url; this.url = url;
this.extent = extent; this.extent = extent;
this.size = size; this.size = size;
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]); OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
this.aspectRatio = (this.extent.getHeight() / this.size.h) / this.aspectRatio = (this.extent.getHeight() / this.size.h) /
(this.extent.getWidth() / this.size.w); (this.extent.getWidth() / this.size.w);
}, },
/** /**
* *
*/ */
destroy: function() { destroy: function() {
this.tile.destroy(); this.tile.destroy();
this.tile = null; this.tile = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments); OpenLayers.Layer.prototype.destroy.apply(this, arguments);
}, },
/** /**
* @param {Object} obj * @param {Object} obj
* *
* @returns An exact clone of this OpenLayers.Layer.Image * @returns An exact clone of this OpenLayers.Layer.Image
* @type OpenLayers.Layer.Image * @type OpenLayers.Layer.Image
*/ */
clone: function(obj) { clone: function(obj) {
if(obj == null) { if(obj == null) {
obj = new OpenLayers.Layer.Image(this.name, obj = new OpenLayers.Layer.Image(this.name,
this.url, this.url,
this.extent, this.extent,
this.size, this.size,
this.options); this.options);
} }
//get all additions from superclasses //get all additions from superclasses
obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]); obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here // copy/set any non-init, non-simple values here
return obj; return obj;
}, },
/** /**
* @param {OpenLayers.Map} map * @param {OpenLayers.Map} map
*/ */
setMap: function(map) { setMap: function(map) {
// If nothing to do with resolutions has been set, assume a single // If nothing to do with resolutions has been set, assume a single
// resolution determined by extent/size // resolution determined by extent/size
if( this.options.maxResolution == null ) { if( this.options.maxResolution == null ) {
this.options.maxResolution = this.extent.getWidth() / this.size.w; this.options.maxResolution = this.extent.getWidth() / this.size.w;
} }
OpenLayers.Layer.prototype.setMap.apply(this, arguments); OpenLayers.Layer.prototype.setMap.apply(this, arguments);
}, },
/** Create the tile for the image or resize it for the new resolution /** Create the tile for the image or resize it for the new resolution
* *
* @param {OpenLayers.Bounds} bounds * @param {OpenLayers.Bounds} bounds
* @param {Boolean} zoomChanged * @param {Boolean} zoomChanged
* @param {Boolean} dragging * @param {Boolean} dragging
*/ */
moveTo:function(bounds, zoomChanged, dragging) { moveTo:function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments); OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
var firstRendering = (this.tile == null); var firstRendering = (this.tile == null);
if(zoomChanged || firstRendering) { if(zoomChanged || firstRendering) {
//determine new tile size //determine new tile size
var tileWidth = this.extent.getWidth() / this.map.getResolution(); var tileWidth = this.extent.getWidth() / this.map.getResolution();
var tileHeight = this.extent.getHeight() / var tileHeight = this.extent.getHeight() /
(this.map.getResolution() * this.aspectRatio); (this.map.getResolution() * this.aspectRatio);
var tileSize = new OpenLayers.Size(tileWidth, tileHeight); var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
//determine new position (upper left corner of new bounds) //determine new position (upper left corner of new bounds)
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top); var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
var ulPx = this.map.getLayerPxFromLonLat(ul); var ulPx = this.map.getLayerPxFromLonLat(ul);
if(firstRendering) { if(firstRendering) {
//create the new tile //create the new tile
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent, this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
this.url, tileSize); this.url, tileSize);
} else { } else {
//just resize the tile and set it's new position //just resize the tile and set it's new position
this.tile.size = tileSize.clone(); this.tile.size = tileSize.clone();
this.tile.position = ulPx.clone(); this.tile.position = ulPx.clone();
} }
this.tile.draw(); this.tile.draw();
} }
}, },
/** /**
* @param {String} newUrl * @param {String} newUrl
*/ */
setUrl: function(newUrl) { setUrl: function(newUrl) {
this.url = newUrl; this.url = newUrl;
this.draw(); this.draw();
}, },
/** The url we return is always the same (the image itself never changes) /** The url we return is always the same (the image itself never changes)
* so we can ignore the bounds parameter (it will always be the same, * so we can ignore the bounds parameter (it will always be the same,
* anyways) * anyways)
* *
* @param {OpenLayers.Bounds} bounds * @param {OpenLayers.Bounds} bounds
*/ */
getURL: function(bounds) { getURL: function(bounds) {
return this.url; return this.url;
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Image" CLASS_NAME: "OpenLayers.Layer.Image"
}); });

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,101 +1,101 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
// @requires OpenLayers/Layer/Grid.js // @requires OpenLayers/Layer/Grid.js
/** /**
* @class * @class
*/ */
OpenLayers.Layer.MapServer = OpenLayers.Class.create(); OpenLayers.Layer.MapServer = OpenLayers.Class.create();
OpenLayers.Layer.MapServer.prototype = OpenLayers.Layer.MapServer.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, { OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
/** @final @type hash */ /** @final @type hash */
DEFAULT_PARAMS: { DEFAULT_PARAMS: {
mode: "map", mode: "map",
map_imagetype: "png" map_imagetype: "png"
}, },
/** /**
* @constructor * @constructor
* *
* @param {str} name * @param {str} name
* @param {str} url * @param {str} url
* @param {hash} params * @param {hash} params
*/ */
initialize: function(name, url, params) { initialize: function(name, url, params) {
var newArguments = new Array(); var newArguments = new Array();
//uppercase params //uppercase params
params = OpenLayers.Util.upperCaseObject(params); params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params); newArguments.push(name, url, params);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) { if (arguments.length > 0) {
OpenLayers.Util.applyDefaults( OpenLayers.Util.applyDefaults(
this.params, this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
); );
} }
}, },
/** /**
* @type Boolean * @type Boolean
*/ */
isBaseLayer: function() { isBaseLayer: function() {
return (this.params.TRANSPARENT != 'true'); return (this.params.TRANSPARENT != 'true');
}, },
/** /**
* @param {String} name * @param {String} name
* @param {hash} params * @param {hash} params
* *
* @returns A clone of this OpenLayers.Layer.MapServer, with the passed-in * @returns A clone of this OpenLayers.Layer.MapServer, with the passed-in
* parameters merged in. * parameters merged in.
* @type OpenLayers.Layer.MapServer * @type OpenLayers.Layer.MapServer
*/ */
clone: function (name, params) { clone: function (name, params) {
var mergedParams = {}; var mergedParams = {};
OpenLayers.Util.extend(mergedParams, this.params); OpenLayers.Util.extend(mergedParams, this.params);
OpenLayers.Util.extend(mergedParams, params); OpenLayers.Util.extend(mergedParams, params);
var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams); var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams);
obj.setTileSize(this.tileSize); obj.setTileSize(this.tileSize);
return obj; return obj;
}, },
/** /**
* addTile creates a tile, initializes it (via 'draw' in this case), and * addTile creates a tile, initializes it (via 'draw' in this case), and
* adds it to the layer div. * adds it to the layer div.
* *
* @param {OpenLayers.Bounds} bounds * @param {OpenLayers.Bounds} bounds
* *
* @returns The added OpenLayers.Tile.Image * @returns The added OpenLayers.Tile.Image
* @type OpenLayers.Tile.Image * @type OpenLayers.Tile.Image
*/ */
addTile:function(bounds,position) { addTile:function(bounds,position) {
var url = this.getURL(bounds); var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize); return new OpenLayers.Tile.Image(this, position, bounds, url, this.tileSize);
}, },
/** /**
* @param {OpenLayers.Bounds} bounds * @param {OpenLayers.Bounds} bounds
* *
* @returns A string with the layer's url and parameters and also the * @returns A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as * passed-in bounds and appropriate tile size specified as
* parameters * parameters
* @type String * @type String
*/ */
getURL: function (bounds) { getURL: function (bounds) {
var url = this.getFullRequestString( var url = this.getFullRequestString(
{mapext:bounds.toBBOX().replace(/,/g,"+"), {mapext:bounds.toBBOX().replace(/,/g,"+"),
imgext:bounds.toBBOX().replace(/,/g,"+"), imgext:bounds.toBBOX().replace(/,/g,"+"),
map_size:this.tileSize.w+'+'+this.tileSize.h, map_size:this.tileSize.w+'+'+this.tileSize.h,
imgx: this.tileSize.w/2, imgx: this.tileSize.w/2,
imgy: this.tileSize.h/2, imgy: this.tileSize.h/2,
imgxy: this.tileSize.w+"+"+this.tileSize.h imgxy: this.tileSize.w+"+"+this.tileSize.h
}); });
return url; return url;
}, },
/** @final @type String */ /** @final @type String */
CLASS_NAME: "OpenLayers.Layer.MapServer" CLASS_NAME: "OpenLayers.Layer.MapServer"
}); });

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,112 +0,0 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD licence.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
*
* @requires OpenLayers/Layer/Grid.js
*/
OpenLayers.Layer.TMS = OpenLayers.Class.create();
OpenLayers.Layer.TMS.prototype =
OpenLayers.Class.inherit( OpenLayers.Layer.Grid, {
reproject: false,
isBaseLayer: true,
tileOrigin: null,
/**
* @constructor
*
* @param {String} name
* @param {String} url
* @param {Object} params
* @param {Object} options Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
var newArguments = new Array();
newArguments.push(name, url, {}, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
},
/**
*
*/
destroy: function() {
// for now, nothing special to do here.
OpenLayers.Layer.Grid.prototype.destroy.apply(this, arguments);
},
/**
* @param {Object} obj
*
* @returns An exact clone of this OpenLayers.Layer.TMS
* @type OpenLayers.Layer.TMS
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.TMS(this.name,
this.url,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here
return obj;
},
/**
* @param {OpenLayers.Bounds} bounds
*
* @returns A string with the layer's url and parameters and also the
* passed-in bounds and appropriate tile size specified as
* parameters
* @type String
*/
getURL: function (bounds) {
var res = this.map.getResolution();
var x = (bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w);
var y = (bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h);
var z = this.map.getZoom();
return this.url + "1.0.0" + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
},
/**
* addTile creates a tile, initializes it, and
* adds it to the layer div.
*
* @param {OpenLayers.Bounds} bounds
*
* @returns The added OpenLayers.Tile.Image
* @type OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
var url = this.getURL(bounds);
return new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize);
},
/** When the layer is added to a map, then we can fetch our origin
* (if we don't have one.)
*
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
OpenLayers.Layer.Grid.prototype.setMap.apply(this, arguments);
if (!this.tileOrigin) {
this.tileOrigin = new OpenLayers.LonLat(this.map.maxExtent.left,
this.map.maxExtent.bottom);
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.TMS"
});

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -49,7 +49,7 @@ OpenLayers.Layer.Text.prototype =
/** /**
* @param {XMLHttpRequest} ajaxRequest * @param {?} ajaxRequest
*/ */
parseData: function(ajaxRequest) { parseData: function(ajaxRequest) {
var text = ajaxRequest.responseText; var text = ajaxRequest.responseText;

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -193,7 +193,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
newArguments); newArguments);
//redraw //redraw
this.moveTo(null, true); this.moveTo();
}, },
/** combine the layer's url with its params and these newParams. /** combine the layer's url with its params and these newParams.

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -483,12 +483,9 @@ OpenLayers.Map.prototype = {
control.setMap(this); control.setMap(this);
var div = control.draw(px); var div = control.draw(px);
if (div) { if (div) {
// only elements without parents should be appended to the viewport div.style.zIndex = this.Z_INDEX_BASE['Control'] +
if(!div.parentNode) { this.controls.length;
div.style.zIndex = this.Z_INDEX_BASE['Control'] + this.viewPortDiv.appendChild( div );
this.controls.length;
this.viewPortDiv.appendChild( div );
}
} }
}, },

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -9,22 +9,18 @@
* @requires OpenLayers/Marker.js * @requires OpenLayers/Marker.js
*/ */
OpenLayers.Marker.Box = OpenLayers.Class.create(); OpenLayers.Marker.Box = OpenLayers.Class.create();
OpenLayers.Marker.Box.prototype = OpenLayers.Marker.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Marker, {
OpenLayers.Class.inherit( OpenLayers.Marker, { /** @type OpenLayers.LonLat */
/** @type OpenLayers.Bounds */
bounds: null, bounds: null,
/** @type DOMElement */
div: null, div: null,
/** /**
* @constructor * @constructor
* *
* @param {OpenLayers.Bounds} bounds * @param {OpenLayers.Icon} icon
* @param {String} borderColor * @param {OpenLayers.LonLat lonlat
* @param {int} borderWidth */
*/
initialize: function(bounds, borderColor, borderWidth) { initialize: function(bounds, borderColor, borderWidth) {
this.bounds = bounds; this.bounds = bounds;
this.div = OpenLayers.Util.createDiv(); this.div = OpenLayers.Util.createDiv();
@@ -33,24 +29,14 @@ OpenLayers.Marker.Box.prototype =
this.setBorder(borderColor, borderWidth); this.setBorder(borderColor, borderWidth);
}, },
/** Allow the user to change the box's color and border width
*
* @param {String} color Default is "red"
* @param {int} width Default is 2
*/
setBorder: function (color, width) { setBorder: function (color, width) {
if (!color) { if (!color) color = "red";
color = "red"; if (!width) width = 2;
}
if (!width) {
width = 2;
}
this.div.style.border = width + "px solid " + color; this.div.style.border = width + "px solid " + color;
}, },
/** /**
* @param {OpenLayers.Pixel} px * @param {OpenLayers.Pixel} px
* @param {OpenLayers.Size} sz
* *
* @return A new DOM Image with this marker<65>s icon set at the * @return A new DOM Image with this marker<65>s icon set at the
* location passed-in * location passed-in

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -207,10 +207,6 @@ OpenLayers.Popup.prototype = {
this.div.style.width = this.size.w + "px"; this.div.style.width = this.size.w + "px";
this.div.style.height = this.size.h + "px"; this.div.style.height = this.size.h + "px";
} }
if (this.contentDiv != null){
this.contentDiv.style.width = this.size.w + "px";
this.contentDiv.style.height = this.size.h + "px";
}
}, },
/** /**

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -70,13 +70,10 @@ OpenLayers.Popup.AnchoredBubble.prototype =
contentSize.h -= (2 * this.padding); contentSize.h -= (2 * this.padding);
this.contentDiv.style.height = contentSize.h + "px"; this.contentDiv.style.height = contentSize.h + "px";
this.contentDiv.style.width = contentSize.w + "px";
if (this.map) { //size has changed - must redo corners
//size has changed - must redo corners this.setRicoCorners(!this.rounded);
this.setRicoCorners(!this.rounded); this.rounded = true;
this.rounded = true;
}
} }
}, },
@@ -91,7 +88,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
if (this.div != null) { if (this.div != null) {
if (this.contentDiv != null) { if (this.contentDiv != null) {
this.div.style.background = "transparent"; this.div.style.background = "transparent";
OpenLayers.Rico.Corner.changeColor(this.contentDiv, this.backgroundColor); Rico.Corner.changeColor(this.contentDiv, this.backgroundColor);
} }
} }
}, },
@@ -106,7 +103,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
if (this.div != null) { if (this.div != null) {
if (this.contentDiv != null) { if (this.contentDiv != null) {
OpenLayers.Rico.Corner.changeOpacity(this.contentDiv, this.opacity); Rico.Corner.changeOpacity(this.contentDiv, this.opacity);
} }
} }
}, },
@@ -137,9 +134,9 @@ OpenLayers.Popup.AnchoredBubble.prototype =
blend: false}; blend: false};
if (firstTime) { if (firstTime) {
OpenLayers.Rico.Corner.round(this.div, options); Rico.Corner.round(this.div, options);
} else { } else {
OpenLayers.Rico.Corner.reRound(this.contentDiv, options); Rico.Corner.reRound(this.contentDiv, options);
//set the popup color and opacity //set the popup color and opacity
this.setBackgroundColor(); this.setBackgroundColor();
this.setOpacity(); this.setOpacity();

View File

@@ -1,6 +1,6 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
_OPENLAYERS_SFL_=true; _OPENLAYERS_SFL_=true

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -69,12 +69,7 @@ OpenLayers.Tile.prototype = {
/** /**
*/ */
draw:function() { draw:function() {
this.clear(); this.drawn = true;
return ((this.layer.displayOutsideMaxExtent
|| (this.layer.maxExtent
&& this.bounds.intersectsBounds(this.layer.maxExtent, false)))
&& !(this.layer.buffer == 0
&& !this.bounds.intersectsBounds(this.layer.map.getExtent(), false)));
}, },
/** /**
@@ -104,8 +99,8 @@ OpenLayers.Tile.prototype = {
}, },
getBoundsFromBaseLayer: function(position) { getBoundsFromBaseLayer: function(position) {
var topLeft = this.layer.map.getLonLatFromLayerPx(position); var topLeft = this.layer.map.getLonLatFromLayerPx(this.position);
var bottomRightPx = position.clone(); var bottomRightPx = this.position.clone();
bottomRightPx.x += this.size.w; bottomRightPx.x += this.size.w;
bottomRightPx.y += this.size.h; bottomRightPx.y += this.size.h;
var bottomRight = this.layer.map.getLonLatFromLayerPx(bottomRightPx); var bottomRight = this.layer.map.getLonLatFromLayerPx(bottomRightPx);
@@ -117,7 +112,7 @@ OpenLayers.Tile.prototype = {
} else { } else {
bottomRight.lon = 180+bottomRight.lon+180; bottomRight.lon = 180+bottomRight.lon+180;
} }
} }
bounds = new OpenLayers.Bounds(topLeft.lon, bottomRight.lat, bottomRight.lon, topLeft.lat); bounds = new OpenLayers.Bounds(topLeft.lon, bottomRight.lat, bottomRight.lon, topLeft.lat);
return bounds; return bounds;
}, },

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -43,28 +43,29 @@ OpenLayers.Tile.Image.prototype =
* *
*/ */
draw:function() { draw:function() {
if (this.layer != this.layer.map.baseLayer && this.layer.reproject) { OpenLayers.Tile.prototype.draw.apply(this, arguments);
this.bounds = this.getBoundsFromBaseLayer(this.position);
}
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
return false;
}
if (this.imgDiv == null) { if (this.imgDiv == null) {
this.initImgDiv(); this.initImgDiv();
} }
if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
this.url = this.layer.getURL(this.bounds); this.bounds = this.getBoundsFromBaseLayer(this.position);
}
if (this.layer.alpha) {
OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv, this.url = this.layer.getURL(this.bounds);
null, this.position, this.size, this.url); this.imgDiv.style.display = "none";
} else { if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent &&
this.imgDiv.src = this.url; (this.bounds.intersectsBounds(this.layer.maxExtent,false))
OpenLayers.Util.modifyDOMElement(this.imgDiv, )) {
null, this.position, this.size) ; if (this.layer.alpha) {
OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,
null, this.position, this.size, this.url);
} else {
this.imgDiv.src = this.url;
OpenLayers.Util.modifyDOMElement(this.imgDiv,
null, this.position, this.size) ;
}
} }
this.drawn = true;
return true;
}, },
/** Clear the tile of any bounds/position-related data so that it can /** Clear the tile of any bounds/position-related data so that it can
@@ -143,13 +144,9 @@ OpenLayers.Tile.Image.prototype =
* @private * @private
*/ */
checkImgURL: function () { checkImgURL: function () {
// Sometimes our image will load after it has already been removed var loaded = this.layer.alpha ? this.imgDiv.firstChild.src : this.imgDiv.src;
// from the map, in which case this check is not needed. if (loaded != this.url) {
if (this.layer) { this.imgDiv.style.display = "none";
var loaded = this.layer.alpha ? this.imgDiv.firstChild.src : this.imgDiv.src;
if (!OpenLayers.Util.isEquivalentUrl(loaded, this.url)) {
this.imgDiv.style.display = "none";
}
} }
}, },

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -57,12 +57,14 @@ OpenLayers.Tile.WFS.prototype =
* *
*/ */
draw:function() { draw:function() {
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) { if (this.drawn) {
return false; this.clear();
} }
this.loadFeaturesForRegion(this.requestSuccess); OpenLayers.Tile.prototype.draw.apply(this, arguments);
this.drawn = true; if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent &&
return true; this.layer.maxExtent.intersectsBounds(this.bounds, false))) {
this.loadFeaturesForRegion(this.requestSuccess);
}
}, },
/** get the full request string from the ds and the tile params /** get the full request string from the ds and the tile params
@@ -88,7 +90,7 @@ OpenLayers.Tile.WFS.prototype =
/** Return from AJAX request /** Return from AJAX request
* *
* @param {XMLHttpRequest} request * @param {} request
*/ */
requestSuccess:function(request) { requestSuccess:function(request) {
var doc = request.responseXML; var doc = request.responseXML;

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license. /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt * See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */ * for the full text of the license. */
@@ -222,14 +222,9 @@ OpenLayers.Util.onImageLoad = function() {
}; };
OpenLayers.Util.onImageLoadErrorColor = "pink"; OpenLayers.Util.onImageLoadErrorColor = "pink";
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 0;
OpenLayers.Util.onImageLoadError = function() { OpenLayers.Util.onImageLoadError = function() {
this._attempts = (this._attempts) ? (this._attempts + 1) : 1; this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
if(this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
this.src = this.src;
} else {
this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
}
this.style.display = ""; this.style.display = "";
}; };
@@ -385,8 +380,7 @@ OpenLayers.Util.getParameterString = function(params) {
for (var key in params) { for (var key in params) {
var value = params[key]; var value = params[key];
if ((value != null) && (typeof value != 'function')) { if ((value != null) && (typeof value != 'function')) {
paramsArray.push(encodeURIComponent(key) + "=" + paramsArray.push(key + "=" + value);
encodeURIComponent(value));
} }
} }
@@ -558,32 +552,21 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
var d = s.toFixed(3)/1000; // round to 1mm precision var d = s.toFixed(3)/1000; // round to 1mm precision
return d; return d;
}; };
/** OpenLayers.Util.getArgs = function() {
* @param {String} url Optional url used to extract the query string.
* If null, query string is taken from page location.
*
* @returns An object of key/value pairs from the query string.
* @type Object
*/
OpenLayers.Util.getArgs = function(url) {
if(url == null) {
var query = window.location.search.substring(1);
} else {
var query = (url.indexOf('?') == -1) ?
'' : url.substring(url.indexOf('?') + 1);
}
var args = new Object(); var args = new Object();
pairs = query.split(/[&;]/); var query = location.search.substring(1); // Get query string.
for(var i = 0; i < pairs.length; ++i) { var pairs = query.split("&"); // Break at ampersand. //+pjl
keyValue = pairs[i].split(/=/);
if(keyValue.length == 2) { for(var i = 0; i < pairs.length; i++) {
args[decodeURIComponent(keyValue[0])] = var pos = pairs[i].indexOf('='); // Look for "name=value".
decodeURIComponent(keyValue[1]); if (pos == -1) continue; // If not found, skip.
} var argname = pairs[i].substring(0,pos); // Extract the name.
var value = pairs[i].substring(pos+1); // Extract the value.
args[argname] = unescape(value); // Store as a property.
} }
return args; return args; // Return the object.
} };
/** /**
* @param {String} prefix String to prefix random id. If null, default * @param {String} prefix String to prefix random id. If null, default
@@ -709,112 +692,3 @@ OpenLayers.Util.pagePosition = function(forElement) {
return [valueL, valueT]; return [valueL, valueT];
}; };
/** Test two URLs for equivalence.
*
* Setting 'ignoreCase' allows for case-independent comparison.
*
* Comparison is based on:
* - Protocol
* - Host (evaluated without the port)
* - Port (set 'ignorePort80' to ignore "80" values)
* - Hash ( set 'ignoreHash' to disable)
* - Pathname (for relative <-> absolute comparison)
* - Arguments (so they can be out of order)
*
*
*
* @param {String} url1
* @param {String} url2
* @param {Object} options allows for customization of comparison:
* 'ignoreCase' - Default is True
* 'ignorePort80' - Default is True
* 'ignoreHash' - Default is True
*
* @returns Whether or not the two URLs are equivalent
* @type Boolean
*/
OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
options = options || new Object();
OpenLayers.Util.applyDefaults(options, {
ignoreCase: true,
ignorePort80: true,
ignoreHash: true
});
urlObj1 = OpenLayers.Util.createUrlObject(url1, options);
urlObj2 = OpenLayers.Util.createUrlObject(url2, options);
//compare keys (host, port, etc)
for(var key in urlObj1) {
if ( (key != "args") && (urlObj1[key] != urlObj2[key]) ) {
return false;
}
}
// compare search args - irrespective of order
for(var key in urlObj1.args) {
if(urlObj1.args[key] != urlObj2.args[key]) {
return false;
}
delete urlObj2.args[key];
}
// urlObj2 shouldn't have any args left
for(var key in urlObj2.args) {
return false;
}
return true;
};
/**
* @private
*
* @param {String} url
* @param {Object} options
*
* @returns An object with separate url, a, port, host, and args parsed out
* and ready for comparison
* @type Object
*/
OpenLayers.Util.createUrlObject = function(url, options) {
options = options || new Object();
var urlObject = new Object();
if (options.ignoreCase) {
url = url.toLowerCase();
}
var a = document.createElement('a');
a.href = url;
//protocol
urlObject.protocol = a.protocol;
//pathname (this part allows for relative <-> absolute comparison)
urlObject.pathname = a.pathname;
//hash
urlObject.hash = (options.ignoreHash) ? "" : a.hash;
//host (without port)
urlObject.host = a.host;
var port = a.port;
if (port.length <= 0) {
var newHostLength = urlObject.host.length - (port.length);
urlObject.host = urlObject.host.substring(0, newHostLength);
}
//port
urlObject.port = ((port == "80") && (options.ignorePort80)) ? "" : port;
//args
urlObject.args = OpenLayers.Util.getArgs(a.search);
return urlObject;
};

View File

@@ -1,6 +1,6 @@
OpenLayers.Rico.Color = OpenLayers.Class.create(); Rico.Color = OpenLayers.Class.create();
OpenLayers.Rico.Color.prototype = { Rico.Color.prototype = {
initialize: function(red, green, blue) { initialize: function(red, green, blue) {
this.rgb = { r: red, g : green, b : blue }; this.rgb = { r: red, g : green, b : blue };
@@ -25,7 +25,7 @@ OpenLayers.Rico.Color.prototype = {
hsb.h = h; hsb.h = h;
// convert back to RGB... // convert back to RGB...
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b); this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
}, },
setSaturation: function(s) { setSaturation: function(s) {
@@ -34,7 +34,7 @@ OpenLayers.Rico.Color.prototype = {
hsb.s = s; hsb.s = s;
// convert back to RGB and set values... // convert back to RGB and set values...
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b); this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
}, },
setBrightness: function(b) { setBrightness: function(b) {
@@ -43,17 +43,17 @@ OpenLayers.Rico.Color.prototype = {
hsb.b = b; hsb.b = b;
// convert back to RGB and set values... // convert back to RGB and set values...
this.rgb = OpenLayers.Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b ); this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
}, },
darken: function(percent) { darken: function(percent) {
var hsb = this.asHSB(); var hsb = this.asHSB();
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0)); this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
}, },
brighten: function(percent) { brighten: function(percent) {
var hsb = this.asHSB(); var hsb = this.asHSB();
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1)); this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
}, },
blend: function(other) { blend: function(other) {
@@ -80,7 +80,7 @@ OpenLayers.Rico.Color.prototype = {
}, },
asHSB: function() { asHSB: function() {
return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b); return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
}, },
toString: function() { toString: function() {
@@ -89,7 +89,7 @@ OpenLayers.Rico.Color.prototype = {
}; };
OpenLayers.Rico.Color.createFromHex = function(hexCode) { Rico.Color.createFromHex = function(hexCode) {
if(hexCode.length==4) { if(hexCode.length==4) {
var shortHexCode = hexCode; var shortHexCode = hexCode;
var hexCode = '#'; var hexCode = '#';
@@ -101,39 +101,39 @@ shortHexCode.charAt(i));
var red = hexCode.substring(0,2); var red = hexCode.substring(0,2);
var green = hexCode.substring(2,4); var green = hexCode.substring(2,4);
var blue = hexCode.substring(4,6); var blue = hexCode.substring(4,6);
return new OpenLayers.Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) ); return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
} }
/** /**
* Factory method for creating a color from the background of * Factory method for creating a color from the background of
* an HTML element. * an HTML element.
*/ */
OpenLayers.Rico.Color.createColorFromBackground = function(elem) { Rico.Color.createColorFromBackground = function(elem) {
var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color"); var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color");
if ( actualColor == "transparent" && elem.parentNode ) if ( actualColor == "transparent" && elem.parentNode )
return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode); return Rico.Color.createColorFromBackground(elem.parentNode);
if ( actualColor == null ) if ( actualColor == null )
return new OpenLayers.Rico.Color(255,255,255); return new Rico.Color(255,255,255);
if ( actualColor.indexOf("rgb(") == 0 ) { if ( actualColor.indexOf("rgb(") == 0 ) {
var colors = actualColor.substring(4, actualColor.length - 1 ); var colors = actualColor.substring(4, actualColor.length - 1 );
var colorArray = colors.split(","); var colorArray = colors.split(",");
return new OpenLayers.Rico.Color( parseInt( colorArray[0] ), return new Rico.Color( parseInt( colorArray[0] ),
parseInt( colorArray[1] ), parseInt( colorArray[1] ),
parseInt( colorArray[2] ) ); parseInt( colorArray[2] ) );
} }
else if ( actualColor.indexOf("#") == 0 ) { else if ( actualColor.indexOf("#") == 0 ) {
return OpenLayers.Rico.Color.createFromHex(actualColor); return Rico.Color.createFromHex(actualColor);
} }
else else
return new OpenLayers.Rico.Color(255,255,255); return new Rico.Color(255,255,255);
} }
OpenLayers.Rico.Color.HSBtoRGB = function(hue, saturation, brightness) { Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
var red = 0; var red = 0;
var green = 0; var green = 0;
@@ -188,7 +188,7 @@ OpenLayers.Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) }; return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) };
} }
OpenLayers.Rico.Color.RGBtoHSB = function(r, g, b) { Rico.Color.RGBtoHSB = function(r, g, b) {
var hue; var hue;
var saturation; var saturation;

View File

@@ -14,8 +14,8 @@
**/ **/
OpenLayers.Rico = new Object(); var Rico = new Object();
OpenLayers.Rico.Corner = { Rico.Corner = {
round: function(e, options) { round: function(e, options) {
var e = $(e); var e = $(e);
@@ -305,8 +305,8 @@ OpenLayers.Rico.Corner = {
}, },
_hasString: function(str) { for(var i=1 ; i<arguments.length ; i++) if (str.indexOf(arguments[i]) >= 0) return true; return false; }, _hasString: function(str) { for(var i=1 ; i<arguments.length ; i++) if (str.indexOf(arguments[i]) >= 0) return true; return false; },
_blend: function(c1, c2) { var cc1 = OpenLayers.Rico.Color.createFromHex(c1); cc1.blend(OpenLayers.Rico.Color.createFromHex(c2)); return cc1; }, _blend: function(c1, c2) { var cc1 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; },
_background: function(el) { try { return OpenLayers.Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } }, _background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
_isTransparent: function() { return this.options.color == "transparent"; }, _isTransparent: function() { return this.options.color == "transparent"; },
_isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); }, _isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); },
_isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); }, _isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); },

View File

@@ -21,7 +21,6 @@
<li>test_Layer_GeoRSS.html</li> <li>test_Layer_GeoRSS.html</li>
<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_TMS.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>

View File

@@ -89,64 +89,56 @@
tParams = { layers: 'basic', tParams = { layers: 'basic',
format: 'image/png'}; format: 'image/png'};
t.plan( 9 ); t.plan( 8 );
// without ? // without ?
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv"; tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString(); str = layer.getFullRequestString();
t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url sans ?");
// with ? // with ?
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?"; tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString(); str = layer.getFullRequestString();
t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url with ?");
// with ?param1=5 // with ?param1=5
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5"; tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString(); str = layer.getFullRequestString();
t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?param1=5"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=basic&format=image/png", "getFullRequestString() works for url with ?param1=5");
// with ?param1=5&
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&format=image/jpeg";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString();
t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString({'layers':'basic'}), "getFullRequestString() doesn't override already-existing params in URL");
// with ?param1=5& // with ?param1=5&
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&"; tUrl = "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&";
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString(); str = layer.getFullRequestString();
t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url with ?param1=5&"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=basic&format=image/png", "getFullRequestString() works for url with ?param1=5&");
// passing in new params // passing in new params
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, tParams, null);
str = layer.getFullRequestString( { chicken: 6, str = layer.getFullRequestString( { chicken: 6,
layers:"road" } ); layers:"road" } );
t.eq(str, tUrl + OpenLayers.Util.getParameterString({layers: 'road', format: "image/png", chicken: 6}), "getFullRequestString() works for passing in new params"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=road&format=image/png&chicken=6", "getFullRequestString() works for passing in new params");
// layer with null params // layer with null params
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null);
str = layer.getFullRequestString(); str = layer.getFullRequestString();
t.eq(str, tUrl + OpenLayers.Util.getParameterString({}), "getFullRequestString() works for layer with null params"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&", "getFullRequestString() works for layer with null params");
// layer with null params passing in new params // layer with null params passing in new params
layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null); layer = new OpenLayers.Layer.HTTPRequest(name, tUrl, null, null);
str = layer.getFullRequestString( { chicken: 6, str = layer.getFullRequestString( { chicken: 6,
layers:"road" } ); layers:"road" } );
t.eq(str, tUrl + OpenLayers.Util.getParameterString({chicken: 6, layers: "road"}), "getFullRequestString() works for layer with null params passing in new params"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&chicken=6&layers=road", "getFullRequestString() works for layer with null params passing in new params");
// with specified altUrl parameter // with specified altUrl parameter
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv"; tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.HTTPRequest(name, "chicken", tParams, null); layer = new OpenLayers.Layer.HTTPRequest(name, "chicken", tParams, null);
str = layer.getFullRequestString(null, tUrl); str = layer.getFullRequestString(null, tUrl);
t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?"); t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url sans ?");
} }

View File

@@ -1,164 +0,0 @@
<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'Test Layer';
var url = "http://labs.metacarta.com/wms-c/Basic.py/";
var options = {'layername':'basic', 'type':'png'};
function test_01_Layer_TMS_constructor (t) {
t.plan( 1 );
layer = new OpenLayers.Layer.TMS(name, url, options);
t.ok( layer instanceof OpenLayers.Layer.TMS, "returns OpenLayers.Layer.TMS object" );
}
function test_03_Layer_TMS_clearTiles (t) {
t.plan( 1 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0));
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
layer.clearGrid();
t.ok( layer.grid != null, "layer.grid does not get nullified" );
}
function test_04_Layer_TMS_getTMSBounds(t) {
t.plan( 1 );
layer = new OpenLayers.Layer.TMS(name, url, options);
var bl = { bounds: new OpenLayers.Bounds(1,2,0,0)};
var tr = { bounds: new OpenLayers.Bounds(0,0,3,4)};
layer.grid = [ [6, tr],
[bl, 7]];
var bounds = layer.getGridBounds();
var testBounds = new OpenLayers.Bounds(1,2,3,4);
t.ok( bounds.equals(testBounds), "getTMSBounds() returns correct bounds")
layer.grid = null;
}
function test_05_Layer_TMS_getResolution(t) {
t.plan( 1 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.zoom = 5;
t.eq( layer.getResolution(), 0.0439453125, "getResolution() returns correct value");
}
function test_06_Layer_TMS_getZoomForExtent(t) {
t.plan( 2 );
var bounds, zoom;
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
bounds = new OpenLayers.Bounds(10,10,12,12);
zoom = layer.getZoomForExtent(bounds);
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
bounds = new OpenLayers.Bounds(10,10,100,100);
zoom = layer.getZoomForExtent(bounds);
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
}
/** THIS WOULD BE WHERE THE TESTS WOULD GO FOR
*
* -moveTo
* -insertColumn
* -insertRow
function 07_Layer_TMS_moveTo(t) {
}
function 08_Layer_TMS_insertColumn(t) {
}
function 09_Layer_TMS_insertRow(t) {
}
*
*/
function test_10_Layer_TMS_getURL(t) {
t.plan(1);
var map = new OpenLayers.Map('map', options);
var options = {'layername':'basic', 'type':'png'};
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 9);
var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct");
}
function test_11_Layer_TMS_setMap(t) {
t.plan(3);
var map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.TMS(name, url, options);
t.eq(layer.tileOrigin, null, "Tile origin starts out null");
layer.setMap(map);
t.eq(layer.tileOrigin.lat, -90, "lat is -90");
t.eq(layer.tileOrigin.lon, -180, "lon is -180");
}
function test_99_Layer_TMS_destroy (t) {
t.plan( 3 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
layer.destroy();
t.eq( layer.grid, null, "layer.grid is null after destroy" );
t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );
//test with tile creation
layer = new OpenLayers.Layer.TMS(name, url, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
layer.destroy();
t.ok( layer.grid == null, "tiles appropriately destroyed");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>

View File

@@ -38,18 +38,8 @@
tile.draw(); tile.draw();
var img = tile.imgDiv; var img = tile.imgDiv;
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params)); t.eq( img.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "image src is created correctly via addtile" );
tParams = OpenLayers.Util.extend(tParams, {
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage",
SRS: "EPSG:4326", BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
});
t.eq( img.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" ); t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" ); t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" );
@@ -58,9 +48,7 @@
t.ok( true, "skipping element test outside of Mozilla"); t.ok( true, "skipping element test outside of Mozilla");
else else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" ); t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src, t.eq( firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "div first child is correct image object" );
url + "?" + OpenLayers.Util.getParameterString(tParams),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." ); t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
} }
@@ -142,6 +130,7 @@
t.plan( 2 ); t.plan( 2 );
var map = new OpenLayers.Map('map'); var map = new OpenLayers.Map('map');
map.projection = "xx"; map.projection = "xx";
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv"; tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
@@ -150,21 +139,11 @@
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams); var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams);
map.addLayer(tLayer); map.addLayer(tLayer);
str = tLayer.getFullRequestString(); str = tLayer.getFullRequestString();
var tParams = { t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=xx", "getFullRequestString() adds SRS value");
LAYERS: "basic", FORMAT: "image/png", SERVICE: "WMS",
VERSION: "1.1.1", REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", SRS: "xx"
};
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() adds SRS value");
tLayer.projection = "none"; tLayer.projection = "none";
str = tLayer.getFullRequestString(); str = tLayer.getFullRequestString();
delete tParams['SRS']; t.eq(str, "http://octo.metacarta.com/cgi-bin/mapserv?LAYERS=basic&FORMAT=image/png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage", "getFullRequestString() by default does *not* add SRS value if projection is 'none'");
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
} }

View File

@@ -83,8 +83,8 @@
t.eq(contentDiv.className, "olPopupContent", "correct content div className"); t.eq(contentDiv.className, "olPopupContent", "correct content div className");
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id"); t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
t.eq(contentDiv.style.width, "500px", "correct content div width"); t.eq(contentDiv.style.width, "200px", "correct content div width");
t.eq(contentDiv.style.height, "400px", "correct content div height"); t.eq(contentDiv.style.height, "200px", "correct content div height");
t.eq(contentDiv.style.position, "relative", "correct content div position"); t.eq(contentDiv.style.position, "relative", "correct content div position");
t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow"); t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow");
t.eq(contentDiv.innerHTML, content, "correct content div content"); t.eq(contentDiv.innerHTML, content, "correct content div content");

View File

@@ -48,16 +48,7 @@
t.ok( true, "skipping element test outside of Mozilla"); t.ok( true, "skipping element test outside of Mozilla");
else else
t.ok( img instanceof HTMLImageElement, "tile.draw creates an image"); t.ok( img instanceof HTMLImageElement, "tile.draw creates an image");
var tParams = { t.eq( img.src, "http://labs.metacarta.com/TESTURL?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "tile.draw creates an image");
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", FORMAT: "image/jpeg",
SRS: "EPSG:4326", BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
};
t.eq( img.src,
"http://labs.metacarta.com/TESTURL?" + OpenLayers.Util.getParameterString(tParams),
"tile.draw creates an image");
t.eq( tile.imgDiv.style.width, "5px", "Image width is correct" ); t.eq( tile.imgDiv.style.width, "5px", "Image width is correct" );
t.eq( tile.imgDiv.style.height, "6px", "Image height is correct" ); t.eq( tile.imgDiv.style.height, "6px", "Image height is correct" );
} }
@@ -73,78 +64,42 @@
map.addLayer(layer); map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size);
tile.draw() tile.draw()
t.eq(tile.imgDiv, null, "Images against side of maxextent don't load"); t.eq(tile.imgDiv.src, "", "Images against side of maxextent don't load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-91,180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-91,180,90), url, size);
tile.draw() tile.draw()
var tParams = { t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-181,-91,180,90&WIDTH=256&HEIGHT=256", "Images over edges of maxextent do load");
LAYERS: "basic", SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", FORMAT: "image/jpeg",
SRS: "EPSG:4326", BBOX: "-181,-91,180,90",
WIDTH: "256", HEIGHT: "256"
};
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-181,-90,180,90&WIDTH=256&HEIGHT=256", "Images over edges of maxextent do load");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=256&HEIGHT=256", "Image covering all of extent loads");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering all of extent loads");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-80,-45,80,45&WIDTH=256&HEIGHT=256", "Image covering small part of extent loads");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering small part of extent loads");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-185,-95,185,95&WIDTH=256&HEIGHT=256", "Image covering more than all of extent loads");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering more than all of extent loads");
layer.displayOutsideMaxExtent=1; layer.displayOutsideMaxExtent=1;
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-90,-180,90"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-185,-90,-180,90&WIDTH=256&HEIGHT=256", "Images against side of maxextent do load with displayOutsideMaxExtent");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images against side of maxextent do load with displayOutsideMaxExtent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-181,-90,180,90&WIDTH=256&HEIGHT=256", "Images over edges of maxextent do load with displayOutsideMaxExtent set");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load with displayOutsideMaxExtent set");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-180,-90,180,90&WIDTH=256&HEIGHT=256", "Image covering all of extent loads with display outside max extent");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering all of extent loads with display outside max extent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-80,-45,80,45&WIDTH=256&HEIGHT=256", "Image covering small part of extent loads with display outside max extent");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering small part of extent loads with display outside max extent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size);
tile.draw() tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"}); t.eq(tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-185,-95,185,95&WIDTH=256&HEIGHT=256", "Image covering more than all of extent loads");
t.eq(tile.imgDiv.src,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering more than all of extent loads");
} }
function test_04_Tile_Image_Display_After_Move(t) { function test_04_Tile_Image_Display_After_Move(t) {
t.plan(2); t.plan(3);
var position = new OpenLayers.Pixel(20,30); var position = new OpenLayers.Pixel(20,30);
var bounds = new OpenLayers.Bounds(1,2,3,4); var bounds = new OpenLayers.Bounds(1,2,3,4);
var url = "http://www.openlayers.org/dev/tests/tileimage"; var url = "http://www.openlayers.org/dev/tests/tileimage";
@@ -157,14 +112,15 @@
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw(); tile.draw();
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true); tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true);
t.delay_call( 1, function() { t.eq(tile.imgDiv, null, "Tile imgDiv is null.") } ); t.delay_call( 1, function() { t.eq(tile.imgDiv.style.display, 'none', "Tile display is set to none.") } );
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}, {'alpha':true}); "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'}, {'alpha':true});
map.addLayer(layer); map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size); tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw(); tile.draw();
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true) tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true)
t.delay_call( 1, function() { t.eq(tile.imgDiv, null, "Alpha tile imgDiv is null.") } ); t.ok(tile.imgDiv.firstChild.src != tile.url, "Check to make sure that the alpha image URL really is different");
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.display, 'none', "Alpha tile display is set to none.") } );
} }
// --> // -->

View File

@@ -174,14 +174,13 @@
} }
function test_07_Util_getParameterString(t) { function test_07_Util_getParameterString(t) {
t.plan( 2 ); t.plan( 1 );
var params = { foo: "bar", var params = { foo: "bar",
chicken: 1.5 chicken: 1.5
} }
t.eq( OpenLayers.Util.getParameterString(params), "foo=bar&chicken=1.5", "getParameterString returns correctly"); t.eq( OpenLayers.Util.getParameterString(params), "foo=bar&chicken=1.5", "getParameterString returns correctly");
t.eq( OpenLayers.Util.getParameterString({'a:':'b='}), "a%3A=b%3D", "getParameterString returns correctly with non-ascii keys/values");
} }
function test_08_Util_createAlphaImageDiv(t) { function test_08_Util_createAlphaImageDiv(t) {
@@ -490,71 +489,7 @@
OpenLayers.ImgPath = ''; OpenLayers.ImgPath = '';
t.eq(OpenLayers.Util.getImagesLocation().substr(OpenLayers.Util.getImagesLocation().length-4,4), "img/", "ImgPath works as expected when set to ''."); t.eq(OpenLayers.Util.getImagesLocation().substr(OpenLayers.Util.getImagesLocation().length-4,4), "img/", "ImgPath works as expected when set to ''.");
} }
// -->
function test_15_Util_isEquivalentUrl(t) {
t.plan(8);
var url1, url2, options;
//CASE
url1 = "http://www.openlayers.org";
url2 = "HTTP://WWW.OPENLAYERS.ORG";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreCase works");
//ARGS
url1 = "http://www.openlayers.org?foo=5;bar=6";
url2 = "http://www.openlayers.org?bar=6;foo=5";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "shuffled arguments works");
//PORT
url1 = "http://www.openlayers.org:80";
url2 = "http://www.openlayers.org";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignorePort80 works");
options = {
'ignorePort80': false
}
url1 = "http://www.openlayers.org:80";
url2 = "http://www.openlayers.org:50";
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2), "port check works");
//HASH
url1 = "http://www.openlayers.org#barf";
url2 = "http://www.openlayers.org";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreHash works");
options = {
'ignoreHash': false
}
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2, options), "ignoreHash FALSE works");
//PROTOCOL
url1 = "http://www.openlayers.org";
url2 = "ftp://www.openlayers.org";
t.ok(!OpenLayers.Util.isEquivalentUrl(url1, url2), "default ignoreHash works");
//PATHNAME
url1 = "foo.html";
url2 = "../tests/foo.html";
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
}
// -->
</script> </script>
</head> </head>
<body> <body>

View File

@@ -33,180 +33,180 @@
from StringIO import StringIO from StringIO import StringIO
def jsmin(js): def jsmin(js):
ins = StringIO(js) ins = StringIO(js)
outs = StringIO() outs = StringIO()
JavascriptMinify().minify(ins, outs) JavascriptMinify().minify(ins, outs)
str = outs.getvalue() str = outs.getvalue()
if len(str) > 0 and str[0] == '\n': if len(str) > 0 and str[0] == '\n':
str = str[1:] str = str[1:]
return str return str
def isAlphanum(c): def isAlphanum(c):
"""return true if the character is a letter, digit, underscore, """return true if the character is a letter, digit, underscore,
dollar sign, or non-ASCII character. dollar sign, or non-ASCII character.
""" """
return ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or return ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or
(c >= 'A' and c <= 'Z') or c == '_' or c == '$' or c == '\\' or (c is not None and ord(c) > 126)); (c >= 'A' and c <= 'Z') or c == '_' or c == '$' or c == '\\' or (c is not None and ord(c) > 126));
class UnterminatedComment(Exception): class UnterminatedComment(Exception):
pass pass
class UnterminatedStringLiteral(Exception): class UnterminatedStringLiteral(Exception):
pass pass
class UnterminatedRegularExpression(Exception): class UnterminatedRegularExpression(Exception):
pass pass
class JavascriptMinify(object): class JavascriptMinify(object):
def _outA(self): def _outA(self):
self.outstream.write(self.theA) self.outstream.write(self.theA)
def _outB(self): def _outB(self):
self.outstream.write(self.theB) self.outstream.write(self.theB)
def _get(self): def _get(self):
"""return the next character from stdin. Watch out for lookahead. If """return the next character from stdin. Watch out for lookahead. If
the character is a control character, translate it to a space or the character is a control character, translate it to a space or
linefeed. linefeed.
""" """
c = self.theLookahead c = self.theLookahead
self.theLookahead = None self.theLookahead = None
if c == None: if c == None:
c = self.instream.read(1) c = self.instream.read(1)
if c >= ' ' or c == '\n': if c >= ' ' or c == '\n':
return c return c
if c == '': # EOF if c == '': # EOF
return '\000' return '\000'
if c == '\r': if c == '\r':
return '\n' return '\n'
return ' ' return ' '
def _peek(self): def _peek(self):
self.theLookahead = self._get() self.theLookahead = self._get()
return self.theLookahead return self.theLookahead
def _next(self): def _next(self):
"""get the next character, excluding comments. peek() is used to see """get the next character, excluding comments. peek() is used to see
if a '/' is followed by a '/' or '*'. if a '/' is followed by a '/' or '*'.
""" """
c = self._get() c = self._get()
if c == '/': if c == '/':
p = self._peek() p = self._peek()
if p == '/': if p == '/':
c = self._get() c = self._get()
while c > '\n': while c > '\n':
c = self._get() c = self._get()
return c return c
if p == '*': if p == '*':
c = self._get() c = self._get()
while 1: while 1:
c = self._get() c = self._get()
if c == '*': if c == '*':
if self._peek() == '/': if self._peek() == '/':
self._get() self._get()
return ' ' return ' '
if c == '\000': if c == '\000':
raise UnterminatedComment() raise UnterminatedComment()
return c return c
def _action(self, action): def _action(self, action):
"""do something! What you do is determined by the argument: """do something! What you do is determined by the argument:
1 Output A. Copy B to A. Get the next B. 1 Output A. Copy B to A. Get the next B.
2 Copy B to A. Get the next B. (Delete A). 2 Copy B to A. Get the next B. (Delete A).
3 Get the next B. (Delete B). 3 Get the next B. (Delete B).
action treats a string as a single character. Wow! action treats a string as a single character. Wow!
action recognizes a regular expression if it is preceded by ( or , or =. action recognizes a regular expression if it is preceded by ( or , or =.
""" """
if action <= 1: if action <= 1:
self._outA() self._outA()
if action <= 2: if action <= 2:
self.theA = self.theB self.theA = self.theB
if self.theA == "'" or self.theA == '"': if self.theA == "'" or self.theA == '"':
while 1: while 1:
self._outA() self._outA()
self.theA = self._get() self.theA = self._get()
if self.theA == self.theB: if self.theA == self.theB:
break break
if self.theA <= '\n': if self.theA <= '\n':
raise UnterminatedStringLiteral() raise UnterminatedStringLiteral()
if self.theA == '\\': if self.theA == '\\':
self._outA() self._outA()
self.theA = self._get() self.theA = self._get()
if action <= 3: if action <= 3:
self.theB = self._next() self.theB = self._next()
if self.theB == '/' and (self.theA == '(' or self.theA == ',' or self.theA == '='): if self.theB == '/' and (self.theA == '(' or self.theA == ',' or self.theA == '='):
self._outA() self._outA()
self._outB() self._outB()
while 1: while 1:
self.theA = self._get() self.theA = self._get()
if self.theA == '/': if self.theA == '/':
break break
elif self.theA == '\\': elif self.theA == '\\':
self._outA() self._outA()
self.theA = self._get() self.theA = self._get()
elif self.theA <= '\n': elif self.theA <= '\n':
raise UnterminatedRegularExpression() raise UnterminatedRegularExpression()
self._outA() self._outA()
self.theB = self._next() self.theB = self._next()
def _jsmin(self): def _jsmin(self):
"""Copy the input to the output, deleting the characters which are """Copy the input to the output, deleting the characters which are
insignificant to JavaScript. Comments will be removed. Tabs will be insignificant to JavaScript. Comments will be removed. Tabs will be
replaced with spaces. Carriage returns will be replaced with linefeeds. replaced with spaces. Carriage returns will be replaced with linefeeds.
Most spaces and linefeeds will be removed. Most spaces and linefeeds will be removed.
""" """
self.theA = '\n' self.theA = '\n'
self._action(3) self._action(3)
while self.theA != '\000': while self.theA != '\000':
if self.theA == ' ': if self.theA == ' ':
if isAlphanum(self.theB): if isAlphanum(self.theB):
self._action(1) self._action(1)
else: else:
self._action(2) self._action(2)
elif self.theA == '\n': elif self.theA == '\n':
if self.theB in ['{', '[', '(', '+', '-']: if self.theB in ['{', '[', '(', '+', '-']:
self._action(1) self._action(1)
elif self.theB == ' ': elif self.theB == ' ':
self._action(3) self._action(3)
else: else:
if isAlphanum(self.theB): if isAlphanum(self.theB):
self._action(1) self._action(1)
else: else:
self._action(2) self._action(2)
else: else:
if self.theB == ' ': if self.theB == ' ':
if isAlphanum(self.theA): if isAlphanum(self.theA):
self._action(1) self._action(1)
else: else:
self._action(3) self._action(3)
elif self.theB == '\n': elif self.theB == '\n':
if self.theA in ['}', ']', ')', '+', '-', '"', '\'']: if self.theA in ['}', ']', ')', '+', '-', '"', '\'']:
self._action(1) self._action(1)
else: else:
if isAlphanum(self.theA): if isAlphanum(self.theA):
self._action(1) self._action(1)
else: else:
self._action(3) self._action(3)
else: else:
self._action(1) self._action(1)
def minify(self, instream, outstream): def minify(self, instream, outstream):
self.instream = instream self.instream = instream
self.outstream = outstream self.outstream = outstream
self.theA = None self.theA = None
self.thaB = None self.thaB = None
self.theLookahead = None self.theLookahead = None
self._jsmin() self._jsmin()
self.instream.close() self.instream.close()
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
jsm = JavascriptMinify() jsm = JavascriptMinify()
jsm.minify(sys.stdin, sys.stdout) jsm.minify(sys.stdin, sys.stdout)

View File

@@ -127,25 +127,42 @@ class Config:
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")] self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
self.exclude = lines[lines.index("[exclude]") + 1:] self.exclude = lines[lines.index("[exclude]") + 1:]
def run (sourceDirectory, outputFilename = None, configFile = None): if __name__ == "__main__":
import getopt
options, args = getopt.getopt(sys.argv[1:], "-c:")
try:
outputFilename = args[0]
except IndexError:
usage(sys.argv[0])
raise SystemExit
else:
sourceDirectory = args[1]
if not sourceDirectory:
usage(sys.argv[0])
raise SystemExit
cfg = None cfg = None
if configFile: if options and options[0][0] == "-c":
cfg = Config(configFile) filename = options[0][1]
print "Parsing configuration file: %s" % filename
cfg = Config(filename)
print cfg.include print cfg.include
allFiles = [] allFiles = []
## Find all the Javascript source files ## Find all the Javascript source files
for root, dirs, files in os.walk(sourceDirectory): for root, dirs, files in os.walk(sourceDirectory):
for filename in files: for filename in files:
if filename.endswith(SUFFIX_JAVASCRIPT) and not filename.startswith("."): if filename.endswith(SUFFIX_JAVASCRIPT) and not filename.startswith("."):
filepath = os.path.join(root, filename)[len(sourceDirectory)+1:] filepath = os.path.join(root, filename)[len(sourceDirectory)+1:]
filepath = filepath.replace("\\", "/")
if cfg and cfg.include: if cfg and cfg.include:
if filepath in cfg.include or filepath in cfg.forceFirst: if filepath in cfg.include or filepath in cfg.forceFirst:
allFiles.append(filepath) allFiles.append(filepath)
elif (not cfg) or (filepath not in cfg.exclude): elif (not cfg) or (filepath not in cfg.exclude):
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 + " %s\n" + " " + "=" * 70 + " */\n\n"
@@ -158,7 +175,7 @@ def run (sourceDirectory, outputFilename = None, configFile = None):
## TODO: Do import when we walk the directories above? ## TODO: Do import when we walk the directories above?
for filepath in allFiles: for filepath in allFiles:
print "Importing: %s" % filepath print "Importing: %s" % filepath
fullpath = os.path.join(sourceDirectory, filepath) fullpath = os.path.join(sourceDirectory, filepath)
content = open(fullpath, "U").read() # TODO: Ensure end of line @ EOF? content = open(fullpath, "U").read() # TODO: Ensure end of line @ EOF?
files[filepath] = SourceFile(filepath, content) # TODO: Chop path? files[filepath] = SourceFile(filepath, content) # TODO: Chop path?
@@ -210,30 +227,6 @@ def run (sourceDirectory, outputFilename = None, configFile = None):
print "\nTotal files merged: %d " % len(allFiles) print "\nTotal files merged: %d " % len(allFiles)
if outputFilename: print "\nGenerating: %s" % (outputFilename)
print "\nGenerating: %s" % (outputFilename)
open(outputFilename, "w").write("".join(result))
return "".join(result)
if __name__ == "__main__": open(outputFilename, "w").write("".join(result))
import getopt
options, args = getopt.getopt(sys.argv[1:], "-c:")
try:
outputFilename = args[0]
except IndexError:
usage(sys.argv[0])
raise SystemExit
else:
sourceDirectory = args[1]
if not sourceDirectory:
usage(sys.argv[0])
raise SystemExit
configFile = None
if options and options[0][0] == "-c":
configFile = options[0][1]
print "Parsing configuration file: %s" % filename
run( sourceDirectory, outputFilename, configFile )

View File

@@ -12,5 +12,4 @@ cp -a theme/ /www/openlayers/htdocs/api/$VERSION
rm tools/*.pyc rm tools/*.pyc
cd .. cd ..
tar -zvcf OpenLayers-$VERSION.tar.gz OpenLayers-$VERSION tar -zvcf OpenLayers-$VERSION.tar.gz OpenLayers-$VERSION
zip -9r OpenLayers-$VERSION.zip OpenLayers-$VERSION cp OpenLayers-$VERSION.tar.gz /www/openlayers/htdocs/download/
cp OpenLayers-$VERSION.{tar.gz,zip} /www/openlayers/htdocs/download/