Compare commits
66 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bc061f1c3 | ||
|
|
7232cfa3a0 | ||
|
|
2642f000fd | ||
|
|
8ebc5b227a | ||
|
|
4cac0a24ea | ||
|
|
6c9cb570c7 | ||
|
|
f028effec2 | ||
|
|
5d00a21863 | ||
|
|
ba85494e5e | ||
|
|
7c0bc17be1 | ||
|
|
86d4133039 | ||
|
|
6462a7dc29 | ||
|
|
112978ac3d | ||
|
|
01cf10f53d | ||
|
|
88ac5a803c | ||
|
|
7e9eef8d07 | ||
|
|
b46a513077 | ||
|
|
f17ec3ab7d | ||
|
|
063a10d4ac | ||
|
|
46767efed2 | ||
|
|
9c6817f5d6 | ||
|
|
94dc03ea90 | ||
|
|
2d7f2d2f47 | ||
|
|
c014e5ea72 | ||
|
|
d5a7f1ef5c | ||
|
|
ba89ea595e | ||
|
|
cc3a4c113b | ||
|
|
2467940cd3 | ||
|
|
bef4a7d3a9 | ||
|
|
046fbf0662 | ||
|
|
632a2bd123 | ||
|
|
ff4899f520 | ||
|
|
15c2ab578f | ||
|
|
c951391368 | ||
|
|
36eb8c0bc9 | ||
|
|
e6ef35c174 | ||
|
|
5e7b2e03f1 | ||
|
|
71bcdb9b7c | ||
|
|
e1d715fc94 | ||
|
|
4c9e46e240 | ||
|
|
c14732b711 | ||
|
|
41f798eaf2 | ||
|
|
d77b849405 | ||
|
|
b4ae7778b6 | ||
|
|
76850371fe | ||
|
|
fb7b5fff56 | ||
|
|
57dc3a7f53 | ||
|
|
ac949589a0 | ||
|
|
1f18b68e7d | ||
|
|
17633136aa | ||
|
|
6e8754af91 | ||
|
|
876051d619 | ||
|
|
8bd55016aa | ||
|
|
7ecc62e55a | ||
|
|
819ccd7e06 | ||
|
|
b5334bde43 | ||
|
|
1325843cb3 | ||
|
|
9f9c366154 | ||
|
|
3d58bc6698 | ||
|
|
786c2a20fb | ||
|
|
af6307fd9b | ||
|
|
43c916a433 | ||
|
|
69b66e2100 | ||
|
|
f50fd0b7ac | ||
|
|
7ced2241fe | ||
|
|
02c285091e |
27
build/build.py
Executable file
27
build/build.py
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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 "Merging libraries."
|
||||||
|
merged = mergejs.run(sourceDirectory, None, configFilename)
|
||||||
|
print "Compressing."
|
||||||
|
minimized = jsmin.jsmin(merged)
|
||||||
|
print "Adding license file."
|
||||||
|
minimized = file("license.txt").read() + minimized
|
||||||
|
|
||||||
|
print "Writing to %s." % outputFilename
|
||||||
|
file(outputFilename, "w").write(minimized)
|
||||||
|
|
||||||
|
print "Done."
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#!/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.
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
rm ../doc/reference.html
|
rm ../doc/reference.html
|
||||||
CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.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 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"
|
||||||
echo "<html>
|
echo "<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OpenLayers Class Reference Documentation</title>
|
<title>OpenLayers Class Reference Documentation</title>
|
||||||
|
|||||||
@@ -10,5 +10,4 @@ Rico/Corner.js
|
|||||||
[include]
|
[include]
|
||||||
|
|
||||||
[exclude]
|
[exclude]
|
||||||
OpenLayers/Layer/Yahoo.js
|
|
||||||
OpenLayers/Control/KeyboardDefaults.js
|
OpenLayers/Control/KeyboardDefaults.js
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
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/license.txt
|
Please see http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
for the full text of the license.
|
for the full text of the license.
|
||||||
|
|
||||||
Includes compressed code under the following licenses:
|
Includes compressed code under the following licenses:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ A small control which displays the Longitude and Latitude of the current mouse p
|
|||||||
separator -- html to separate the longitude and latitude values (default: '<br />')
|
separator -- html to separate the longitude and latitude values (default: '<br />')
|
||||||
suffix -- html to follow the latitude value (default: '')
|
suffix -- html to follow the latitude value (default: '')
|
||||||
numdigits -- number of digits to the right of the decimal (default: 5)
|
numdigits -- number of digits to the right of the decimal (default: 5)
|
||||||
granularity -- a change of how many pixels is considered a mouse move (default: 1)
|
granularity -- Don't refresh display if mouse has moved more than this (default: 10)
|
||||||
|
|
||||||
prefix, separator, and suffix are used to format the lon/lat values.
|
prefix, separator, and suffix are used to format the lon/lat values.
|
||||||
|
|
||||||
|
|||||||
38
doc/Control.OverviewMap.txt
Normal file
38
doc/Control.OverviewMap.txt
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
OpenLayers.Control.PanZoom
|
OpenLayers.Control.PanZoomBar
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, used to choose the type of map to display.
|
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.)
|
||||||
|
|
||||||
|
|||||||
9
doc/Layer.Image.txt
Normal file
9
doc/Layer.Image.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
OpenLayers.Layer.Image
|
||||||
|
|
||||||
|
The Image Layer allows you to load a single image and use it as a layer in your
|
||||||
|
map.
|
||||||
|
|
||||||
|
|
||||||
|
* Constructor
|
||||||
|
OpenLayers.Layer(name, url, {OpenLayers.Bounds|bounds}, {OpenLayers.Size|size}, {options}) -- Image Layer constructor requires a name, URL of the image, geographic bounds of the image, pixel size of the image, and an optional options parameter.
|
||||||
|
|
||||||
15
doc/Layer.TMS.txt
Normal file
15
doc/Layer.TMS.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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.
|
||||||
@@ -2,14 +2,13 @@
|
|||||||
<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: 65%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
@@ -22,86 +21,29 @@
|
|||||||
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', format: 'png', 'transparent': 'off'},
|
{map: '/www/freemap.in/boston/map/gmaps.map', layers: 'border,water,roads,rapid_transit,buildings', 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+"&lat="+center.lat+"&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;"> </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>
|
||||||
|
|||||||
@@ -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/wms/vmap0?", {layers: 'basic'});
|
"http://labs.metacarta.com:80/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",
|
||||||
|
|||||||
51
examples/image-layer.html
Normal file
51
examples/image-layer.html
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<style type="text/css">
|
||||||
|
p {
|
||||||
|
width: 512px;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
width: 512px;
|
||||||
|
height: 256px;
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
function init(){
|
||||||
|
var map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
|
var options = {maxResolution: 'auto', numZoomLevels: 3};
|
||||||
|
|
||||||
|
var graphic = new OpenLayers.Layer.Image(
|
||||||
|
'City Lights',
|
||||||
|
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
|
||||||
|
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
||||||
|
new OpenLayers.Size(580, 288),
|
||||||
|
options);
|
||||||
|
|
||||||
|
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
|
||||||
|
"http://wms.jpl.nasa.gov/wms.cgi",
|
||||||
|
{layers: "modis,global_mosaic"}, options);
|
||||||
|
|
||||||
|
map.addLayers([graphic, jpl_wms]);
|
||||||
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
map.zoomToMaxExtent();
|
||||||
|
}
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body onload="init()">
|
||||||
|
<h1>OpenLayers Image Layer Example</h1>
|
||||||
|
<div id="map"></div>
|
||||||
|
<p>
|
||||||
|
The "City Lights" layer above is created from a single web accessible
|
||||||
|
image. If you construct it without any resolution related options,
|
||||||
|
the layer will be given a single resolution based on the extent/size.
|
||||||
|
Otherwise, it behaves much like a regular layer. This is primarily
|
||||||
|
intended to be used in an overview map - where another layer type
|
||||||
|
might not make a good overview.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3",
|
"http://ims.cr.usgs.gov/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]);
|
||||||
|
|||||||
43
examples/lonlatfrompx.html
Normal file
43
examples/lonlatfrompx.html
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<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>
|
||||||
35
examples/multiserver.html
Normal file
35
examples/multiserver.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<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>
|
||||||
47
examples/overviewmap.html
Normal file
47
examples/overviewmap.html
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<!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>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
point title description iconSize
|
point title description icon
|
||||||
10,20 my orange title my orange description 21,25
|
10,20 my orange title my orange description
|
||||||
2,4 my aqua title my aqua description 21,25
|
2,4 my aqua title my aqua description
|
||||||
42,-71 my purple title my purple description<br/>is great. 21,25
|
42,-71 my purple title my purple description<br/>is great. http://www.openlayers.org/api/img/zoom-world-mini.png
|
||||||
|
|||||||
39
examples/tms.html
Normal file
39
examples/tms.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<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>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
////
|
////
|
||||||
/// This blob sucks in all the files in uncompressed form for ease of use
|
/// This blob sucks in all the files in uncompressed form for ease of use
|
||||||
///
|
///
|
||||||
@@ -65,6 +66,7 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
|
|||||||
"OpenLayers/Feature/WFS.js",
|
"OpenLayers/Feature/WFS.js",
|
||||||
"OpenLayers/Tile/Image.js",
|
"OpenLayers/Tile/Image.js",
|
||||||
"OpenLayers/Tile/WFS.js",
|
"OpenLayers/Tile/WFS.js",
|
||||||
|
"OpenLayers/Layer/Image.js",
|
||||||
"OpenLayers/Layer/EventPane.js",
|
"OpenLayers/Layer/EventPane.js",
|
||||||
"OpenLayers/Layer/FixedZoomLevels.js",
|
"OpenLayers/Layer/FixedZoomLevels.js",
|
||||||
"OpenLayers/Layer/Google.js",
|
"OpenLayers/Layer/Google.js",
|
||||||
@@ -84,6 +86,7 @@ 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",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
OpenLayers.ProxyHost = "";
|
OpenLayers.ProxyHost = "";
|
||||||
//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";
|
//OpenLayers.ProxyHost = "examples/proxy.cgi?url=";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/* OpenLayers.Class metaclass */
|
/* OpenLayers.Class metaclass */
|
||||||
OpenLayers.Class = {
|
OpenLayers.Class = {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -354,12 +354,12 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
|
|
||||||
this.div.appendChild(this.layersDiv);
|
this.div.appendChild(this.layersDiv);
|
||||||
|
|
||||||
Rico.Corner.round(this.div, {corners: "tl bl",
|
OpenLayers.Rico.Corner.round(this.div, {corners: "tl bl",
|
||||||
bgColor: "transparent",
|
bgColor: "transparent",
|
||||||
color: this.activeColor,
|
color: this.activeColor,
|
||||||
blend: false});
|
blend: false});
|
||||||
|
|
||||||
Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
OpenLayers.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);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -19,14 +20,6 @@ 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));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +32,24 @@ 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));
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +104,9 @@ 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);
|
||||||
@@ -154,15 +168,21 @@ OpenLayers.Control.MouseDefaults.prototype =
|
|||||||
/** User spun scroll wheel up
|
/** User spun scroll wheel up
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
defaultWheelUp: function() {
|
defaultWheelUp: function(evt) {
|
||||||
this.map.zoomIn();
|
if (this.map.getZoom() <= this.map.getNumZoomLevels()) {
|
||||||
|
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
|
||||||
|
this.map.getZoom() + 1);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** User spun scroll wheel down
|
/** User spun scroll wheel down
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
defaultWheelDown: function() {
|
defaultWheelDown: function(evt) {
|
||||||
this.map.zoomOut();
|
if (this.map.getZoom() > 0) {
|
||||||
|
this.map.setCenter(this.map.getLonLatFromPixel(evt.xy),
|
||||||
|
this.map.getZoom() - 1);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Zoombox function.
|
/** Zoombox function.
|
||||||
@@ -237,10 +257,15 @@ 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();
|
this.defaultWheelDown(e);
|
||||||
} else {
|
} else {
|
||||||
this.defaultWheelUp();
|
this.defaultWheelUp(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -27,7 +28,7 @@ OpenLayers.Control.MousePosition.prototype =
|
|||||||
numdigits: 5,
|
numdigits: 5,
|
||||||
|
|
||||||
/** @type int */
|
/** @type int */
|
||||||
granularity: 1,
|
granularity: 10,
|
||||||
|
|
||||||
/** @type OpenLayers.LonLat */
|
/** @type OpenLayers.LonLat */
|
||||||
lastXy: null,
|
lastXy: null,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -47,8 +48,10 @@ 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
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
OpenLayers.Event = {
|
OpenLayers.Event = {
|
||||||
KEY_BACKSPACE: 8,
|
KEY_BACKSPACE: 8,
|
||||||
@@ -95,9 +96,9 @@ OpenLayers.Event = {
|
|||||||
|| element.detachEvent))
|
|| element.detachEvent))
|
||||||
name = 'keydown';
|
name = 'keydown';
|
||||||
|
|
||||||
if (element.removeEventListener) {
|
if (element && element.removeEventListener) {
|
||||||
element.removeEventListener(name, observer, useCapture);
|
element.removeEventListener(name, observer, useCapture);
|
||||||
} else if (element.detachEvent) {
|
} else if (element && element.detachEvent) {
|
||||||
element.detachEvent('on' + name, observer);
|
element.detachEvent('on' + name, observer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,7 +272,10 @@ OpenLayers.Events.prototype = {
|
|||||||
evt.element = this.element;
|
evt.element = this.element;
|
||||||
|
|
||||||
// execute all callbacks registered for specified type
|
// execute all callbacks registered for specified type
|
||||||
var listeners = this.listeners[type];
|
// get a clone of the listeners array to
|
||||||
|
// allow for splicing during callbacks
|
||||||
|
var listeners = (this.listeners[type]) ?
|
||||||
|
this.listeners[type].slice() : null;
|
||||||
if ((listeners != null) && (listeners.length > 0)) {
|
if ((listeners != null) && (listeners.length > 0)) {
|
||||||
for (var i = 0; i < listeners.length; i++) {
|
for (var i = 0; i < listeners.length; i++) {
|
||||||
var callback = listeners[i];
|
var callback = listeners[i];
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -507,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 - (size.w / 2);
|
var delta_x = viewPortPx.x - Math.ceil(size.w / 2);
|
||||||
var delta_y = viewPortPx.y - (size.h / 2);
|
var delta_y = viewPortPx.y - Math.ceil(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);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -44,7 +45,7 @@ OpenLayers.Layer.GeoRSS.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?} ajaxRequest
|
* @param {XMLHttpRequest} ajaxRequest
|
||||||
*/
|
*/
|
||||||
parseData: function(ajaxRequest) {
|
parseData: function(ajaxRequest) {
|
||||||
var doc = ajaxRequest.responseXML;
|
var doc = ajaxRequest.responseXML;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -226,7 +227,7 @@ OpenLayers.Layer.Google.prototype =
|
|||||||
html += " correct API key for your site.<br>";
|
html += " correct API key for your site.<br>";
|
||||||
html += "<br>";
|
html += "<br>";
|
||||||
html += "Developers: For help getting this working correctly, ";
|
html += "Developers: For help getting this working correctly, ";
|
||||||
html += "<a href='http://trac.openlayers.org/wiki/GoogleMapsLayer' "
|
html += "<a href='http://trac.openlayers.org/wiki/Google' "
|
||||||
html += "target='_blank'>";
|
html += "target='_blank'>";
|
||||||
html += "click here";
|
html += "click here";
|
||||||
html += "</a>";
|
html += "</a>";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -106,21 +107,33 @@ 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 * (this.buffer - 1)) {
|
if (tlViewPort.x > -this.tileSize.w * (buffer - 1)) {
|
||||||
this.shiftColumn(true);
|
this.shiftColumn(true);
|
||||||
} else if (tlViewPort.x < -this.tileSize.w * this.buffer) {
|
} else if (tlViewPort.x < -this.tileSize.w * buffer) {
|
||||||
this.shiftColumn(false);
|
this.shiftColumn(false);
|
||||||
} else if (tlViewPort.y > -this.tileSize.h * (this.buffer - 1)) {
|
} else if (tlViewPort.y > -this.tileSize.h * (buffer - 1)) {
|
||||||
this.shiftRow(true);
|
this.shiftRow(true);
|
||||||
} else if (tlViewPort.y < -this.tileSize.h * this.buffer) {
|
} else if (tlViewPort.y < -this.tileSize.h * 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +165,13 @@ 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();
|
||||||
@@ -215,12 +234,31 @@ 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();
|
||||||
},
|
},
|
||||||
@@ -324,8 +362,9 @@ 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++) {
|
||||||
OpenLayers.Util.clearArray(row[iCol]);
|
row[iCol].destroy();
|
||||||
}
|
}
|
||||||
|
this.grid = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -108,21 +109,34 @@ 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);
|
||||||
var allParams = OpenLayers.Util.extend(allParams, newParams);
|
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 = this.url.charAt(this.url.length - 1);
|
var lastServerChar = url.charAt(url.length - 1);
|
||||||
if ((lastServerChar == "&") || (lastServerChar == "?")) {
|
if ((lastServerChar == "&") || (lastServerChar == "?")) {
|
||||||
requestString += paramsString;
|
requestString += paramsString;
|
||||||
} else {
|
} else {
|
||||||
if (this.url.indexOf('?') == -1) {
|
if (url.indexOf('?') == -1) {
|
||||||
//serverPath has no ? -- add one
|
//serverPath has no ? -- add one
|
||||||
requestString += '?' + paramsString;
|
requestString += '?' + paramsString;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
161
lib/OpenLayers/Layer/Image.js
Normal file
161
lib/OpenLayers/Layer/Image.js
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
|
||||||
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fileoverview Image Layer
|
||||||
|
* @author Tim Schaub
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class
|
||||||
|
*
|
||||||
|
* @requires OpenLayers/Layer.js
|
||||||
|
*/
|
||||||
|
OpenLayers.Layer.Image = OpenLayers.Class.create();
|
||||||
|
OpenLayers.Layer.Image.prototype =
|
||||||
|
OpenLayers.Class.inherit(OpenLayers.Layer, {
|
||||||
|
|
||||||
|
/** By default, Layer.Image will be a baselayer
|
||||||
|
*
|
||||||
|
* @type Boolean */
|
||||||
|
isBaseLayer: true,
|
||||||
|
|
||||||
|
/** @type String */
|
||||||
|
url: null,
|
||||||
|
|
||||||
|
/** @type OpenLayers.Bounds */
|
||||||
|
extent: null,
|
||||||
|
|
||||||
|
/** @type OpenLayers.Size */
|
||||||
|
size: null,
|
||||||
|
|
||||||
|
/** @type OpenLayers.Tile.Image */
|
||||||
|
tile: null,
|
||||||
|
|
||||||
|
/** The ratio of height/width represented by a single pixel in the graphic
|
||||||
|
*
|
||||||
|
* @type Float */
|
||||||
|
aspectRatio: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @param {String} url Relative or absolute path to the image
|
||||||
|
* @param {OpenLayers.Bounds} extent The extent represented by 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
|
||||||
|
*/
|
||||||
|
initialize: function(name, url, extent, size, options) {
|
||||||
|
this.url = url;
|
||||||
|
this.extent = extent;
|
||||||
|
this.size = size;
|
||||||
|
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
|
||||||
|
|
||||||
|
this.aspectRatio = (this.extent.getHeight() / this.size.h) /
|
||||||
|
(this.extent.getWidth() / this.size.w);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
destroy: function() {
|
||||||
|
this.tile.destroy();
|
||||||
|
this.tile = null;
|
||||||
|
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} obj
|
||||||
|
*
|
||||||
|
* @returns An exact clone of this OpenLayers.Layer.Image
|
||||||
|
* @type OpenLayers.Layer.Image
|
||||||
|
*/
|
||||||
|
clone: function(obj) {
|
||||||
|
|
||||||
|
if(obj == null) {
|
||||||
|
obj = new OpenLayers.Layer.Image(this.name,
|
||||||
|
this.url,
|
||||||
|
this.extent,
|
||||||
|
this.size,
|
||||||
|
this.options);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get all additions from superclasses
|
||||||
|
obj = OpenLayers.Layer.prototype.clone.apply(this, [obj]);
|
||||||
|
|
||||||
|
// copy/set any non-init, non-simple values here
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {OpenLayers.Map} map
|
||||||
|
*/
|
||||||
|
setMap: function(map) {
|
||||||
|
// If nothing to do with resolutions has been set, assume a single
|
||||||
|
// resolution determined by extent/size
|
||||||
|
if( this.options.maxResolution == null ) {
|
||||||
|
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
||||||
|
}
|
||||||
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Create the tile for the image or resize it for the new resolution
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Bounds} bounds
|
||||||
|
* @param {Boolean} zoomChanged
|
||||||
|
* @param {Boolean} dragging
|
||||||
|
*/
|
||||||
|
moveTo:function(bounds, zoomChanged, dragging) {
|
||||||
|
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
|
||||||
|
|
||||||
|
var firstRendering = (this.tile == null);
|
||||||
|
|
||||||
|
if(zoomChanged || firstRendering) {
|
||||||
|
|
||||||
|
//determine new tile size
|
||||||
|
var tileWidth = this.extent.getWidth() / this.map.getResolution();
|
||||||
|
var tileHeight = this.extent.getHeight() /
|
||||||
|
(this.map.getResolution() * this.aspectRatio);
|
||||||
|
var tileSize = new OpenLayers.Size(tileWidth, tileHeight);
|
||||||
|
|
||||||
|
//determine new position (upper left corner of new bounds)
|
||||||
|
var ul = new OpenLayers.LonLat(this.extent.left, this.extent.top);
|
||||||
|
var ulPx = this.map.getLayerPxFromLonLat(ul);
|
||||||
|
|
||||||
|
if(firstRendering) {
|
||||||
|
//create the new tile
|
||||||
|
this.tile = new OpenLayers.Tile.Image(this, ulPx, this.extent,
|
||||||
|
this.url, tileSize);
|
||||||
|
} else {
|
||||||
|
//just resize the tile and set it's new position
|
||||||
|
this.tile.size = tileSize.clone();
|
||||||
|
this.tile.position = ulPx.clone();
|
||||||
|
}
|
||||||
|
this.tile.draw();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} newUrl
|
||||||
|
*/
|
||||||
|
setUrl: function(newUrl) {
|
||||||
|
this.url = newUrl;
|
||||||
|
this.draw();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 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,
|
||||||
|
* anyways)
|
||||||
|
*
|
||||||
|
* @param {OpenLayers.Bounds} bounds
|
||||||
|
*/
|
||||||
|
getURL: function(bounds) {
|
||||||
|
return this.url;
|
||||||
|
},
|
||||||
|
|
||||||
|
/** @final @type String */
|
||||||
|
CLASS_NAME: "OpenLayers.Layer.Image"
|
||||||
|
});
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* 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"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -65,7 +65,7 @@ OpenLayers.Layer.MultiMap.prototype =
|
|||||||
html += " script was either not correctly included.<br>";
|
html += " script was either not correctly included.<br>";
|
||||||
html += "<br>";
|
html += "<br>";
|
||||||
html += "Demmlopers: For help getting this working correctly, ";
|
html += "Demmlopers: For help getting this working correctly, ";
|
||||||
html += "<a href='http://trac.openlayers.org/wiki/MultiMapLayer' "
|
html += "<a href='http://trac.openlayers.org/wiki/MultiMap' "
|
||||||
html += "target='_blank'>";
|
html += "target='_blank'>";
|
||||||
html += "click here";
|
html += "click here";
|
||||||
html += "</a>";
|
html += "</a>";
|
||||||
|
|||||||
112
lib/OpenLayers/Layer/TMS.js
Normal file
112
lib/OpenLayers/Layer/TMS.js
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD licence.
|
||||||
|
* See http://svn.openlayers.org/trunk/openlayers/repository-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"
|
||||||
|
});
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -48,7 +49,7 @@ OpenLayers.Layer.Text.prototype =
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?} ajaxRequest
|
* @param {XMLHttpRequest} ajaxRequest
|
||||||
*/
|
*/
|
||||||
parseData: function(ajaxRequest) {
|
parseData: function(ajaxRequest) {
|
||||||
var text = ajaxRequest.responseText;
|
var text = ajaxRequest.responseText;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -80,7 +81,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
|
|||||||
html += " script was either not correctly included.<br>";
|
html += " script was either not correctly included.<br>";
|
||||||
html += "<br>";
|
html += "<br>";
|
||||||
html += "Developers: For help getting this working correctly, ";
|
html += "Developers: For help getting this working correctly, ";
|
||||||
html += "<a href='http://trac.openlayers.org/wiki/VirtualEarthLayer' "
|
html += "<a href='http://trac.openlayers.org/wiki/VirtualEarth' "
|
||||||
html += "target='_blank'>";
|
html += "target='_blank'>";
|
||||||
html += "click here";
|
html += "click here";
|
||||||
html += "</a>";
|
html += "</a>";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -124,7 +125,7 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
|
|
||||||
//clear out the old tile
|
//clear out the old tile
|
||||||
if (this.tile) {
|
if (this.tile) {
|
||||||
OpenLayers.Util.clearArray(this.tile);
|
this.tile.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//determine new tile bounds
|
//determine new tile bounds
|
||||||
@@ -149,6 +150,11 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
|||||||
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
|
||||||
var pos = this.map.getLayerPxFromLonLat(ul);
|
var pos = this.map.getLayerPxFromLonLat(ul);
|
||||||
|
|
||||||
|
if ( this.tile && !this.tile.size.equals(tileSize)) {
|
||||||
|
this.tile.destroy();
|
||||||
|
this.tile = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.tile) {
|
if (!this.tile) {
|
||||||
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
this.tile = new OpenLayers.Tile.Image(this, pos, tileBounds,
|
||||||
url, tileSize);
|
url, tileSize);
|
||||||
@@ -187,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();
|
this.moveTo(null, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** combine the layer's url with its params and these newParams.
|
/** combine the layer's url with its params and these newParams.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -94,7 +95,7 @@ OpenLayers.Layer.Yahoo.prototype =
|
|||||||
html += " script was either not correctly included.<br>";
|
html += " script was either not correctly included.<br>";
|
||||||
html += "<br>";
|
html += "<br>";
|
||||||
html += "Developers: For help getting this working correctly, ";
|
html += "Developers: For help getting this working correctly, ";
|
||||||
html += "<a href='http://trac.openlayers.org/wiki/YahooLayer' "
|
html += "<a href='http://trac.openlayers.org/wiki/Yahoo' "
|
||||||
html += "target='_blank'>";
|
html += "target='_blank'>";
|
||||||
html += "click here";
|
html += "click here";
|
||||||
html += "</a>";
|
html += "</a>";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -430,16 +431,19 @@ OpenLayers.Map.prototype = {
|
|||||||
* @param {Boolean} noEvent
|
* @param {Boolean} noEvent
|
||||||
*/
|
*/
|
||||||
setBaseLayer: function(newBaseLayer, noEvent) {
|
setBaseLayer: function(newBaseLayer, noEvent) {
|
||||||
var oldBaseLayer = this.baseLayer;
|
var oldExtent = null;
|
||||||
|
if(this.baseLayer) {
|
||||||
|
oldExtent = this.baseLayer.getExtent();
|
||||||
|
}
|
||||||
|
|
||||||
if (newBaseLayer != oldBaseLayer) {
|
if (newBaseLayer != this.baseLayer) {
|
||||||
|
|
||||||
// is newBaseLayer an already loaded layer?
|
// is newBaseLayer an already loaded layer?
|
||||||
if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
|
if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
|
||||||
|
|
||||||
// make the old base layer invisible
|
// make the old base layer invisible
|
||||||
if (oldBaseLayer != null) {
|
if (this.baseLayer != null) {
|
||||||
oldBaseLayer.setVisibility(false, noEvent);
|
this.baseLayer.setVisibility(false, noEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set new baselayer and make it visible
|
// set new baselayer and make it visible
|
||||||
@@ -449,10 +453,10 @@ OpenLayers.Map.prototype = {
|
|||||||
//redraw all layers
|
//redraw all layers
|
||||||
var center = this.getCenter();
|
var center = this.getCenter();
|
||||||
if (center != null) {
|
if (center != null) {
|
||||||
if (oldBaseLayer == null) {
|
if (oldExtent == null) {
|
||||||
this.setCenter(center);
|
this.setCenter(center);
|
||||||
} else {
|
} else {
|
||||||
this.zoomToExtent(oldBaseLayer.getExtent());
|
this.zoomToExtent(oldExtent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,12 +483,17 @@ OpenLayers.Map.prototype = {
|
|||||||
* @param {OpenLayers.Pixel} px
|
* @param {OpenLayers.Pixel} px
|
||||||
*/
|
*/
|
||||||
addControlToMap: function (control, px) {
|
addControlToMap: function (control, px) {
|
||||||
|
// If a control doesn't have a div at this point, it belongs in the
|
||||||
|
// viewport.
|
||||||
|
control.outsideViewport = (control.div != null);
|
||||||
control.setMap(this);
|
control.setMap(this);
|
||||||
var div = control.draw(px);
|
var div = control.draw(px);
|
||||||
if (div) {
|
if (div) {
|
||||||
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
|
if(!control.outsideViewport) {
|
||||||
this.controls.length;
|
div.style.zIndex = this.Z_INDEX_BASE['Control'] +
|
||||||
this.viewPortDiv.appendChild( div );
|
this.controls.length;
|
||||||
|
this.viewPortDiv.appendChild( div );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -785,8 +794,10 @@ OpenLayers.Map.prototype = {
|
|||||||
var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin);
|
var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin);
|
||||||
var newPx = this.getViewPortPxFromLonLat(lonlat);
|
var newPx = this.getViewPortPxFromLonLat(lonlat);
|
||||||
|
|
||||||
this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px";
|
if ((originPx != null) && (newPx != null)) {
|
||||||
this.layerContainerDiv.style.top = (originPx.y - newPx.y) + "px";
|
this.layerContainerDiv.style.left = (originPx.x - newPx.x) + "px";
|
||||||
|
this.layerContainerDiv.style.top = (originPx.y - newPx.y) + "px";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -125,7 +126,11 @@ OpenLayers.Marker.prototype = {
|
|||||||
OpenLayers.Marker.defaultIcon = function() {
|
OpenLayers.Marker.defaultIcon = function() {
|
||||||
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
|
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
|
||||||
var size = new OpenLayers.Size(21, 25);
|
var size = new OpenLayers.Size(21, 25);
|
||||||
return new OpenLayers.Icon(url, size);
|
var calculateOffset = function(size) {
|
||||||
|
return new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||||
|
};
|
||||||
|
|
||||||
|
return new OpenLayers.Icon(url, size, null, calculateOffset);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -8,18 +9,22 @@
|
|||||||
* @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.Class.inherit( OpenLayers.Marker, {
|
OpenLayers.Marker.Box.prototype =
|
||||||
/** @type OpenLayers.LonLat */
|
OpenLayers.Class.inherit( OpenLayers.Marker, {
|
||||||
|
|
||||||
|
/** @type OpenLayers.Bounds */
|
||||||
bounds: null,
|
bounds: null,
|
||||||
|
|
||||||
|
/** @type DOMElement */
|
||||||
div: null,
|
div: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {OpenLayers.Icon} icon
|
* @param {OpenLayers.Bounds} bounds
|
||||||
* @param {OpenLayers.LonLat lonlat
|
* @param {String} borderColor
|
||||||
*/
|
* @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();
|
||||||
@@ -28,14 +33,24 @@ OpenLayers.Marker.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Marker, {
|
|||||||
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) color = "red";
|
if (!color) {
|
||||||
if (!width) width = 2;
|
color = "red";
|
||||||
|
}
|
||||||
|
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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -206,6 +207,10 @@ 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";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -69,10 +70,13 @@ 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";
|
||||||
|
|
||||||
//size has changed - must redo corners
|
if (this.map) {
|
||||||
this.setRicoCorners(!this.rounded);
|
//size has changed - must redo corners
|
||||||
this.rounded = true;
|
this.setRicoCorners(!this.rounded);
|
||||||
|
this.rounded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -87,7 +91,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";
|
||||||
Rico.Corner.changeColor(this.contentDiv, this.backgroundColor);
|
OpenLayers.Rico.Corner.changeColor(this.contentDiv, this.backgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -102,7 +106,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
|||||||
|
|
||||||
if (this.div != null) {
|
if (this.div != null) {
|
||||||
if (this.contentDiv != null) {
|
if (this.contentDiv != null) {
|
||||||
Rico.Corner.changeOpacity(this.contentDiv, this.opacity);
|
OpenLayers.Rico.Corner.changeOpacity(this.contentDiv, this.opacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -133,9 +137,9 @@ OpenLayers.Popup.AnchoredBubble.prototype =
|
|||||||
blend: false};
|
blend: false};
|
||||||
|
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
Rico.Corner.round(this.div, options);
|
OpenLayers.Rico.Corner.round(this.div, options);
|
||||||
} else {
|
} else {
|
||||||
Rico.Corner.reRound(this.contentDiv, options);
|
OpenLayers.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();
|
||||||
|
|||||||
@@ -1,5 +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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
_OPENLAYERS_SFL_=true
|
|
||||||
|
_OPENLAYERS_SFL_=true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @class
|
* @class
|
||||||
@@ -68,7 +69,12 @@ OpenLayers.Tile.prototype = {
|
|||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
draw:function() {
|
draw:function() {
|
||||||
this.drawn = true;
|
this.clear();
|
||||||
|
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)));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +88,7 @@ OpenLayers.Tile.prototype = {
|
|||||||
redraw = true;
|
redraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenLayers.Util.clearArray(this);
|
this.clear();
|
||||||
this.bounds = bounds.clone();
|
this.bounds = bounds.clone();
|
||||||
this.position = position.clone();
|
this.position = position.clone();
|
||||||
if (redraw) {
|
if (redraw) {
|
||||||
@@ -98,8 +104,8 @@ OpenLayers.Tile.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getBoundsFromBaseLayer: function(position) {
|
getBoundsFromBaseLayer: function(position) {
|
||||||
var topLeft = this.layer.map.getLonLatFromLayerPx(this.position);
|
var topLeft = this.layer.map.getLonLatFromLayerPx(position);
|
||||||
var bottomRightPx = this.position.clone();
|
var bottomRightPx = 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);
|
||||||
@@ -111,7 +117,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;
|
||||||
},
|
},
|
||||||
@@ -120,3 +126,4 @@ OpenLayers.Tile.prototype = {
|
|||||||
CLASS_NAME: "OpenLayers.Tile"
|
CLASS_NAME: "OpenLayers.Tile"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -42,29 +43,28 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
draw:function() {
|
draw:function() {
|
||||||
OpenLayers.Tile.prototype.draw.apply(this, arguments);
|
|
||||||
|
|
||||||
if (this.imgDiv == null) {
|
|
||||||
this.initImgDiv();
|
|
||||||
}
|
|
||||||
if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
|
if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
|
||||||
this.bounds = this.getBoundsFromBaseLayer(this.position);
|
this.bounds = this.getBoundsFromBaseLayer(this.position);
|
||||||
}
|
}
|
||||||
|
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
|
||||||
this.url = this.layer.getURL(this.bounds);
|
return false;
|
||||||
this.imgDiv.style.display = "none";
|
|
||||||
if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent &&
|
|
||||||
(this.bounds.intersectsBounds(this.layer.maxExtent,false))
|
|
||||||
)) {
|
|
||||||
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) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (this.imgDiv == null) {
|
||||||
|
this.initImgDiv();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.url = this.layer.getURL(this.bounds);
|
||||||
|
|
||||||
|
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
|
||||||
@@ -117,12 +117,14 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
|
|
||||||
this.imgDiv.className = 'olTileImage';
|
this.imgDiv.className = 'olTileImage';
|
||||||
|
|
||||||
/* checkImgURL *should* pretty predictably get called after the
|
/* checkImgURL used to be used to called as a work around, but it
|
||||||
createImage / createAlphaImageDiv onLoad handler */
|
ended up hiding problems instead of solving them and broke things
|
||||||
|
like relative URLs. See discussion on the dev list:
|
||||||
|
http://openlayers.org/pipermail/dev/2007-January/000205.html
|
||||||
|
|
||||||
OpenLayers.Event.observe( this.imgDiv, "load",
|
OpenLayers.Event.observe( this.imgDiv, "load",
|
||||||
this.checkImgURL.bindAsEventListener(this) );
|
this.checkImgURL.bindAsEventListener(this) );
|
||||||
|
*/
|
||||||
this.layer.div.appendChild(this.imgDiv);
|
this.layer.div.appendChild(this.imgDiv);
|
||||||
if(this.layer.opacity != null) {
|
if(this.layer.opacity != null) {
|
||||||
|
|
||||||
@@ -139,13 +141,25 @@ OpenLayers.Tile.Image.prototype =
|
|||||||
* the imgDiv display to 'none', as either (a) it will be reset to visible
|
* the imgDiv display to 'none', as either (a) it will be reset to visible
|
||||||
* when the new URL loads in the image, or (b) we don't want to display
|
* when the new URL loads in the image, or (b) we don't want to display
|
||||||
* this tile after all because its new bounds are outside our maxExtent.
|
* this tile after all because its new bounds are outside our maxExtent.
|
||||||
|
*
|
||||||
|
* This function should no longer be neccesary with the improvements to
|
||||||
|
* Grid.js in OpenLayers 2.3. The lack of a good isEquivilantURL function
|
||||||
|
* caused problems in 2.2, but it's possible that with the improved
|
||||||
|
* isEquivilant URL function, this might be neccesary at some point.
|
||||||
|
*
|
||||||
|
* See discussion in the thread at
|
||||||
|
* http://openlayers.org/pipermail/dev/2007-January/000205.html
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
checkImgURL: function () {
|
checkImgURL: function () {
|
||||||
var loaded = this.layer.alpha ? this.imgDiv.firstChild.src : this.imgDiv.src;
|
// Sometimes our image will load after it has already been removed
|
||||||
if (loaded != this.url) {
|
// from the map, in which case this check is not needed.
|
||||||
this.imgDiv.style.display = "none";
|
if (this.layer) {
|
||||||
|
var loaded = this.layer.alpha ? this.imgDiv.firstChild.src : this.imgDiv.src;
|
||||||
|
if (!OpenLayers.Util.isEquivalentUrl(loaded, this.url)) {
|
||||||
|
this.imgDiv.style.display = "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -56,14 +57,12 @@ OpenLayers.Tile.WFS.prototype =
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
draw:function() {
|
draw:function() {
|
||||||
if (this.drawn) {
|
if (!OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
|
||||||
OpenLayers.Util.clearArray(this);
|
return false;
|
||||||
}
|
}
|
||||||
OpenLayers.Tile.prototype.draw.apply(this, arguments);
|
this.loadFeaturesForRegion(this.requestSuccess);
|
||||||
if (this.layer.displayOutsideMaxExtent || (this.layer.maxExtent &&
|
this.drawn = true;
|
||||||
this.layer.maxExtent.intersectsBounds(this.bounds, false))) {
|
return true;
|
||||||
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
|
||||||
@@ -89,7 +88,7 @@ OpenLayers.Tile.WFS.prototype =
|
|||||||
|
|
||||||
/** Return from AJAX request
|
/** Return from AJAX request
|
||||||
*
|
*
|
||||||
* @param {} request
|
* @param {XMLHttpRequest} request
|
||||||
*/
|
*/
|
||||||
requestSuccess:function(request) {
|
requestSuccess:function(request) {
|
||||||
var doc = request.responseXML;
|
var doc = request.responseXML;
|
||||||
@@ -130,3 +129,4 @@ OpenLayers.Tile.WFS.prototype =
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* 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/license.txt for the full
|
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
|
||||||
* text of the license. */
|
* for the full text of the license. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
@@ -221,9 +222,14 @@ 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.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
|
this._attempts = (this._attempts) ? (this._attempts + 1) : 1;
|
||||||
|
if(this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
|
||||||
|
this.src = this.src;
|
||||||
|
} else {
|
||||||
|
this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor;
|
||||||
|
}
|
||||||
this.style.display = "";
|
this.style.display = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -379,7 +385,8 @@ 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(key + "=" + value);
|
paramsArray.push(encodeURIComponent(key) + "=" +
|
||||||
|
encodeURIComponent(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,21 +558,31 @@ 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() {
|
|
||||||
var args = new Object();
|
|
||||||
var query = location.search.substring(1); // Get query string.
|
|
||||||
var pairs = query.split("&"); // Break at ampersand. //+pjl
|
|
||||||
|
|
||||||
for(var i = 0; i < pairs.length; i++) {
|
/**
|
||||||
var pos = pairs[i].indexOf('='); // Look for "name=value".
|
* @param {String} url Optional url used to extract the query string.
|
||||||
if (pos == -1) continue; // If not found, skip.
|
* If null, query string is taken from page location.
|
||||||
var argname = pairs[i].substring(0,pos); // Extract the name.
|
*
|
||||||
var value = pairs[i].substring(pos+1); // Extract the value.
|
* @returns An object of key/value pairs from the query string.
|
||||||
args[argname] = unescape(value); // Store as a property.
|
* @type Object
|
||||||
|
*/
|
||||||
|
OpenLayers.Util.getArgs = function(url) {
|
||||||
|
if(url == null) {
|
||||||
|
url = window.location.href;
|
||||||
}
|
}
|
||||||
return args; // Return the object.
|
var query = (url.indexOf('?') != -1) ? url.substring(url.indexOf('?') + 1) : '';
|
||||||
};
|
|
||||||
|
var args = new Object();
|
||||||
|
pairs = query.split(/[&;]/);
|
||||||
|
for(var i = 0; i < pairs.length; ++i) {
|
||||||
|
keyValue = pairs[i].split(/=/);
|
||||||
|
if(keyValue.length == 2) {
|
||||||
|
args[decodeURIComponent(keyValue[0])] =
|
||||||
|
decodeURIComponent(keyValue[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} prefix String to prefix random id. If null, default
|
* @param {String} prefix String to prefix random id. If null, default
|
||||||
@@ -691,3 +708,218 @@ 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 all keys (host, port, etc)
|
||||||
|
for(var key in urlObj1) {
|
||||||
|
if (options.test) {
|
||||||
|
alert(key + "\n1:" + urlObj1[key] + "\n2:" + urlObj2[key]);
|
||||||
|
}
|
||||||
|
var val1 = urlObj1[key];
|
||||||
|
var val2 = urlObj2[key];
|
||||||
|
|
||||||
|
switch(key) {
|
||||||
|
case "args":
|
||||||
|
//do nothing, they'll be treated below
|
||||||
|
break;
|
||||||
|
case "host":
|
||||||
|
case "port":
|
||||||
|
case "protocol":
|
||||||
|
if ((val1 == "") || (val2 == "")) {
|
||||||
|
//these will be blank for relative urls, so no need to
|
||||||
|
// compare them here -- call break.
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// otherwise continue with default compare
|
||||||
|
//
|
||||||
|
default:
|
||||||
|
if ( (key != "args") && (urlObj1[key] != urlObj2[key]) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
//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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//protocol
|
||||||
|
urlObject.protocol = a.protocol;
|
||||||
|
|
||||||
|
//port
|
||||||
|
urlObject.port = ((port == "80") && (options.ignorePort80)) ? "" : port;
|
||||||
|
|
||||||
|
//hash
|
||||||
|
urlObject.hash = (options.ignoreHash) ? "" : a.hash;
|
||||||
|
|
||||||
|
//args
|
||||||
|
var queryString = a.search;
|
||||||
|
if (!queryString) {
|
||||||
|
var qMark = url.indexOf("?");
|
||||||
|
queryString = (qMark != -1) ? url.substr(qMark) : "";
|
||||||
|
}
|
||||||
|
urlObject.args = OpenLayers.Util.getArgs(queryString);
|
||||||
|
|
||||||
|
|
||||||
|
//pathname (this part allows for relative <-> absolute comparison)
|
||||||
|
if ( ((urlObject.protocol == "file:") && (url.indexOf("file:") != -1)) ||
|
||||||
|
((urlObject.protocol != "file:") && (urlObject.host != "")) ) {
|
||||||
|
|
||||||
|
urlObject.pathname = a.pathname;
|
||||||
|
|
||||||
|
//Test to see if the pathname includes the arguments (Opera)
|
||||||
|
var qIndex = urlObject.pathname.indexOf("?");
|
||||||
|
if (qIndex != -1) {
|
||||||
|
urlObject.pathname = urlObject.pathname.substring(0, qIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var relStr = OpenLayers.Util.removeTail(url);
|
||||||
|
|
||||||
|
var backs = 0;
|
||||||
|
do {
|
||||||
|
var index = relStr.indexOf("../");
|
||||||
|
|
||||||
|
if (index == 0) {
|
||||||
|
backs++
|
||||||
|
relStr = relStr.substr(3);
|
||||||
|
} else if (index >= 0) {
|
||||||
|
var prevChunk = relStr.substr(0,index - 1);
|
||||||
|
|
||||||
|
var slash = prevChunk.indexOf("/");
|
||||||
|
prevChunk = (slash != -1) ? prevChunk.substr(0, slash +1)
|
||||||
|
: "";
|
||||||
|
|
||||||
|
var postChunk = relStr.substr(index + 3);
|
||||||
|
relStr = prevChunk + postChunk;
|
||||||
|
}
|
||||||
|
} while(index != -1)
|
||||||
|
|
||||||
|
var windowAnchor = document.createElement("a");
|
||||||
|
var windowUrl = window.location.href;
|
||||||
|
if (options.ignoreCase) {
|
||||||
|
windowUrl = windowUrl.toLowerCase();
|
||||||
|
}
|
||||||
|
windowAnchor.href = windowUrl;
|
||||||
|
|
||||||
|
//set protocol of window
|
||||||
|
urlObject.protocol = windowAnchor.protocol;
|
||||||
|
|
||||||
|
var splitter = (windowAnchor.pathname.indexOf("/") != -1) ? "/" : "\\";
|
||||||
|
var dirs = windowAnchor.pathname.split(splitter);
|
||||||
|
dirs.pop(); //remove filename
|
||||||
|
while ((backs > 0) && (dirs.length > 0)) {
|
||||||
|
dirs.pop();
|
||||||
|
backs--;
|
||||||
|
}
|
||||||
|
relStr = dirs.join("/") + "/"+ relStr;
|
||||||
|
urlObject.pathname = relStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((urlObject.protocol == "file:") || (urlObject.protocol == "")) {
|
||||||
|
urlObject.host = "localhost";
|
||||||
|
}
|
||||||
|
|
||||||
|
return urlObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} url
|
||||||
|
*
|
||||||
|
* @returns The string with all queryString and Hash removed
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
OpenLayers.Util.removeTail = function(url) {
|
||||||
|
var head = null;
|
||||||
|
|
||||||
|
var qMark = url.indexOf("?");
|
||||||
|
var hashMark = url.indexOf("#");
|
||||||
|
|
||||||
|
if (qMark == -1) {
|
||||||
|
head = (hashMark != -1) ? url.substr(0,hashMark) : url;
|
||||||
|
} else {
|
||||||
|
head = (hashMark != -1) ? url.substr(0,Math.min(qMark, hashMark))
|
||||||
|
: url.substr(0, qMark);
|
||||||
|
}
|
||||||
|
return head;
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Rico.Color = OpenLayers.Class.create();
|
OpenLayers.Rico.Color = OpenLayers.Class.create();
|
||||||
|
|
||||||
Rico.Color.prototype = {
|
OpenLayers.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 @@ Rico.Color.prototype = {
|
|||||||
hsb.h = h;
|
hsb.h = h;
|
||||||
|
|
||||||
// convert back to RGB...
|
// convert back to RGB...
|
||||||
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSaturation: function(s) {
|
setSaturation: function(s) {
|
||||||
@@ -34,7 +34,7 @@ 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 = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBrightness: function(b) {
|
setBrightness: function(b) {
|
||||||
@@ -43,17 +43,17 @@ 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 = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
|
this.rgb = OpenLayers.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 = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
|
this.rgb = OpenLayers.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 = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
|
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
|
||||||
},
|
},
|
||||||
|
|
||||||
blend: function(other) {
|
blend: function(other) {
|
||||||
@@ -80,7 +80,7 @@ Rico.Color.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
asHSB: function() {
|
asHSB: function() {
|
||||||
return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
|
return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
|
||||||
},
|
},
|
||||||
|
|
||||||
toString: function() {
|
toString: function() {
|
||||||
@@ -89,7 +89,7 @@ Rico.Color.prototype = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Rico.Color.createFromHex = function(hexCode) {
|
OpenLayers.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 Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
|
return new OpenLayers.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.
|
||||||
*/
|
*/
|
||||||
Rico.Color.createColorFromBackground = function(elem) {
|
OpenLayers.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 Rico.Color.createColorFromBackground(elem.parentNode);
|
return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode);
|
||||||
|
|
||||||
if ( actualColor == null )
|
if ( actualColor == null )
|
||||||
return new Rico.Color(255,255,255);
|
return new OpenLayers.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 Rico.Color( parseInt( colorArray[0] ),
|
return new OpenLayers.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 Rico.Color.createFromHex(actualColor);
|
return OpenLayers.Rico.Color.createFromHex(actualColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return new Rico.Color(255,255,255);
|
return new OpenLayers.Rico.Color(255,255,255);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
|
OpenLayers.Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
|
||||||
|
|
||||||
var red = 0;
|
var red = 0;
|
||||||
var green = 0;
|
var green = 0;
|
||||||
@@ -188,7 +188,7 @@ 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) };
|
||||||
}
|
}
|
||||||
|
|
||||||
Rico.Color.RGBtoHSB = function(r, g, b) {
|
OpenLayers.Rico.Color.RGBtoHSB = function(r, g, b) {
|
||||||
|
|
||||||
var hue;
|
var hue;
|
||||||
var saturation;
|
var saturation;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
var Rico = new Object();
|
OpenLayers.Rico = new Object();
|
||||||
Rico.Corner = {
|
OpenLayers.Rico.Corner = {
|
||||||
|
|
||||||
round: function(e, options) {
|
round: function(e, options) {
|
||||||
var e = $(e);
|
var e = $(e);
|
||||||
@@ -305,8 +305,8 @@ 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 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; },
|
_blend: function(c1, c2) { var cc1 = OpenLayers.Rico.Color.createFromHex(c1); cc1.blend(OpenLayers.Rico.Color.createFromHex(c2)); return cc1; },
|
||||||
_background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
|
_background: function(el) { try { return OpenLayers.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"); },
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
This license applies to official code releases at www.openlayers.org:
|
||||||
|
|
||||||
Copyright (c) 2005-2006 MetaCarta, Inc.
|
Copyright (c) 2005-2006 MetaCarta, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
35
repository-license.txt
Normal file
35
repository-license.txt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
This license applies to all code and content in the OpenLayers code
|
||||||
|
repository at svn.openlayers.org:
|
||||||
|
|
||||||
|
Copyright (c) 2005-2006 MetaCarta, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of MetaCarta, Inc. nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
This license grants no rights to any components related to natural language
|
||||||
|
processing, free text querying, or unstructured information retrieval. This
|
||||||
|
license grants no rights to components that implement inventions on which
|
||||||
|
MetaCarta has patents or has filed applications for patents.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
<li>test_Events.html</li>
|
<li>test_Events.html</li>
|
||||||
<li>test_Util.html</li>
|
<li>test_Util.html</li>
|
||||||
<li>test_Layer.html</li>
|
<li>test_Layer.html</li>
|
||||||
|
<li>test_Layer_Image.html</li>
|
||||||
<li>test_Layer_EventPane.html</li>
|
<li>test_Layer_EventPane.html</li>
|
||||||
<li>test_Layer_FixedZoomLevels.html</li>
|
<li>test_Layer_FixedZoomLevels.html</li>
|
||||||
<li>test_Layer_HTTPRequest.html</li>
|
<li>test_Layer_HTTPRequest.html</li>
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
<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>
|
||||||
|
|||||||
@@ -24,16 +24,14 @@
|
|||||||
t.eq( cloned.url, "b", "cloned.url does change when edited" );
|
t.eq( cloned.url, "b", "cloned.url does change when edited" );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_02_Marker_setOpacity(t) {
|
function test_03_Marker_setOpacity(t) {
|
||||||
t.plan( 2 );
|
t.plan( 2 );
|
||||||
|
|
||||||
icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6));
|
icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6));
|
||||||
|
|
||||||
t.ok(!icon.imageDiv.style.opacity, "default icon has no opacity");
|
t.ok(!icon.imageDiv.style.opacity, "default icon has no opacity");
|
||||||
|
|
||||||
icon.setOpacity(0.5);
|
icon.setOpacity(0.5);
|
||||||
|
t.eq(parseFloat(icon.imageDiv.style.opacity), 0.5, "icon.setOpacity() works");
|
||||||
t.eq(icon.imageDiv.style.opacity + "", "0.5", "icon.setOpacity() works");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -->
|
// -->
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript"><!--
|
<script type="text/javascript"><!--
|
||||||
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
||||||
|
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
|
||||||
var layer;
|
var layer;
|
||||||
|
|
||||||
function test_01_Layer_EventPane_constructor (t) {
|
function test_01_Layer_EventPane_constructor (t) {
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
// MOUSEMOVE test does not seem to work...
|
// MOUSEMOVE test does not seem to work...
|
||||||
// t.plan( 2 );
|
// t.plan( 2 );
|
||||||
|
|
||||||
if (document.createEventObject) {
|
if (!isMozilla || isOpera) {
|
||||||
t.plan(4);
|
t.plan(4);
|
||||||
} else {
|
} else {
|
||||||
t.plan(3);
|
t.plan(3);
|
||||||
@@ -108,6 +109,6 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map"></div>
|
<div id="map" style="height:500px;width:500px"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -89,56 +89,64 @@
|
|||||||
tParams = { layers: 'basic',
|
tParams = { layers: 'basic',
|
||||||
format: 'image/png'};
|
format: 'image/png'};
|
||||||
|
|
||||||
t.plan( 8 );
|
t.plan( 9 );
|
||||||
|
|
||||||
// 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, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url sans ?");
|
t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "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, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url with ?");
|
t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "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, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=basic&format=image/png", "getFullRequestString() works for url with ?param1=5");
|
t.eq(str, tUrl + '&' + OpenLayers.Util.getParameterString(tParams), "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, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=basic&format=image/png", "getFullRequestString() works for url with ?param1=5&");
|
t.eq(str, tUrl + OpenLayers.Util.getParameterString(tParams), "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, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&layers=road&format=image/png&chicken=6", "getFullRequestString() works for passing in new params");
|
t.eq(str, tUrl + OpenLayers.Util.getParameterString({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, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&", "getFullRequestString() works for layer with null params");
|
t.eq(str, tUrl + OpenLayers.Util.getParameterString({}), "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, "http://octo.metacarta.com/cgi-bin/mapserv?param1=5&chicken=6&layers=road", "getFullRequestString() works for layer with null params passing in new params");
|
t.eq(str, tUrl + OpenLayers.Util.getParameterString({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, "http://octo.metacarta.com/cgi-bin/mapserv?layers=basic&format=image/png", "getFullRequestString() works for url sans ?");
|
t.eq(str, tUrl + '?' + OpenLayers.Util.getParameterString(tParams), "getFullRequestString() works for url sans ?");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
96
tests/test_Layer_Image.html
Normal file
96
tests/test_Layer_Image.html
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
var layer;
|
||||||
|
|
||||||
|
function test_01_Layer_Image_constructor (t) {
|
||||||
|
t.plan( 13 );
|
||||||
|
|
||||||
|
var options = { chicken: 151, foo: "bar", projection: "none" };
|
||||||
|
var layer = new OpenLayers.Layer.Image('Test Layer',
|
||||||
|
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
|
||||||
|
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
||||||
|
new OpenLayers.Size(580, 288), options);
|
||||||
|
|
||||||
|
t.ok( layer instanceof OpenLayers.Layer.Image, "new OpenLayers.Layer.Image returns object" );
|
||||||
|
t.eq( layer.CLASS_NAME, "OpenLayers.Layer.Image", "CLASS_NAME variable set correctly");
|
||||||
|
|
||||||
|
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||||
|
t.ok( layer.id != null, "Layer is given an id");
|
||||||
|
t.ok( layer.projection, "none", "default layer projection correctly set");
|
||||||
|
t.ok( ((layer.chicken == 151) && (layer.foo == "bar")), "layer.options correctly set to Layer Object" );
|
||||||
|
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly backed up" );
|
||||||
|
|
||||||
|
options.chicken = 552;
|
||||||
|
|
||||||
|
t.eq( layer.options["chicken"], 151 , "layer.options correctly made fresh copy" );
|
||||||
|
|
||||||
|
t.eq( layer.isBaseLayer, true, "Default img layer is base layer" );
|
||||||
|
|
||||||
|
layer = new OpenLayers.Layer.Image('Test Layer',
|
||||||
|
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
|
||||||
|
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
||||||
|
new OpenLayers.Size(580, 288));
|
||||||
|
t.ok( layer instanceof OpenLayers.Layer.Image, "new OpenLayers.Layer.Image returns object" );
|
||||||
|
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||||
|
t.ok( layer.projection == null, "default layer projection correctly set");
|
||||||
|
t.ok( layer.options instanceof Object, "layer.options correctly initialized as a non-null Object" );
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_50_Layer_Image_tileTests (t) {
|
||||||
|
t.plan(4);
|
||||||
|
var map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
|
layer = new OpenLayers.Layer.Image('Test Layer',
|
||||||
|
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
|
||||||
|
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
||||||
|
new OpenLayers.Size(580, 288));
|
||||||
|
|
||||||
|
map.addLayer(layer);
|
||||||
|
map.zoomToMaxExtent();
|
||||||
|
t.eq(layer.tile.position.x,-40, "Tile x positioned correctly at maxextent");
|
||||||
|
t.eq(layer.tile.position.y,107, "Tile y positioned correctly at maxextent");
|
||||||
|
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
||||||
|
map.zoomIn();
|
||||||
|
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
||||||
|
}
|
||||||
|
/******
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* HERE IS WHERE SOME TESTS SHOULD BE PUT TO CHECK ON THE LONLAT-PX TRANSLATION
|
||||||
|
* FUNCTIONS AND RESOLUTION AND GETEXTENT GETZOOMLEVEL, ETC
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function test_99_Layer_Image_destroy (t) {
|
||||||
|
t.plan( 4 );
|
||||||
|
|
||||||
|
var map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
|
layer = new OpenLayers.Layer.Image('Test Layer',
|
||||||
|
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
|
||||||
|
new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
|
||||||
|
new OpenLayers.Size(580, 288));
|
||||||
|
|
||||||
|
map.addLayer(layer);
|
||||||
|
map.zoomToMaxExtent();
|
||||||
|
|
||||||
|
layer.destroy();
|
||||||
|
|
||||||
|
t.eq( layer.name, null, "layer.name is null after destroy" );
|
||||||
|
t.eq( layer.div, null, "layer.div is null after destroy" );
|
||||||
|
t.eq( layer.map, null, "layer.map is null after destroy" );
|
||||||
|
t.eq( layer.options, null, "layer.options is null after destroy" );
|
||||||
|
|
||||||
|
}
|
||||||
|
// -->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="map" style="width:500px;height:500px"></div>
|
||||||
|
<div id="map2" style="width:100px;height:100px"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
164
tests/test_Layer_TMS.html
Normal file
164
tests/test_Layer_TMS.html
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
<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>
|
||||||
@@ -38,8 +38,18 @@
|
|||||||
tile.draw();
|
tile.draw();
|
||||||
|
|
||||||
var img = tile.imgDiv;
|
var img = tile.imgDiv;
|
||||||
|
var tParams = OpenLayers.Util.extend({},
|
||||||
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" );
|
OpenLayers.Util.upperCaseObject(params));
|
||||||
|
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" );
|
||||||
|
|
||||||
@@ -48,7 +58,9 @@
|
|||||||
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, "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" );
|
t.eq( firstChild.src,
|
||||||
|
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." );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +142,6 @@
|
|||||||
|
|
||||||
|
|
||||||
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";
|
||||||
@@ -139,11 +150,21 @@
|
|||||||
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();
|
||||||
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");
|
var tParams = {
|
||||||
|
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();
|
||||||
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'");
|
delete tParams['SRS'];
|
||||||
|
t.eq(str,
|
||||||
|
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
|
||||||
|
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,14 +181,14 @@
|
|||||||
map.addLayer(tLayer);
|
map.addLayer(tLayer);
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||||
t.eq(tLayer.div.firstChild.style.opacity, "0.5", "Opacity on tile is correct");
|
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||||
tLayer.setOpacity("0.6");
|
tLayer.setOpacity("0.6");
|
||||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||||
t.eq(tLayer.div.firstChild.style.opacity, "0.6", "Opacity on tile is changed correctly");
|
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||||
var pixel = new OpenLayers.Pixel(5,6);
|
var pixel = new OpenLayers.Pixel(5,6);
|
||||||
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||||
tile.draw();
|
tile.draw();
|
||||||
t.eq(tile.imgDiv.style.opacity, "0.6", "Tile opacity is set correctly");
|
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_02_Marker_setOpacity(t) {
|
function test_03_Marker_setOpacity(t) {
|
||||||
t.plan( 2 );
|
t.plan( 2 );
|
||||||
|
|
||||||
var map = new OpenLayers.Map("map");
|
var map = new OpenLayers.Map("map");
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
marker.setOpacity(0.5);
|
marker.setOpacity(0.5);
|
||||||
|
|
||||||
t.eq(marker.icon.imageDiv.style.opacity + "", "0.5", "marker.setOpacity() works");
|
t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -->
|
// -->
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
function test_03_Popup_draw(t) {
|
function test_03_Popup_draw(t) {
|
||||||
|
|
||||||
t.plan( 11 );
|
t.plan( 17 );
|
||||||
|
|
||||||
var id = "chicken";
|
var id = "chicken";
|
||||||
var x = 50;
|
var x = 50;
|
||||||
@@ -61,6 +61,7 @@
|
|||||||
var h = 400;
|
var h = 400;
|
||||||
var content = "charlie";
|
var content = "charlie";
|
||||||
var color = "red";
|
var color = "red";
|
||||||
|
var hexColor = "#ff0000";
|
||||||
var opacity = 0.5;
|
var opacity = 0.5;
|
||||||
var border = "1px solid";
|
var border = "1px solid";
|
||||||
|
|
||||||
@@ -78,8 +79,20 @@
|
|||||||
t.eq(popup.div.style.top, y + "px", "top position of popup.div set correctly");
|
t.eq(popup.div.style.top, y + "px", "top position of popup.div set correctly");
|
||||||
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
|
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
|
||||||
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
|
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
|
||||||
t.eq(popup.div.innerHTML, '<div class="olPopupContent" style="overflow: hidden; width: 200px; height: 200px; position: relative;" id="chicken_contentDiv">charlie</div>', "good default popup.contentHTML");
|
|
||||||
t.eq(popup.div.style.backgroundColor, color, "good default popup.backgroundColor");
|
var contentDiv = popup.div.childNodes[0];
|
||||||
|
|
||||||
|
t.eq(contentDiv.className, "olPopupContent", "correct content div className");
|
||||||
|
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
|
||||||
|
t.eq(contentDiv.style.width, "500px", "correct content div width");
|
||||||
|
t.eq(contentDiv.style.height, "400px", "correct content div height");
|
||||||
|
t.eq(contentDiv.style.position, "relative", "correct content div position");
|
||||||
|
t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow");
|
||||||
|
t.eq(contentDiv.innerHTML, content, "correct content div content");
|
||||||
|
|
||||||
|
var bColor = popup.div.style.backgroundColor;
|
||||||
|
var goodColor = ( (bColor == color) || (bColor == hexColor));
|
||||||
|
t.ok(goodColor, "good default popup.backgroundColor");
|
||||||
|
|
||||||
if (navigator.appName.indexOf("Microsoft") == -1) {
|
if (navigator.appName.indexOf("Microsoft") == -1) {
|
||||||
t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");
|
t.eq(parseFloat(popup.div.style.opacity), opacity, "good default popup.opacity");
|
||||||
|
|||||||
@@ -48,7 +48,16 @@
|
|||||||
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");
|
||||||
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");
|
var tParams = {
|
||||||
|
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" );
|
||||||
}
|
}
|
||||||
@@ -64,42 +73,78 @@
|
|||||||
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.src, "", "Images against side of maxextent don't load");
|
t.eq(tile.imgDiv, null, "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()
|
||||||
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");
|
var tParams = {
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-90,-180,90"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"});
|
||||||
|
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()
|
||||||
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");
|
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"});
|
||||||
|
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(3);
|
t.plan(2);
|
||||||
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";
|
||||||
@@ -112,22 +157,21 @@
|
|||||||
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.style.display, 'none', "Tile display is set to none.") } );
|
t.delay_call( 1, function() { t.eq(tile.imgDiv, null, "Tile imgDiv is null.") } );
|
||||||
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.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, null, "Alpha tile imgDiv is null.") } );
|
||||||
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.display, 'none', "Alpha tile display is set to none.") } );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map"></div>
|
<div id="map" style="height:500px;width:500px"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -67,12 +67,15 @@
|
|||||||
t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");
|
t.eq( div.style.width, sz.w + "px", "div.style.width set correctly");
|
||||||
t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");
|
t.eq( div.style.height, sz.h + "px", "div.style.height set correctly");
|
||||||
|
|
||||||
t.eq( div.style.backgroundImage, "url(" + img + ")", "div.style.backgroundImage correctly");
|
bImg = div.style.backgroundImage;
|
||||||
|
imgCorrect = ( (bImg == "url(" + img + ")") ||
|
||||||
|
(bImg == "url(\"" + img + "\")") );
|
||||||
|
t.ok(imgCorrect, "div.style.backgroundImage correctly");
|
||||||
|
|
||||||
t.eq( div.style.position, position, "div.style.positionset correctly");
|
t.eq( div.style.position, position, "div.style.positionset correctly");
|
||||||
t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");
|
t.ok( (div.style.border.indexOf(border) != -1), "div.style.border set correctly");
|
||||||
t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");
|
t.eq( div.style.overflow, overflow, "div.style.overflow set correctly");
|
||||||
t.eq( div.style.opacity + "", opacity + "", "elemnt.style.opacity set correctly");
|
t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly");
|
||||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||||
t.eq( div.style.filter, filterString, "element.style.filter set correctly");
|
t.eq( div.style.filter, filterString, "element.style.filter set correctly");
|
||||||
|
|
||||||
@@ -95,7 +98,7 @@
|
|||||||
t.eq( div.style.position, "absolute", "div.style.positionset correctly");
|
t.eq( div.style.position, "absolute", "div.style.positionset correctly");
|
||||||
t.eq( div.style.border, "", "div.style.border set correctly");
|
t.eq( div.style.border, "", "div.style.border set correctly");
|
||||||
t.eq(div.style.overflow, "", "div.style.overflow set correctly");
|
t.eq(div.style.overflow, "", "div.style.overflow set correctly");
|
||||||
t.ok( !div.style.opacity, "elemnt.style.opacity set correctly");
|
t.ok( !div.style.opacity, "element.style.opacity set correctly");
|
||||||
t.ok( !div.style.filter, "element.style.filter set correctly");
|
t.ok( !div.style.filter, "element.style.filter set correctly");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -116,7 +119,7 @@
|
|||||||
if (!isMozilla)
|
if (!isMozilla)
|
||||||
t.ok( true, "skipping element test outside of Mozilla");
|
t.ok( true, "skipping element test outside of Mozilla");
|
||||||
else
|
else
|
||||||
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
|
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
|
||||||
t.eq( image.id, id, "image.id set correctly");
|
t.eq( image.id, id, "image.id set correctly");
|
||||||
t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");
|
t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");
|
||||||
t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");
|
t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");
|
||||||
@@ -127,7 +130,7 @@
|
|||||||
t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");
|
t.ok( (image.style.border.indexOf(border) != -1), "image.style.border set correctly");
|
||||||
t.eq( image.src, img, "image.style.backgroundImage correctly");
|
t.eq( image.src, img, "image.style.backgroundImage correctly");
|
||||||
t.eq( image.style.position, position, "image.style.position set correctly");
|
t.eq( image.style.position, position, "image.style.position set correctly");
|
||||||
t.eq( image.style.opacity+"", opacity + "", "image.style.opacity set correctly");
|
t.eq( parseFloat(image.style.opacity), opacity, "image.style.opacity set correctly");
|
||||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||||
t.eq( image.style.filter, filterString, "element.style.filter set correctly");
|
t.eq( image.style.filter, filterString, "element.style.filter set correctly");
|
||||||
|
|
||||||
@@ -137,7 +140,7 @@
|
|||||||
if (!isMozilla)
|
if (!isMozilla)
|
||||||
t.ok( true, "skipping element test outside of Mozilla");
|
t.ok( true, "skipping element test outside of Mozilla");
|
||||||
else
|
else
|
||||||
t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
|
t.ok( image.nodeName == "IMG", "createDiv creates a valid HTMLDivElement" );
|
||||||
t.ok( (image.id != ""), "image.id set to something");
|
t.ok( (image.id != ""), "image.id set to something");
|
||||||
t.eq( image.style.left, "", "image.style.left set correctly");
|
t.eq( image.style.left, "", "image.style.left set correctly");
|
||||||
t.eq( image.style.top, "", "image.style.top set correctly");
|
t.eq( image.style.top, "", "image.style.top set correctly");
|
||||||
@@ -148,7 +151,7 @@
|
|||||||
t.ok((image.style.border == ""), "image.style.border set correctly");
|
t.ok((image.style.border == ""), "image.style.border set correctly");
|
||||||
t.eq(image.src, "", "image.style.backgroundImage correctly");
|
t.eq(image.src, "", "image.style.backgroundImage correctly");
|
||||||
t.eq( image.style.position, "relative", "image.style.positionset correctly");
|
t.eq( image.style.position, "relative", "image.style.positionset correctly");
|
||||||
t.ok( !image.style.opacity, "elemnt.style.opacity default unset");
|
t.ok( !image.style.opacity, "element.style.opacity default unset");
|
||||||
t.ok( !image.style.filter, "element.style.filter default unset");
|
t.ok( !image.style.filter, "element.style.filter default unset");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -174,13 +177,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_07_Util_getParameterString(t) {
|
function test_07_Util_getParameterString(t) {
|
||||||
t.plan( 1 );
|
t.plan( 2 );
|
||||||
|
|
||||||
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) {
|
||||||
@@ -210,7 +214,7 @@
|
|||||||
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
||||||
|
|
||||||
t.eq( imageDiv.style.position, position, "image.style.positionset correctly");
|
t.eq( imageDiv.style.position, position, "image.style.positionset correctly");
|
||||||
t.eq( imageDiv.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
|
t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");
|
||||||
|
|
||||||
var filterString;
|
var filterString;
|
||||||
if (OpenLayers.Util.alphaHack()) {
|
if (OpenLayers.Util.alphaHack()) {
|
||||||
@@ -222,11 +226,10 @@
|
|||||||
|
|
||||||
|
|
||||||
image = imageDiv.firstChild;
|
image = imageDiv.firstChild;
|
||||||
|
|
||||||
if (!isMozilla)
|
if (!isMozilla)
|
||||||
t.ok( true, "skipping element test outside of Mozilla");
|
t.ok( true, "skipping element test outside of Mozilla");
|
||||||
else
|
else
|
||||||
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
|
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
|
||||||
t.eq( image.id, id + "_innerImage", "image.id set correctly");
|
t.eq( image.id, id + "_innerImage", "image.id set correctly");
|
||||||
|
|
||||||
t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");
|
t.eq( image.style.width, sz.w + "px", "image.style.width set correctly");
|
||||||
@@ -292,7 +295,7 @@
|
|||||||
t.eq( element.style.position, position, "element.style.position set correctly");
|
t.eq( element.style.position, position, "element.style.position set correctly");
|
||||||
t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");
|
t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");
|
||||||
t.eq( element.style.overflow, overflow, "element.style.overflow set correctly");
|
t.eq( element.style.overflow, overflow, "element.style.overflow set correctly");
|
||||||
t.eq( element.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
|
t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly");
|
||||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||||
t.eq( element.style.filter, filterString, "element.style.filter set correctly");
|
t.eq( element.style.filter, filterString, "element.style.filter set correctly");
|
||||||
}
|
}
|
||||||
@@ -312,11 +315,10 @@
|
|||||||
var opacity = 0.5;
|
var opacity = 0.5;
|
||||||
|
|
||||||
OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
|
OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
|
||||||
|
|
||||||
if (OpenLayers.Util.alphaHack())
|
if (OpenLayers.Util.alphaHack())
|
||||||
t.ok( true, "skipping element test outside of Mozilla");
|
t.ok( true, "skipping element test outside of Mozilla");
|
||||||
else
|
else
|
||||||
t.ok( imageDiv instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
|
t.ok( imageDiv.nodeName == "DIV", "createDiv creates a valid HTMLDivElement" );
|
||||||
|
|
||||||
t.eq( imageDiv.id, id, "image.id set correctly");
|
t.eq( imageDiv.id, id, "image.id set correctly");
|
||||||
t.eq( imageDiv.style.left, xy.x + "px", "image.style.left set correctly");
|
t.eq( imageDiv.style.left, xy.x + "px", "image.style.left set correctly");
|
||||||
@@ -326,7 +328,7 @@
|
|||||||
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
t.eq( imageDiv.style.height, sz.h + "px", "image.style.height set correctly");
|
||||||
|
|
||||||
t.eq( imageDiv.style.position, position, "image.style.position set correctly");
|
t.eq( imageDiv.style.position, position, "image.style.position set correctly");
|
||||||
t.eq( imageDiv.style.opacity+"", opacity + "", "elemnt.style.opacity set correctly");
|
t.eq( parseFloat(imageDiv.style.opacity), opacity, "element.style.opacity set correctly");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -338,7 +340,7 @@
|
|||||||
t.ok( true, "skipping element test outside of Mozilla");
|
t.ok( true, "skipping element test outside of Mozilla");
|
||||||
} else {
|
} else {
|
||||||
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
var filterString = 'alpha(opacity=' + (opacity * 100) + ')';
|
||||||
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
|
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
|
||||||
}
|
}
|
||||||
t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
|
t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
|
||||||
t.eq( image.id, id + "_innerImage", "image.id set correctly");
|
t.eq( image.id, id + "_innerImage", "image.id set correctly");
|
||||||
@@ -489,7 +491,71 @@
|
|||||||
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, options), "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?bar=now#go";
|
||||||
|
url2 = "../tests/../tests/foo.html?bar=now#go";
|
||||||
|
|
||||||
|
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ div.olControlMousePosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.olControlOverviewMapExtentRectangle {
|
.olControlOverviewMapExtentRectangle {
|
||||||
|
cursor: move;
|
||||||
border: 2px dotted red;
|
border: 2px dotted red;
|
||||||
}
|
}
|
||||||
.olLayerGeoRSSDescription {
|
.olLayerGeoRSSDescription {
|
||||||
|
|||||||
302
tools/jsmin.py
302
tools/jsmin.py
@@ -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)
|
||||||
|
|||||||
@@ -127,42 +127,25 @@ 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:]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def run (sourceDirectory, outputFilename = None, configFile = None):
|
||||||
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 options and options[0][0] == "-c":
|
if configFile:
|
||||||
filename = options[0][1]
|
cfg = Config(configFile)
|
||||||
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"
|
||||||
@@ -175,7 +158,7 @@ if __name__ == "__main__":
|
|||||||
## 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?
|
||||||
|
|
||||||
@@ -227,6 +210,30 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
print "\nTotal files merged: %d " % len(allFiles)
|
print "\nTotal files merged: %d " % len(allFiles)
|
||||||
|
|
||||||
print "\nGenerating: %s" % (outputFilename)
|
if outputFilename:
|
||||||
|
print "\nGenerating: %s" % (outputFilename)
|
||||||
|
open(outputFilename, "w").write("".join(result))
|
||||||
|
return "".join(result)
|
||||||
|
|
||||||
open(outputFilename, "w").write("".join(result))
|
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
|
||||||
|
|
||||||
|
configFile = None
|
||||||
|
if options and options[0][0] == "-c":
|
||||||
|
configFile = options[0][1]
|
||||||
|
print "Parsing configuration file: %s" % filename
|
||||||
|
|
||||||
|
run( sourceDirectory, outputFilename, configFile )
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ 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
|
||||||
cp OpenLayers-$VERSION.tar.gz /www/openlayers/htdocs/download/
|
zip -9r OpenLayers-$VERSION.zip OpenLayers-$VERSION
|
||||||
|
cp OpenLayers-$VERSION.{tar.gz,zip} /www/openlayers/htdocs/download/
|
||||||
|
|||||||
Reference in New Issue
Block a user