Compare commits

...

59 Commits

Author SHA1 Message Date
crschmidt
2f6da6cab1 Tagging 2.0-rc2.
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.0-rc2@1335 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 19:48:21 +00:00
crschmidt
2ed1ce98b3 Add news.txt to store release notes, which will contain information about
API changes. Mention news.txt and doc/ files in readme.txt.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1334 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 19:45:28 +00:00
crschmidt
9f0b0e0ed7 A number of tests were not working as expected in IE. Specifically:
* Layer-KaMap, Grid, and Map were all having commented out tests run by 
   Test.AnotherWay.
 * Layer.html was adding an additional , after a list in an object creation,
   which IE doesn't allow.
 * When setting the href="" of an <a> element, IE does not then return 
   the concatanation of the location+href via the DOM. 
 * EventPane has mouse handling tests which work in IE, but not in FF.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1333 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 18:56:12 +00:00
crschmidt
f6a50a37fc IE will not catch events on a div which has no content in it. (Why? Who
knows!) However, if we set a background on the div, it works -- but not
if that background is transparent. It has to have some thing. So, if 
we're in IE, we use our handy dandy notebook!, er, blank.gif, to populate
a background so that the EventPane will work. 

If someone can fix this, please do.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1332 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 18:37:05 +00:00
crschmidt
deaebf8733 IE treats non-assigned zIndex values as 0. children of an element with a
zIndex set to 0 will always be below children of an element with a zIndex
set to 100. Because VirtualEarth sits outside the ContainerDiv, its maps were
always showing up over things contained inside the container div, such as 
markers. Acceptance test for this is to visit ./examples/ve.html and see if
the marker displays (should be over barcelona). IE, Firefox and Safari now
pass this acceptance test.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1331 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 17:33:12 +00:00
crschmidt
a6ff5584ad In order to set the status of an element before it's added ot the DOM in IE,
you have to use "defaultChecked" rather than "checked". So, we'll set both --
one for IE, one for Firefox -- and call it done.

I want the last three days of my life back.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1330 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 14:23:23 +00:00
crschmidt
402021f24f If a mouseup is not preceeded by a mousedown *inside the layerswitcher*,
then the mouseup should be allowed to drop through to the map, since it
may have started as part of a drag action.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1329 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 13:09:53 +00:00
crschmidt
abfbe30b2b FireFox apparently doesn't return any text with node.text, but it doesn't
throw an exception either. This change makes the WFS example work in 
FF -- I'll have to check the effect it has on IE. 


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1328 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 11:42:25 +00:00
crschmidt
a98ee2580d WFS Feature wasn't properly processing nodes. Let's see if this helps at all.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1327 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 11:33:45 +00:00
crschmidt
426e1cf2f9 WFS was not requesting correct URL.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1326 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 11:16:13 +00:00
euzuro
e31c7aaf0b redefining isBaseLayer is not necessary -- it inherits from OpenLayers.Layer.Markers
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1325 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 00:25:17 +00:00
euzuro
6e9ba61679 make an accessor for setting isBaseLayer, because we need to trigger the 'changelayer' (assuming our layer has already been added to a map)
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1324 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-22 00:23:43 +00:00
euzuro
6ddeb07e90 fix for #197
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1323 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 23:04:40 +00:00
crschmidt
2408752e27 Mention GeoRSS version support.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1322 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 20:22:35 +00:00
crschmidt
39536e788a If Google fails to load before OpenLayers, occasionally dragging is not
possible with Google, because GMap2 would be undefined when the Google
class is included. So, we put this in a wrapper function, and call it
when you init the layer instead.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1321 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 19:34:15 +00:00
crschmidt
e2378ad68a Sometimes we call moveTo on a tile before we've actually created an image,
in which case clearing the image caused an error.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1320 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 19:20:52 +00:00
crschmidt
44819f20e8 unregister allows you to specify a function. remove does not.
I can't believe no one caught this before... (Fixes #192.)


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1319 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 19:18:47 +00:00
crschmidt
6a2fa9aaf1 Buffer set to 1 on WFS layer, since we don't have as much cause to prevent swapping.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1318 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 17:17:04 +00:00
crschmidt
ea9a6a6a23 Typo in change created around r1200 broke WFS.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1317 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-21 16:03:52 +00:00
crschmidt
4847d66d6a Post-drag 'click' events aren't really clicks. Don't let them fall through to
the map.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1316 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 15:57:14 +00:00
crschmidt
c4541115f9 Stop click events from falling through to the map.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1315 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 15:03:45 +00:00
crschmidt
d500981f09 Let's trap all these events. Tested by bitner on IRC in IE (thanks!) and works
in FF on Mac. Hopefully this works! this is my major blocker for RC2, a 
few more minor changes and i'll kick it out.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1314 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 15:01:58 +00:00
crschmidt
8e51ada8de Add example for setting an extent with visual annotation via Boxes layer.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1313 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 14:05:39 +00:00
crschmidt
633e31da36 Further documentation on the special casing Layer.WMS does.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1312 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 13:59:39 +00:00
euzuro
c1779d1520 update example for r1310
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1311 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 06:13:28 +00:00
euzuro
29d6d8f017 allow 'auto' for minResolution if minExtent is set
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1310 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 06:13:09 +00:00
euzuro
f56dab0644 just like r1308, we update virtual earth to use min/max zoomlevel, and update the example
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1309 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 05:37:07 +00:00
euzuro
2ec05163ed allow google layer to be configured with min/max zoomLevels. update example.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1308 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 05:23:45 +00:00
euzuro
1e8c8e8404 update to example.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1307 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 05:18:24 +00:00
euzuro
cd21f42dab put zoombar slider at the correct zoom level on first draw (not just always at the end)
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1306 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 05:00:54 +00:00
euzuro
1459ac5de9 real fix for #189 -- event wasnt being triggered, and wihtout the clone(), control was floating down the div
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1305 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 04:47:12 +00:00
euzuro
484fc207cf fix for #180 -- check zoomlevel bounds before calling setCenter()
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1304 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 03:53:50 +00:00
euzuro
cfd7858861 remove extraneous comment
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1303 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 03:43:35 +00:00
euzuro
17581c714d Remove the concept of min/max zoom level from Map. Replace it with concept of num zoom levels. Bit of rearrangement in the initResolutions() function in HTTPRequest.js. Adapt all of OL to deal with numZoomLevels instead of min/max. Fix PanZoomBar so that it listens for change of baselayer and redraws itself. fix all tests so they pass. Add zoomLevels.html example for playing around with different methods of setting zoomlevels.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1302 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 02:09:29 +00:00
euzuro
1a12d90455 allow whirlwind to have options. otherwise no way to set tilesize
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1301 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 02:07:26 +00:00
crschmidt
7035551fcf Make OpenPlans TIGER WMS proxy not a base layer in this example, so you can see
it on top of nasa. But it is kind of ugly in that case ;)


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1300 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-19 01:45:47 +00:00
euzuro
b11580aca3 added problem/challenge text to test page
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1299 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-18 17:36:50 +00:00
euzuro
b8f4577a78 example to help fix #186
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1298 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-18 17:30:58 +00:00
euzuro
4df6b8aa2b rollback 1295 -- prematurely committed
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1296 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 20:27:41 +00:00
euzuro
d2601b3684 coding standards, adding jsdoc comments, small code reorganization in svn statavkn
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1295 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 20:22:47 +00:00
euzuro
1a0cbdfd25 add comment
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1294 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 19:34:10 +00:00
euzuro
9956bffe71 update parameter name for parallelism with the rest of the mergeNewParams() methods --- and for better readability
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1291 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 19:19:21 +00:00
euzuro
24047ee512 when merging new params to untitled layer, we need to uppercase them for case-insensitivity like in the regular wms.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1290 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 19:14:50 +00:00
euzuro
07d39aca00 removing alpha nuller from the destroy broke tests. sorry
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1289 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 19:12:52 +00:00
euzuro
7ae04f7423 the 'alpha' property belongs to Layer, and it's a boolean so no need to null it anyways
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1288 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 18:53:57 +00:00
euzuro
d8d2b225e4 remove unused getTile() method and related tests
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1287 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 18:17:48 +00:00
euzuro
5952a7e3af mark a few functions as private
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1286 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 18:15:29 +00:00
euzuro
8d1fe36b0f add comments for spiralTileLoad() function
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1285 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 17:43:27 +00:00
euzuro
fa3b3a3d0c move baselayer functions down and separated from private layer functions
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1284 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 17:36:17 +00:00
euzuro
36ec579e39 protect viewport-lonlat translation functions in the case no baselayer is defined
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1283 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 17:20:30 +00:00
euzuro
b1cfe16347 superfluous comment
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1282 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 16:41:17 +00:00
euzuro
9d3aea6a2f getResolution() is only to be called on a baselayer, so no need to ask the map to getExtent() -- we just ask ourselves
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1281 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 16:21:51 +00:00
euzuro
a90c976375 always get the resolution from the map -- this grid might not be the base layer
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1280 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 16:15:45 +00:00
euzuro
08981babaa use official map.getResolution() function here, do not bypass and go directly to baseLayer
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1279 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 16:13:55 +00:00
crschmidt
3623889f3a sbp points out that multiple perl calls are unneccesary. merging them all into one makes this code run about twice as fast.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1278 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 12:27:36 +00:00
crschmidt
1bb0952c68 We no longer define units/resolution on the kamap object.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1277 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 12:13:27 +00:00
crschmidt
d28f293cd9 changeParams changed to mergeNewParams in 2.0
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1276 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 12:13:03 +00:00
euzuro
5ffbe842c2 update map resize functionality to deal with google layer. if ve had a similar checkResize() function, then we would be able to safely resize an OL map with a ve layer in it as well. unfortunately, this is not the case. a bug report i am gonna file
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1275 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 05:52:07 +00:00
crschmidt
0da9f792c7 Branch OpenLayers for 2.0 release.
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1272 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-08-17 02:54:54 +00:00
41 changed files with 717 additions and 436 deletions

View File

@@ -2,9 +2,18 @@
rm ../doc/reference.html
CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MouseToolbar Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds"
echo "<html><head><title>OpenLayers Class Reference Documentation</title><style type='text/css'> .type { background-color: #ddd } td { border: black solid 1px; padding: 3px; } table { border-collapse: collapse; margin: 5px 10px; } .classref { margin-left: 20px; }
echo "<html>
<head>
<title>OpenLayers Class Reference Documentation</title>
<style type='text/css'>
.type { background-color: #ddd }
td { border: black solid 1px; padding: 3px; }
table { border-collapse: collapse; margin: 5px 10px; }
.classref { margin-left: 20px; }
div.index { float:left; width: 300px; }
</style></head><body>" >> ../doc/reference.html
</style>
</head>
<body>" >> ../doc/reference.html
for i in $CLASSES; do
echo "<div class='index'><a href='#OpenLayers.$i'>OpenLayers.$i</a></div>" >> ../doc/reference.html
@@ -14,16 +23,17 @@ echo "<br style='clear:both' />" >> ../doc/reference.html
for i in $CLASSES; do
cat ../doc/$i.txt | \
perl -pe 's!^(.*?) -- (.*?) -- (.*?)$! <tr><td>$1</td><td>$2</td><td>$3</td></tr>!g' | \
perl -pe 's!^( \* )?(.*?) -- (.*?)$! <tr><td>$2</td><td>$3</td></tr>!g' | \
perl -pe 's!^ \* (.*)$! </table>\n\n<h3>$1</h3>\n <table>!' | \
perl -pe 's!{OpenLayers.(.*?)\|(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">\2</a>!g' | \
perl -pe 's!{OpenLayers.(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">OpenLayers.$1</a>!' | \
perl -pe 's!{([A-Za-z]+?)\|(.+?)}!<span class="type" title="$1">\2<\/span>!g' | \
perl -pe 's!{([A-Za-z]+?)}!<span class="type" title="$1">$1<\/span>!g' | \
perl -pe 's!^\* (.*)$!</table>\n<h2>$1</h2>\n<table>!' | \
perl -pe 's!^OpenLayers\.(.*)$!<h1><a name="OpenLayers.$1">OpenLayers.$1</a></h1><div class="classref">!' \
perl -pe 's!^(.*?) -- (.*?) -- (.*?)$! <tr><td>$1</td><td>$2</td><td>$3</td></tr>!g;
s!^( \* )?(.*?) -- (.*?)$! <tr><td>$2</td><td>$3</td></tr>!g;
s!^ \* (.*)$! </table>\n\n<h3>$1</h3>\n <table>!;
s!{OpenLayers.(.*?)\|(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">\2</a>!g;
s!{OpenLayers.(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">OpenLayers.$1</a>!;
s!{([A-Za-z]+?)\|(.+?)}!<span class="type" title="$1">\2<\/span>!g;
s!{([A-Za-z]+?)}!<span class="type" title="$1">$1<\/span>!g;
s!^\* (.*)$!</table>\n<h2>$1</h2>\n<table>!;
s!^OpenLayers\.(.*)$!<h1><a name="OpenLayers.$1">OpenLayers.$1</a></h1><div class="classref">!' \
>> ../doc/reference.html
echo '</table></div>' >> ../doc/reference.html
done
echo "</body></html>" >> ../doc/reference.html
echo " </body>
</html>" >> ../doc/reference.html

View File

@@ -1,6 +1,7 @@
OpenLayers.Layer.GeoRSS
GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map.
GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map. The GeoRSS layer supports 1.0 and 2.0 in IE and Firefox, and supports 2.0 in Safari. (Ticket #111 explains the reason for this difference.)
* Constructor
OpenLayers.Layer.GeoRSS(name, url) -- Name and location of GeoRSS XML file.

View File

@@ -1,6 +1,8 @@
OpenLayers.Layer.WMS
The WMS layer allows one to connect to a WMS server to obtain images.
The WMS layer allows one to connect to a WMS server to obtain images. Params are available as a hash on the layer object, however, all keys are upper-cased automatically for maximum compatibility with WMS servers, so a parameter which is set as 'layers' will be uppercased to LAYERS. Where 'layer' is your Javscript variable for the layer, layer.params.LAYERS is the value of the layers param as set by the constructor.
If you wish to change params, you should use mergeNewParams, rather than accessing the parameters directly.
* Constructor
OpenLayers.Layer.WMS(name, url, params, options) -- URL is the base URL to the layer. Params is a set of params to be included in the HTTP Request. Options is a set of options, extending the parameters of the layer.
@@ -9,5 +11,5 @@ The WMS layer allows one to connect to a WMS server to obtain images.
getURL({OpenLayers.Bounds|bounds}) -- {String} -- Returns a WMS URL for the given bounds based on the properties of the layer.
All other methods are inherited from {OpenLayers.Layer.Grid}
* Parameters
* Options
isBaseLayer -- WMS layers default to being base layers unless one of their parameters is 'transparent':'true'.

View File

@@ -23,20 +23,23 @@
var map, layer;
function init(){
map = new OpenLayers.Map( $('map') );
map = new OpenLayers.Map( $('map') ,
{ controls: [new OpenLayers.Control.MouseDefaults()] });
var normal = new OpenLayers.Layer.Google( "Google" );
var normal = new OpenLayers.Layer.Google( "Google", // );
{ minZoomLevel: 3, maxZoomLevel: 8 });
var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP });
var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_MAP });
map.addLayers([normal, satellite, hybrid]);
map.addLayers([satellite, normal, hybrid]);
markers = new OpenLayers.Layer.Markers("markers");
map.addLayer(markers);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
map.addControl( new OpenLayers.Control.PanZoomBar() );
}

29
examples/setextent.html Normal file
View File

@@ -0,0 +1,29 @@
<html>
<head>
<title>Setting a visual Extent</title>
<script src="../lib/OpenLayers.js"></script>
</head>
<body>
<h1>Setting a Visual Extent</h1>
<p>
Because the ability to set the map to a given extent is limited by the
current resolutions available, zoomToExtent will not always set the map to
exactly the right extent. In order to visually annotate the actual extent,
this example, will use the Boxes layer to visually describe the desired
extent as well as setting the map extent.
</p>
<div style="width:100%; height:75%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var bounds = new OpenLayers.Bounds(-45,-45, 0, 45);
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(wms);
map.zoomToExtent(bounds);
var boxes = new OpenLayers.Layer.Boxes("boxes");
var box = new OpenLayers.Marker.Box(bounds);
boxes.addMarker(box);
map.addLayer(boxes);
</script>
</body>
</html>

90
examples/test.html Normal file
View File

@@ -0,0 +1,90 @@
<html>
<script src="../lib/Prototype.js"></script>
<script type="text/javascript">
var one, two, div, msg;
function init() {
one = $("one");
two = $("two");
div = $("div");
msg = $("msg");
Event.observe(div, "click", bar);
one.checked = true;
two.checked = false;
Event.observe(one, "change", oneClick);
Event.observe(two, "change", twoClick);
}
function bar(e) {
message("clicked div");
Event.stop(e);
var status = "one: ";
status += (one.checked) ? "checked" : "unchecked";
status += " two: ";
status += (two.checked) ? "checked" : "unchecked";
message(status);
}
function oneClick(e) {
message("clicked one");
}
function twoClick(e) {
message("clicked two");
}
function message(txt) {
msg.innerHTML += " ** " + txt;
}
</script>
<body onload="init()" onclick="message('clicked body')" onmouseup="message('<br>')">
<div> The idea here is to simulate the layerswitcher radiobuttons UI
without all the overhead of openlayers.
<br>
<br>
There are event handlers attached to the following elements:
<br>
* Body - Prints message "clicked body" to message area
<br>
* Blue Div - Prints message "clicked div" to message area, stops
the event propagation, prints a message with the
status of the two radiobuttons
<br>
* Radio One - Prints message "clicked one" to message area
<br>
* Radio Two - Prints message "clicked two" to message area
<br>
<br>
<b>
The problem, as you will see if you click the radio buttons
themselves, is that their "checked" status seems to update, but
their visual UI bit does not. Can we fix this!?!
</b>
</div>
<div id="div" style="background-color:blue; margin:50px">
<input id="one" type="radio" name="foo"/>
<span> one </span>
<br>
<input id="two" type="radio" name="foo"/>
<span> two </span>
</div>
<div id="msg" style="background-color:pink; margin-top:200px">
Events:
</div>
</body>
</html>

View File

@@ -14,11 +14,12 @@
var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/4, controls:[]});
var ka_wms = new OpenLayers.Layer.KaMap( "TIGER (KaMap)",
"http://boston.freemap.in/tile.php" , { map: 'tiger', layers: 'TIGER' }, 'degrees', 72 );
"http://boston.freemap.in/tile.php" , { map: 'tiger', layers: 'TIGER' });
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
{layers: "modis,global_mosaic"});
jpl_wms.setVisibility(false);
ka_wms.isBaseLayer = false;
map.addLayers([jpl_wms,ka_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MouseToolbar());

View File

@@ -11,15 +11,15 @@
<script type="text/javascript">
<!--
function init(){
var map = new OpenLayers.Map('map', {'maxResolution': 1.6, maxZoomLevel:20});
var mapOptions = { maxResolution: 1.6, numZoomLevels: 21};
var map = new OpenLayers.Map('map', mapOptions);
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var ww = new OpenLayers.Layer.WorldWind( "Urban",
"http://worldwind25.arc.nasa.gov/tile/tile.aspx?", .8, 9,
{T:"104"});
ww.setTileSize(new OpenLayers.Size(512,512));
{T:"104"}, { tileSize: new OpenLayers.Size(512,512) });
map.addLayers([ol_wms, ww]);

View File

@@ -18,20 +18,23 @@
var lon = 5;
var lat = 40;
var zoom = 5;
var zoom = 15;
var map, velayer, layer;
function init(){
map = new OpenLayers.Map( $('map') );
map = new OpenLayers.Map( $('map') ,
{controls:[new OpenLayers.Control.MouseDefaults()]});
velayer = new OpenLayers.Layer.VirtualEarth( "VE");
velayer = new OpenLayers.Layer.VirtualEarth( "VE",
{ minZoomLevel: 4, maxZoomLevel: 6 });
map.addLayer(velayer);
markers = new OpenLayers.Layer.Markers("markers");
map.addLayer(markers);
map.setCenter(new OpenLayers.LonLat(lon, lat), 2);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
map.addControl( new OpenLayers.Control.PanZoomBar() );
}
function add() {

View File

@@ -35,7 +35,7 @@ var map,ia_wms;
<body onload="init()">
<h1>OpenLayers Example</h1>
<p>WMS-T example: update the times, and the radar image will change. Uses Layer.changeParams. Thanks to David Bitner for the inspiration, the original code, and the kick in the butt!</p>
<input type='text' id='time' value="2005-08-29T13:00:00Z" onChange='ia_wms.changeParams({"time":this.value});' >
<input type='text' id='time' value="2005-08-29T13:00:00Z" onChange='ia_wms.mergeNewParams({"time":this.value});' >
<div id="map"></div>
</body>
</html>

54
examples/zoomLevels.html Normal file
View File

@@ -0,0 +1,54 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var lon = 50;
var lat = 0;
var zoom = 0;
var map, layer;
function init(){
var options = {
// resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101],
// scales: [50000000, 10000000],
// maxResolution: 0.17578125,
// minResolution: 0.0439453125,
// maxScale: 10000000,
// minScale: 50000000,
minResolution: "auto",
minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
maxResolution: "auto",
maxExtent: new OpenLayers.Bounds(-180, -90, 90, 180),
// numZoomLevels: 5,
controls: [new OpenLayers.Control.MouseDefaults()]
};
map = new OpenLayers.Map( $('map') , options);
map.addControl(new OpenLayers.Control.PanZoomBar());
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'});
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
// -->
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>

BIN
img/blank.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 B

View File

@@ -420,7 +420,7 @@ OpenLayers.Bounds.prototype = {
* @type OpenLayers.Bounds
*/
add:function(x, y){
return new OpenLayers.Box(this.left + x, this.bottom + y,
return new OpenLayers.Bounds(this.left + x, this.bottom + y,
this.right + x, this.top + y);
},

View File

@@ -119,16 +119,18 @@ OpenLayers.Control.LayerSwitcher.prototype =
inputElem.type = (baseLayer) ? "radio" : "checkbox";
inputElem.value = layer.name;
inputElem.checked = checked;
inputElem.defaultChecked = checked;
inputElem.layer = layer;
inputElem.control = this;
Event.observe(inputElem, "mouseup",
this.onInputClick.bindAsEventListener(inputElem));
// create span
var labelSpan = document.createElement("span");
labelSpan.innerHTML = layer.name;
labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "auto";
Event.observe(labelSpan,
"click",
this.onLabelClick.bindAsEventListener(inputElem));
Event.observe(labelSpan, "click",
this.onInputClick.bindAsEventListener(inputElem));
// create line break
var br = document.createElement("br");
@@ -158,11 +160,17 @@ OpenLayers.Control.LayerSwitcher.prototype =
*
* @param {Event} e
*/
onLabelClick: function(e) {
var clickedRadioButton = ((this.type == "radio") && (this.checked));
if (!clickedRadioButton) {
onInputClick: function(e) {
if (this.type == "radio") {
this.checked = true;
this.layer.map.setBaseLayer(this.layer, true);
this.layer.map.events.triggerEvent("changebaselayer");
} else {
this.checked = !this.checked;
this.control.updateMap();
}
Event.stop(e);
},
/** Need to update the map accordingly whenever user clicks in either of
@@ -189,7 +197,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
for(var i=0; i < this.baseLayerInputs.length; i++) {
var input = this.baseLayerInputs[i];
if (input.checked) {
this.map.setBaseLayer(input.layer, true);
this.map.setBaseLayer(input.layer, false);
}
}
@@ -271,6 +279,8 @@ OpenLayers.Control.LayerSwitcher.prototype =
Event.observe(this.div, "mouseup",
this.mouseUp.bindAsEventListener(this));
Event.observe(this.div, "click",
this.ignoreEvent);
Event.observe(this.div, "mousedown",
this.mouseDown.bindAsEventListener(this));
Event.observe(this.div, "dblclick", this.ignoreEvent);
@@ -301,8 +311,9 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.baseLayersDiv = document.createElement("div");
this.baseLayersDiv.style.paddingLeft = "10px";
Event.observe(this.baseLayersDiv, "click",
/*Event.observe(this.baseLayersDiv, "click",
this.onLayerClick.bindAsEventListener(this));
*/
this.layersDiv.appendChild(this.baseLayersDiv);
@@ -315,8 +326,9 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.dataLayersDiv = document.createElement("div");
this.dataLayersDiv.style.paddingLeft = "10px";
Event.observe(this.dataLayersDiv, "click",
/*Event.observe(this.dataLayersDiv, "click",
this.onLayerClick.bindAsEventListener(this));
*/
this.layersDiv.appendChild(this.dataLayersDiv);
this.div.appendChild(this.layersDiv);

View File

@@ -35,6 +35,7 @@ OpenLayers.Control.MouseToolbar.prototype =
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
this.buttons = new Object();
this.map.events.register( "click", this, this.defaultClick );
this.map.events.register( "dblclick", this, this.defaultDblClick );
this.map.events.register( "mousedown", this, this.defaultMouseDown );
this.map.events.register( "mouseup", this, this.defaultMouseUp );
@@ -69,6 +70,7 @@ OpenLayers.Control.MouseToolbar.prototype =
btn.events = new OpenLayers.Events(this, btn);
btn.events.register("mousedown", this, this.buttonClick);
btn.events.register("mouseup", this, Event.stop);
btn.events.register("click", this, Event.stop);
btn.action = id;
btn.title = title;
btn.alt = title;
@@ -144,6 +146,7 @@ OpenLayers.Control.MouseToolbar.prototype =
"absolute");
this.measureBox.style.width="4px";
this.measureBox.style.height="4px";
this.measureBox.style.fontSize = "1px";
this.measureBox.style.backgroundColor="red";
this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.layerContainerDiv.appendChild(this.measureBox);
@@ -266,6 +269,12 @@ OpenLayers.Control.MouseToolbar.prototype =
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
this.defaultMouseUp(evt);
}
},
defaultClick: function (evt) {
if (this.performedDrag) {
this.performedDrag = false;
return false;
}
}
});

View File

@@ -25,10 +25,24 @@ OpenLayers.Control.PanZoomBar.prototype =
OpenLayers.Control.PanZoom.prototype.initialize.apply(this, arguments);
this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X,
OpenLayers.Control.PanZoomBar.Y);
},
// put code here to catch "changebaselayer" event from map, because
// we are going to have to redraw this thing each time, because
// maxZoom will/might change.
/**
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
this.map.events.register("changebaselayer", this, this.redraw);
},
/** clear the div and start over.
*
*/
redraw: function() {
if (this.div != null) {
this.div.innerHTML = "";
}
this.draw();
},
/**
@@ -37,7 +51,7 @@ OpenLayers.Control.PanZoomBar.prototype =
draw: function(px) {
// initialize our internal div
OpenLayers.Control.prototype.draw.apply(this, arguments);
px = this.position;
px = this.position.clone();
// place the controls
this.buttons = new Array();
@@ -63,9 +77,9 @@ OpenLayers.Control.PanZoomBar.prototype =
var imgLocation = OpenLayers.Util.getImagesLocation();
var id = "OpenLayers_Control_PanZoomBar_Slider" + this.map.id;
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
var slider = OpenLayers.Util.createAlphaImageDiv(id,
centered.add(-1,
(this.map.getMaxZoomLevel())*this.zoomStopHeight),
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
new OpenLayers.Size(20,9),
imgLocation+"slider.png",
"absolute");
@@ -79,7 +93,7 @@ OpenLayers.Control.PanZoomBar.prototype =
this.sliderEvents.register("click", this, this.doubleClick);
sz = new OpenLayers.Size();
sz.h = this.zoomStopHeight*(this.map.getMaxZoomLevel()+1);
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();
sz.w = this.zoomStopWidth;
var div = null
@@ -115,7 +129,7 @@ OpenLayers.Control.PanZoomBar.prototype =
this.map.events.register("zoomend", this, this.moveZoomBar);
centered = centered.add(0,
this.zoomStopHeight*(this.map.getMaxZoomLevel()+1));
this.zoomStopHeight * this.map.getNumZoomLevels());
return centered;
},
/*
@@ -136,7 +150,7 @@ OpenLayers.Control.PanZoomBar.prototype =
var y = evt.xy.y;
var top = Position.page(evt.object)[1];
var levels = Math.floor((y - top)/this.zoomStopHeight);
this.map.zoomTo(this.map.getMaxZoomLevel() - levels);
this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels);
Event.stop(evt);
},
@@ -183,8 +197,8 @@ OpenLayers.Control.PanZoomBar.prototype =
if (!Event.isLeftClick(evt)) return;
if (this.zoomStart) {
this.div.style.cursor="default";
this.map.events.remove("mousemove");
this.map.events.remove("mouseup");
this.map.events.unregister("mouseup", this, this.passEventToSlider);
this.map.events.unregister("mousemove", this, this.passEventToSlider);
var deltaY = this.zoomStart.y - evt.xy.y
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
this.moveZoomBar();
@@ -198,8 +212,8 @@ OpenLayers.Control.PanZoomBar.prototype =
*/
moveZoomBar:function() {
var newTop =
(this.map.getMaxZoomLevel() - this.map.getZoom()) * this.zoomStopHeight
+ this.startTop + 1;
((this.map.getNumZoomLevels()-1) - this.map.getZoom()) *
this.zoomStopHeight + this.startTop + 1;
this.slider.style.top = newTop + "px";
},

View File

@@ -48,9 +48,8 @@ OpenLayers.Feature.WFS.prototype =
//this should be overridden by subclasses
// must return an Object with 'id' and 'lonlat' values set
var point = xmlNode.getElementsByTagName("Point");
var text = OpenLayers.Util.getXmlNodeValue(point[0]);
var text = OpenLayers.Util.getXmlNodeValue(point[0].getElementsByTagName("coordinates")[0]);
var floats = text.split(",");
return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]),
parseFloat(floats[1])),
id: null};

View File

@@ -51,10 +51,7 @@ OpenLayers.Layer.prototype = {
maxResolution: null,
/** @type int */
minZoomLevel: null,
/** @type int */
maxZoomLevel: null,
numZoomLevels: null,
/** @type float */
minScale: null,
@@ -148,6 +145,12 @@ OpenLayers.Layer.prototype = {
Object.extend(this, this.options);
},
/**
*
*/
onMapResize: function() {
//this function can be implemented by subclasses
},
/**
* @param {OpenLayers.Bounds} bound
@@ -163,18 +166,21 @@ OpenLayers.Layer.prototype = {
* so that subclasses can override this and take special action once
* they have their map variable set.
*
* Here we take care to bring over any of the necessary default properties
* from the map.
*
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
this.map = map;
var properties = new Array(
'projection', 'minExtent', 'maxExtent',
'minScale', 'maxScale',
'projection', 'units',
'scales', 'resolutions',
'maxScale', 'minScale',
'maxResolution', 'minResolution',
'minZoomLevel', 'maxZoomLevel', 'units',
'scales', 'resolutions'
'minExtent', 'maxExtent',
'numZoomLevels'
);
for(var i=0; i < properties.length; i++) {
if (this[properties[i]] == null) {
@@ -220,6 +226,16 @@ OpenLayers.Layer.prototype = {
/* */
/********************************************************/
/**
* @param {Boolean} isBaseLayer
*/
setIsBaseLayer: function(isBaseLayer) {
this.isBaseLayer = isBaseLayer;
if (this.map != null) {
this.map.events.triggerEvent("changelayer");
}
},
/**
* @type String
*/
@@ -242,19 +258,11 @@ OpenLayers.Layer.prototype = {
},
/**
* @returns The minimum zoom level that can be reached in this layer
* @returns The total number of zoom levels this layer can reach
* @type int
*/
getMinZoomLevel: function() {
return this.minZoomLevel;
},
/**
* @returns The maximum zoom level that can be reached in this layer
* @type int
*/
getMaxZoomLevel: function() {
return this.maxZoomLevel;
getNumZoomLevels: function() {
return this.numZoomLevels;
},
/********************************************************/
@@ -272,7 +280,7 @@ OpenLayers.Layer.prototype = {
*/
getResolution: function() {
var viewSize = this.map.getSize();
var extent = this.map.getExtent();
var extent = this.getExtent();
return Math.max( extent.getWidth() / viewSize.w,
extent.getHeight() / viewSize.h );
},
@@ -316,7 +324,7 @@ OpenLayers.Layer.prototype = {
*/
getLonLatFromViewPortPx: function (viewPortPx) {
var size = this.map.getSize();
var center = this.map.getCenter(); //map center lon/lat
var center = this.map.getCenter();
var res = this.map.getResolution();
var delta_x = viewPortPx.x - (size.w / 2);

View File

@@ -37,9 +37,6 @@ OpenLayers.Layer.EventPane.prototype =
if (arguments.length > 0) {
if (this.pane == null) {
this.pane = OpenLayers.Util.createDiv();
this.pane.style.width = "100%";
this.pane.style.height = "100%";
this.pane.style.backgroundColor = "transparent";
}
}
},
@@ -55,6 +52,12 @@ OpenLayers.Layer.EventPane.prototype =
this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1;
this.pane.style.display = this.div.style.display;
this.pane.style.width="100%";
this.pane.style.height="100%";
if (/MSIE/.test(navigator.userAgent)) {
this.pane.style.background = "url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";
}
if (this.isFixed) {
this.map.viewPortDiv.appendChild(this.pane);
} else {

View File

@@ -11,11 +11,6 @@ OpenLayers.Layer.GeoRSS = Class.create();
OpenLayers.Layer.GeoRSS.prototype =
Object.extend( new OpenLayers.Layer.Markers(), {
/** GeoRSS layer is never a base layer.
* @type Boolean
*/
isBaseLayer: false,
/** store url of text file
* @type str */
location:null,

View File

@@ -2,31 +2,8 @@
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
* text of the license. */
if (typeof GMap2 != "undefined") {
/** Hack-on function because GMAPS does not give it to us
*
* @param {GLatLng} gLatLng
*
* @returns A GPoint specifying gLatLng translated into "Container" coords
* @type GPoint
*/
GMap2.prototype.fromLatLngToContainerPixel = function(gLatLng) {
// first we translate into "DivPixel"
var gPoint = this.fromLatLngToDivPixel(gLatLng);
// locate the sliding "Div" div
// it seems like "b" is the main div
var div = this.b.firstChild.firstChild;
// adjust by the offset of "Div" and voila!
gPoint.x += div.offsetLeft;
gPoint.y += div.offsetTop;
return gPoint;
};
}
/**
* @class
@@ -49,7 +26,7 @@ OpenLayers.Layer.Google.prototype =
// OPTIONS
/** @type int */
minZoomLevel: -1,
minZoomLevel: 0,
/** @type int */
maxZoomLevel: 16,
@@ -65,6 +42,8 @@ OpenLayers.Layer.Google.prototype =
if (this.maxExtent == null) {
this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
}
this.addContainerPxFunction();
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
},
/**
@@ -147,6 +126,13 @@ OpenLayers.Layer.Google.prototype =
}
},
/**
* @param {Event} evt
*/
onMapResize: function() {
this.gmap.checkResize();
},
/** If we can't load the GMap, then display an error message to the
* user and tell them where to go for help.
*
@@ -259,6 +245,12 @@ OpenLayers.Layer.Google.prototype =
if ((this.gmap != null) && (this.gmap.getCenter() != null)) {
var gBounds = this.getGLatLngBoundsFromOLBounds(bounds);
var gZoom = this.gmap.getBoundsZoomLevel(gBounds);
//make sure zoom is within bounds
var gZoom = Math.min(Math.max(gZoom, this.minZoomLevel),
this.maxZoomLevel);
zoom = this.getOLZoomFromGZoom(gZoom);
}
return zoom;
@@ -287,7 +279,7 @@ OpenLayers.Layer.Google.prototype =
getOLZoomFromGZoom: function(gZoom) {
var zoom = null;
if (gZoom != null) {
zoom = gZoom;
zoom = gZoom - this.minZoomLevel;
}
return zoom;
},
@@ -302,7 +294,7 @@ OpenLayers.Layer.Google.prototype =
getGZoomFromOLZoom: function(olZoom) {
var zoom = null;
if (olZoom != null) {
zoom = olZoom;
zoom = olZoom + this.minZoomLevel;
}
return zoom;
},
@@ -417,7 +409,33 @@ OpenLayers.Layer.Google.prototype =
return gLatLngBounds;
},
addContainerPxFunction: function() {
if (typeof GMap2 != "undefined" && !GMap2.fromLatLngToContainerPixel) {
/** Hack-on function because GMAPS does not give it to us
*
* @param {GLatLng} gLatLng
*
* @returns A GPoint specifying gLatLng translated into "Container" coords
* @type GPoint
*/
GMap2.prototype.fromLatLngToContainerPixel = function(gLatLng) {
// first we translate into "DivPixel"
var gPoint = this.fromLatLngToDivPixel(gLatLng);
// locate the sliding "Div" div
// it seems like "b" is the main div
var div = this.b.firstChild.firstChild;
// adjust by the offset of "Div" and voila!
gPoint.x += div.offsetLeft;
gPoint.y += div.offsetTop;
return gPoint;
};
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Google"
});

View File

@@ -42,7 +42,6 @@ OpenLayers.Layer.Grid.prototype =
destroy: function() {
this.clearGrid();
this.grid = null;
this.alpha = null;
this.tileSize = null;
OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
},
@@ -88,30 +87,6 @@ OpenLayers.Layer.Grid.prototype =
}
},
/**
* @param {String} tileID
*
* @returns The OpenLayers.Tile with the corresponding ID from the grid.
* if no tile is found, returns null
* @type OpenLayers.Tile
*/
getTile: function(tileID) {
var foundTile = null;
if (this.grid) {
for(var iRow = 0; iRow < this.grid.length; iRow++) {
var row = this.grid[iRow];
for(var iCol = 0; iCol < row.length; iCol++) {
var tile = row[iCol];
if (tile.id == tileID) {
foundTile = tile;
}
}
}
}
return foundTile;
},
/** This function is called whenever the map is moved. All the moving
* of actual 'tiles' is done by the map, but moveTo's role is to accept
* a bounds and make sure the data that that bounds requires is pre-loaded.
@@ -150,6 +125,8 @@ OpenLayers.Layer.Grid.prototype =
},
/**
* @private
*
* @returns A Bounds object representing the bounds of all the currently
* loaded tiles (including those partially or not at all seen
* onscreen)
@@ -170,7 +147,7 @@ OpenLayers.Layer.Grid.prototype =
},
/**
*
* @private
*/
_initTiles:function() {
var viewSize = this.map.getSize();
@@ -247,7 +224,15 @@ OpenLayers.Layer.Grid.prototype =
},
/**
* @private
*
* Starts at the top right corner of the grid and proceeds in a spiral
* towards the center, adding tiles one at a time to the beginning of a
* queue.
*
* Once all the grid's tiles have been added to the queue, we go back
* and iterate through the queue (thus reversing the spiral order from
* outside-in to inside-out), calling draw() on each tile.
*/
spiralTileLoad: function() {
var tileQueue = new Array();
@@ -279,6 +264,8 @@ OpenLayers.Layer.Grid.prototype =
break;
}
// if the test grid coordinates are within the bounds of the
// grid, get a reference to the tile.
var tile = null;
if ((testRow < this.grid.length) &&
(testCell < this.grid[0].length)) {
@@ -286,12 +273,16 @@ OpenLayers.Layer.Grid.prototype =
}
if ((tile != null) && (!tile.queued)) {
//add tile to beginning of queue, mark it as queued.
tileQueue.unshift(tile);
tile.queued = true;
//restart the directions counter and take on the new coords
directionsTried = 0;
iRow = testRow;
iCell = testCell;
} else {
//need to try to load a tile in a different direction
direction = (direction + 1) % 4;
directionsTried++;
}
@@ -301,6 +292,7 @@ OpenLayers.Layer.Grid.prototype =
for(var i=0; i < tileQueue.length; i++) {
var tile = tileQueue[i]
tile.draw();
//mark tile as unqueued for the next time (since tiles are reused)
tile.queued = false;
}
},
@@ -320,67 +312,6 @@ OpenLayers.Layer.Grid.prototype =
},
/********************************************************/
/* */
/* Baselayer Functions */
/* */
/********************************************************/
/** Calculates based on resolution, center, and mapsize
*
* @returns A Bounds object which represents the lon/lat bounds of the
* current viewPort.
* @type OpenLayers.Bounds
*/
getExtent: function () {
var extent = null;
var center = this.map.getCenter();
if (center != null) {
var res = this.getResolution();
var size = this.map.getSize();
var w_deg = size.w * res;
var h_deg = size.h * res;
extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
center.lat - h_deg / 2,
center.lon + w_deg / 2,
center.lat + h_deg / 2);
}
return extent;
},
/**
* @param {OpenLayers.Bounds} bounds
*
* @return {int}
*/
getZoomForExtent: function (bounds) {
var maxRes = this.map.getMaxResolution();
var viewSize = this.map.getSize();
var width = bounds.getWidth();
var height = bounds.getHeight();
var degPerPixel = (width > height) ? width / viewSize.w
: height / viewSize.h;
var zoom = Math.floor( (Math.log(maxRes/degPerPixel)) / Math.log(2) );
var maxZoomLevel = this.map.getMaxZoomLevel();
var minZoomLevel = this.map.getMinZoomLevel();
//make sure zoom is within bounds
zoom = Math.min( Math.max(zoom, minZoomLevel),
maxZoomLevel );
return zoom;
},
/** go through and remove all tiles from the grid, calling
* destroy() on each of them to kill circular references
*
@@ -462,6 +393,65 @@ OpenLayers.Layer.Grid.prototype =
}
},
/********************************************************/
/* */
/* Baselayer Functions */
/* */
/********************************************************/
/** Calculates based on resolution, center, and mapsize
*
* @returns A Bounds object which represents the lon/lat bounds of the
* current viewPort.
* @type OpenLayers.Bounds
*/
getExtent: function () {
var extent = null;
var center = this.map.getCenter();
if (center != null) {
var res = this.map.getResolution();
var size = this.map.getSize();
var w_deg = size.w * res;
var h_deg = size.h * res;
extent = new OpenLayers.Bounds(center.lon - w_deg / 2,
center.lat - h_deg / 2,
center.lon + w_deg / 2,
center.lat + h_deg / 2);
}
return extent;
},
/**
* @param {OpenLayers.Bounds} bounds
*
* @return {int}
*/
getZoomForExtent: function (bounds) {
var maxRes = this.map.getMaxResolution();
var viewSize = this.map.getSize();
var width = bounds.getWidth();
var height = bounds.getHeight();
var degPerPixel = (width > height) ? width / viewSize.w
: height / viewSize.h;
var zoom = Math.floor( (Math.log(maxRes/degPerPixel)) / Math.log(2) );
//make sure zoom is within bounds
zoom = Math.min( Math.max(zoom, 0),
this.getNumZoomLevels() - 1);
return zoom;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Layer.Grid"
});

View File

@@ -36,10 +36,17 @@ OpenLayers.Layer.HTTPRequest.prototype =
this.params = Object.extend( new Object(), params);
},
/** When the layer is added to the map, once it has taken all the
* relevant properties from the map (in Layer.setMap()), we will
* make the call to initialize the layer's resolutions array.
*
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
this.initResolutions();
},
/**
*
*/
@@ -131,31 +138,83 @@ OpenLayers.Layer.HTTPRequest.prototype =
return requestString;
},
/** This method's responsibility is to set up the 'resolutions' array
* for the layer -- this array is what the layer will use to interface
* between the zoom levels of the map and the resolution display of the
* layer.
*
* The user has several options that determine how the array is set up.
*
* For a detailed explanation, see the following wiki from the
* openlayers.org homepage:
*
* http://trac.openlayers.org/wiki/SettingZoomLevels
*
* @private
*/
initResolutions: function() {
if ((this.scales != null) || (this.resolutions != null)) {
//preset levels
if (this.scales != null) {
this.resolutions = new Array();
for(var i = 0; i < this.scales.length; i++)
this.resolutions[i] = OpenLayers.Util.getResolutionFromScale(this.scales[i], this.units);
this.maxZoomLevel = this.resolutions.length;
} else if (this.resolutions != null) {
this.maxZoomLevel = this.resolutions.length;
} else {
this.resolutions = new Array();
if (this.minScale)
this.maxResolution = OpenLayers.Util.getResolutionFromScale(this.minScale, this.units);
var maxRes = this.getMaxResolution();
if (this.maxScale) {
/* This will cause this.map.getMaxZoomLevel() to be set the next time
* it is called, which means that the next portion here will succeed. */
var minRes = OpenLayers.Util.getResolutionFromScale(this.maxScale);
this.maxZoomLevel = Math.floor(Math.log(maxRes/minRes) / Math.log(2));
for(var i = 0; i < this.scales.length; i++) {
this.resolutions[i] =
OpenLayers.Util.getResolutionFromScale(this.scales[i],
this.units);
}
for (var i=this.getMinZoomLevel(); i <= this.getMaxZoomLevel(); i++) {
this.resolutions.push(maxRes / Math.pow(2, i));
}
this.numZoomLevels = this.resolutions.length;
} else {
//maxResolution and numZoomLevels
this.resolutions = new Array();
// determine maxResolution
if (this.minScale) {
this.maxResolution =
OpenLayers.Util.getResolutionFromScale(this.minScale,
this.units);
} else if (this.maxResolution == "auto") {
var viewSize = this.map.getSize();
var wRes = this.maxExtent.getWidth() / viewSize.w;
var hRes = this.maxExtent.getHeight()/ viewSize.h;
this.maxResolution = Math.max(wRes, hRes);
}
// determine minResolution
if (this.maxScale != null) {
this.minResolution =
OpenLayers.Util.getResolutionFromScale(this.maxScale);
} else if ((this.minResolution == "auto") &&
(this.minExtent != null)){
var viewSize = this.map.getSize();
var wRes = this.minExtent.getWidth() / viewSize.w;
var hRes = this.minExtent.getHeight()/ viewSize.h;
this.minResolution = Math.max(wRes, hRes);
}
// determine numZoomLevels
if (this.minResolution != null) {
var ratio = this.maxResolution / this.minResolution;
this.numZoomLevels =
Math.floor(Math.log(ratio) / Math.log(2)) + 1;
}
// now we have numZoomLevels and maxResolution,
// we can populate the resolutions array
for (var i=0; i < this.numZoomLevels; i++) {
this.resolutions.push(this.maxResolution / Math.pow(2, i));
}
}
},
/**
* @returns The currently selected resolution of the map, taken from the
* resolutions array, indexed by current zoom level.
* @type float
*/
getResolution: function() {
var zoom = this.map.getZoom();

View File

@@ -11,12 +11,6 @@ OpenLayers.Layer.Text = Class.create();
OpenLayers.Layer.Text.prototype =
Object.extend( new OpenLayers.Layer.Markers(), {
/** Text layer is never a base layer.
*
* @type Boolean
*/
isBaseLayer: false,
/** store url of text file - this should be specified in the
* "options" hashtable
* @type str */

View File

@@ -14,6 +14,12 @@ OpenLayers.Layer.VirtualEarth.prototype =
/** @type VEMap */
vemap: null,
/** @type int */
minZoomLevel: 1,
/** @type int */
maxZoomLevel: 17,
/**
* @constructor
*
@@ -21,6 +27,8 @@ OpenLayers.Layer.VirtualEarth.prototype =
*/
initialize:function(name) {
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
this.numZoomLevels = this.maxZoomLevel - this.minZoomLevel + 1;
},
/**
@@ -200,6 +208,8 @@ OpenLayers.Layer.VirtualEarth.prototype =
*/
getZoomForExtent: function (bounds) {
var zoom = null;
if (this.vemap != null) {
var maxRes = this.map.getMaxResolution();
var viewSize = this.map.getSize();
@@ -209,15 +219,15 @@ OpenLayers.Layer.VirtualEarth.prototype =
var degPerPixel = (width > height) ? width / viewSize.w
: height / viewSize.h;
var zoom = Math.floor( (Math.log(maxRes/degPerPixel)) / Math.log(2) );
var maxZoomLevel = this.map.getMaxZoomLevel();
var minZoomLevel = this.map.getMinZoomLevel();
var veZoom = Math.floor( (Math.log(maxRes/degPerPixel)) /
Math.log(2) );
//make sure zoom is within bounds
zoom = Math.min( Math.max(zoom, minZoomLevel),
maxZoomLevel );
var veZoom = Math.min(Math.max(veZoom, this.minZoomLevel),
this.maxZoomLevel);
zoom = this.getOLZoomFromVEZoom(veZoom);
}
return zoom;
},
@@ -245,7 +255,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
getOLZoomFromVEZoom: function(veZoom) {
var zoom = null;
if (veZoom != null) {
zoom = veZoom;
zoom = veZoom - this.minZoomLevel;
}
return zoom;
},
@@ -260,7 +270,7 @@ OpenLayers.Layer.VirtualEarth.prototype =
getVEZoomFromOLZoom: function(olZoom) {
var zoom = null;
if (olZoom != null) {
zoom = olZoom;
zoom = olZoom + this.minZoomLevel;
}
return zoom;
},

View File

@@ -19,6 +19,8 @@ OpenLayers.Layer.WFS.prototype =
*/
isBaseLayer: false,
buffer: 1,
/** Allow the user to specify special classes for features and tiles.
*
* This allows for easy-definition of behaviour. The defaults are
@@ -157,10 +159,10 @@ OpenLayers.Layer.WFS.prototype =
*
* Once params have been changed, we will need to re-init our tiles
*
* @param {Object} params Hashtable of new params to use
* @param {Object} newParams Hashtable of new params to use
*/
mergeNewParams:function(params) {
var upperParams = OpenLayers.Util.upperCaseObject(params);
mergeNewParams:function(newParams) {
var upperParams = OpenLayers.Util.upperCaseObject(newParams);
var newArguments = [upperParams];
OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this, newArguments);

View File

@@ -121,10 +121,10 @@ OpenLayers.Layer.WMS.prototype =
*
* Once params have been changed, we will need to re-init our tiles
*
* @param {Object} params Hashtable of new params to use
* @param {Object} newParams Hashtable of new params to use
*/
mergeNewParams:function(params) {
var upperParams = OpenLayers.Util.upperCaseObject(params);
mergeNewParams:function(newParams) {
var upperParams = OpenLayers.Util.upperCaseObject(newParams);
var newArguments = [upperParams];
OpenLayers.Layer.Grid.prototype.mergeNewParams.apply(this,
newArguments);

View File

@@ -177,8 +177,11 @@ OpenLayers.Layer.WMS.Untiled.prototype =
* @param {Object} newParams
*/
mergeNewParams:function(newParams) {
var upperParams = OpenLayers.Util.upperCaseObject(newParams);
var newArguments = [upperParams];
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
arguments);
newArguments);
//redraw
this.moveTo();
},

View File

@@ -25,11 +25,11 @@ OpenLayers.Layer.WorldWind.prototype =
zoomLevels: null,
initialize: function(name, url, lzd, zoomLevels, params) {
initialize: function(name, url, lzd, zoomLevels, params, options) {
this.lzd = lzd;
this.zoomLevels = zoomLevels;
var newArguments = new Array();
newArguments.push(name, url, params);
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
this.params = (params ? params : {});
if (arguments.length > 0 && params) {

View File

@@ -78,11 +78,14 @@ OpenLayers.Map.prototype = {
// Options
/** @type OpenLayers.Size */
tileSize: null,
/** @type String */
projection: "EPSG:4326",
/** @type OpenLayers.Bounds */
maxExtent: null,
/** @type String */
units: 'degrees',
/** default max is 360 deg / 256 px, which corresponds to
* zoom level 0 on gmaps
@@ -90,21 +93,23 @@ OpenLayers.Map.prototype = {
* @type float */
maxResolution: 1.40625,
/** @type int */
minZoomLevel: 0,
/** @type float */
minResolution: null,
/** @type int */
maxZoomLevel: 16,
/** @type float */
maxScale: null,
/** @type OpenLayers.Size */
tileSize: null,
/** @type String */
units: 'degrees',
/** @type Float */
/** @type float */
minScale: null,
/** @type OpenLayers.Bounds */
maxExtent: null,
/** @type OpenLayers.Bounds */
minExtent: null,
/** @type int */
numZoomLevels: 16,
/**
@@ -129,6 +134,8 @@ OpenLayers.Map.prototype = {
// the layerContainerDiv is the one that holds all the layers
id = div.id + "_OpenLayers_Container";
this.layerContainerDiv = OpenLayers.Util.createDiv(id);
this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;
this.viewPortDiv.appendChild(this.layerContainerDiv);
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES);
@@ -207,16 +214,6 @@ OpenLayers.Map.prototype = {
// now add the options declared by the user
// (these will override defaults)
Object.extend(this, options);
// if maxResolution is specified as "auto", calculate it
// based on the maxExtent and the viewSize
//
if (this.maxResolution == "auto" || this.maxResolution == null) {
var maxExtent = this.getMaxExtent();
var viewSize = this.getSize();
this.maxResolution = Math.max(maxExtent.getWidth() / viewSize.w,
maxExtent.getHeight() / viewSize.h );
}
},
/**
@@ -470,14 +467,18 @@ OpenLayers.Map.prototype = {
if (oldSize == null)
this.size = oldSize = newSize;
if (!newSize.equals(oldSize)) {
// move the layer container so that the map is still centered
var dx = (newSize.w - oldSize.w) / 2,
dy = (newSize.h - oldSize.h) / 2;
var lcStyle = this.layerContainerDiv.style;
lcStyle.left = (parseInt(lcStyle.left) + dx) + "px";
lcStyle.top = (parseInt(lcStyle.top ) + dy) + "px";
// reset the map center
this.layerContainerOrigin = this.center.clone();
//notify layers of mapresize
for(var i=0; i < this.layers.length; i++) {
this.layers[i].onMapResize();
}
var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2);
var zoom = this.getZoom();
this.zoom = null;
this.setCenter(center, zoom);
// store the new size
this.size = newSize;
// the div might have moved on the page, also
@@ -643,8 +644,8 @@ OpenLayers.Map.prototype = {
*/
isValidZoomLevel: function(zoomLevel) {
return ( (zoomLevel != null) &&
(zoomLevel >= this.getMinZoomLevel()) &&
(zoomLevel <= this.getMaxZoomLevel()) );
(zoomLevel >= 0) &&
(zoomLevel < this.getNumZoomLevels()) );
},
/**
@@ -680,15 +681,9 @@ OpenLayers.Map.prototype = {
*/
getProjection: function() {
var projection = null;
if (this.baseLayer != null) {
projection = this.baseLayer.getProjection();
}
if (projection == null) {
projection = this.projection;
}
return projection;
},
@@ -698,15 +693,9 @@ OpenLayers.Map.prototype = {
*/
getMaxResolution: function() {
var maxResolution = null;
if (this.baseLayer != null) {
maxResolution = this.baseLayer.getMaxResolution();
}
if (maxResolution == null) {
maxResolution = this.maxResolution;
}
return maxResolution;
},
@@ -715,55 +704,25 @@ OpenLayers.Map.prototype = {
*/
getMaxExtent: function () {
var maxExtent = null;
if (this.baseLayer != null) {
maxExtent = this.baseLayer.getMaxExtent();
}
if (maxExtent == null) {
maxExtent = this.maxExtent;
}
return maxExtent;
},
/**
* @returns The maximum zoom level that can be reached in the map
* @returns The total number of zoom levels that can be displayed by the
* current baseLayer.
* @type int
*/
getMaxZoomLevel: function() {
var maxZoomLevel = null;
getNumZoomLevels: function() {
var numZoomLevels = null;
if (this.baseLayer != null) {
maxZoomLevel = this.baseLayer.getMaxZoomLevel();
numZoomLevels = this.baseLayer.getNumZoomLevels();
}
if (maxZoomLevel == null) {
maxZoomLevel = this.maxZoomLevel;
}
return maxZoomLevel;
return numZoomLevels;
},
/**
* @returns The minimum zoom level that can be reached in the map
* @type int
*/
getMinZoomLevel: function() {
var minZoomLevel = null;
if (this.baseLayer != null) {
minZoomLevel = this.baseLayer.getMinZoomLevel();
}
if (minZoomLevel == null) {
minZoomLevel = this.minZoomLevel;
}
return minZoomLevel;
},
/********************************************************/
/* */
/* Baselayer Functions */
@@ -783,7 +742,6 @@ OpenLayers.Map.prototype = {
*/
getExtent: function () {
var extent = null;
if (this.baseLayer != null) {
extent = this.baseLayer.getExtent();
}
@@ -797,7 +755,6 @@ OpenLayers.Map.prototype = {
*/
getResolution: function () {
var resolution = null;
if (this.baseLayer != null) {
resolution = this.baseLayer.getResolution();
}
@@ -811,9 +768,8 @@ OpenLayers.Map.prototype = {
*/
getScale: function () {
var scale = null;
if (this.baseLayer != null) {
var res = this.baseLayer.getResolution();
var res = this.getResolution();
var units = this.baseLayer.units;
scale = res * OpenLayers.INCHES_PER_UNIT[units] *
OpenLayers.DOTS_PER_INCH;
@@ -831,7 +787,6 @@ OpenLayers.Map.prototype = {
*/
getZoomForExtent: function (bounds) {
zoom = null;
if (this.baseLayer != null) {
zoom = this.baseLayer.getZoomForExtent(bounds);
}
@@ -853,7 +808,9 @@ OpenLayers.Map.prototype = {
* @param {int} zoom
*/
zoomTo: function(zoom) {
if (this.isValidZoomLevel(zoom)) {
this.setCenter(null, zoom);
}
},
/**
@@ -927,7 +884,11 @@ OpenLayers.Map.prototype = {
* @private
*/
getLonLatFromViewPortPx: function (viewPortPx) {
return this.baseLayer.getLonLatFromViewPortPx(viewPortPx);
var lonlat = null;
if (this.baseLayer != null) {
lonlat = this.baseLayer.getLonLatFromViewPortPx(viewPortPx);
}
return lonlat;
},
/**
@@ -940,7 +901,11 @@ OpenLayers.Map.prototype = {
* @private
*/
getViewPortPxFromLonLat: function (lonlat) {
return this.baseLayer.getViewPortPxFromLonLat(lonlat);
var px = null;
if (this.baseLayer != null) {
px = this.baseLayer.getViewPortPxFromLonLat(lonlat);
}
return px;
},

View File

@@ -64,7 +64,9 @@ OpenLayers.Tile.Image.prototype =
*/
clear: function() {
OpenLayers.Tile.prototype.clear.apply(this, arguments);
if(this.imgDiv) {
this.imgDiv.style.display = "none";
}
},
/**

View File

@@ -79,8 +79,8 @@ OpenLayers.Tile.WFS.prototype =
if (this.urls != null) {
for(var i=0; i < this.urls.length; i++) {
var params = { BBOX:bounds.toBBOX() };
var url = this.urls[i] +
var params = { BBOX:this.bounds.toBBOX() };
var url = this.urls[i] + "&" +
OpenLayers.Util.getParameterString(params);
OpenLayers.loadURL(url, null, this, success, failure);
}

View File

@@ -355,6 +355,8 @@ OpenLayers.Util.getXmlNodeValue = function(node) {
Try.these(
function() {
val = node.text;
if (!val)
val = node.textContent;
},
function() {
val = node.textContent;

56
news.txt Normal file
View File

@@ -0,0 +1,56 @@
OpenLayers 2.0 Release Notes
* Deprecated Methods which were removed:
For details, see r1228
* OpenLayers.Map
* removed: getFullExtent() -- use getMaxExtent() instead
* removed: zoomToFullExtent() -- use zoomToMaxExtent() instead
* OpenLayers.Layer.Grid
* removed: setTileSize() -- user should instead pass a 'tileSize' property
as one of the options when initializing the Grid Layer. ex:
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.WMS(name, url, params);
* OpenLayers.Layer.HTTPRequest
* removed: changeParams() -- use mergeNewParams() instead
* OpenLayers.Pixel
* removed: copyOf() -- use clone() instead
* OpenLayers.Size
* removed: copyOf() -- use clone() instead
* OpenLayers.LonLat
* removed: copyOf() -- use clone() instead
* OpenLayers.Bounds
* removed: copyOf() -- use clone() instead
* Array
* removed: copyOf() -- use clone() instead
* MouseWheel
* It is now possible to zoom in/out with the mouse wheel instead of clicks.
* Spiral Gridding
* Instead of loading from the top to bottom of the map, Openlayers will
now start loading tiles from the center of the map.
* Tile Re-Use
* In order to lower memory constraints and reduce element creation times,
OpenLayers now creates a single set of images/tiles and reuses them as
you scroll around the map.
* New Layer Support
* Google
* Virtual Earth
* GeoRSS (RSS 1.0 and 2.0 in FF, IE, RSS 2.0 in Safari)
* KaMap
* Untiled WMS
* Scale Based Methods
* It is now possible to set zooms based on the concept of scale. See
documentation in the options for the Map constructor.
OpenLayers 1.0
Initial release.

View File

@@ -38,7 +38,10 @@ Using OpenLayers in Your Own Website
The examples/ directory is full of useful examples.
There is some documentation at http://trac.openlayers.org/ as well.
Dcumentation is available in the doc/ directory: to build an HTML version
of the documentation, run ./docs.sh in the build/ directory.
Information on changes in the API is available in news.txt.
--------------------------
Contributing to OpenLayers

View File

@@ -20,8 +20,12 @@
if (!map.getCenter()) map.zoomToMaxExtent();
map.addControl(control);
map.pan(5, 0);
if (/MSIE/.test(navigator.userAgent)) {
t.eq($('permalink').href, "?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
} else {
t.eq($('permalink').href, location+"?lat=0&lon=1.75781&zoom=2", "Panning sets permalink");
}
}
function test_03_Control_Permalink_updateLinksBase (t) {
t.plan( 2 );

View File

@@ -89,19 +89,17 @@
function test_04_Layer_StandardOptionsAccessors (t) {
t.plan( 5 );
t.plan( 4 );
var projection = "chicken";
var maxExtent = new OpenLayers.Bounds(50,50,100,100);
var maxResolution = 1.5726;
var minZoomLevel = 5;
var maxZoomLevel = 15;
var numZoomLevels = 11;
var options = { projection: projection,
maxExtent: maxExtent,
maxResolution: maxResolution,
minZoomLevel: minZoomLevel,
maxZoomLevel: maxZoomLevel
numZoomLevels: numZoomLevels
};
var layer = new OpenLayers.Layer('Test Layer', options);
@@ -109,8 +107,7 @@
t.eq(layer.getProjection(), projection, "getProjection() works");
t.ok(layer.getMaxExtent().equals(maxExtent), "getMaxExtent() works");
t.eq(layer.getMaxResolution(), maxResolution, "getMaxResolution() works");
t.eq(layer.getMinZoomLevel(), minZoomLevel, "getMinZoomLevel() works");
t.eq(layer.getMaxZoomLevel(), maxZoomLevel, "getMaxZoomLevel() works");
t.eq(layer.getNumZoomLevels(), numZoomLevels, "getNumZoomLevels() works");
}
function test_05_Layer_visibility(t) {

View File

@@ -56,7 +56,11 @@
// MOUSEMOVE test does not seem to work...
// t.plan( 2 );
if (document.createEventObject) {
t.plan(3);
} else {
t.plan(1);
}
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.EventPane('Test Layer');

View File

@@ -114,13 +114,13 @@
* -insertColumn
* -insertRow
function test_07_Layer_Grid_moveTo(t) {
function 07_Layer_Grid_moveTo(t) {
}
function test_08_Layer_Grid_insertColumn(t) {
function 08_Layer_Grid_insertColumn(t) {
}
function test_09_Layer_Grid_insertRow(t) {
function 09_Layer_Grid_insertRow(t) {
}
*
@@ -166,41 +166,15 @@
}
function test_11_Layer_Grid_getTile(t) {
t.plan(2);
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
//test with tile creation
layer = new OpenLayers.Layer.WMS(name, url, params);
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];
var gotTile = layer.getTile(tile.id);
t.ok( gotTile == tile, "got right tile");
gotTile = layer.getTile("chicken");
t.ok( gotTile == null, "getTile() of bogus id returns null");
}
function test_99_Layer_Grid_destroy (t) {
t.plan( 4 );
t.plan( 3 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.Grid(name, url, params);
map.addLayer(layer);
layer.destroy();
t.eq( layer.grid, null, "layer.grid is null after destroy" );
t.eq( layer.alpha, null, "layer.alpha is null after destroy" );
t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );

View File

@@ -107,13 +107,13 @@
* -insertColumn
* -insertRow
function test_07_Layer_KaMap_moveTo(t) {
function 07_Layer_KaMap_moveTo(t) {
}
function test_08_Layer_KaMap_insertColumn(t) {
function 08_Layer_KaMap_insertColumn(t) {
}
function test_09_Layer_KaMap_insertRow(t) {
function 09_Layer_KaMap_insertRow(t) {
}
*
@@ -158,42 +158,15 @@
t.ok( (layer.tileSize.h == 50) && (layer.tileSize.w == 500), "tileSize has been set correctly");
}
function test_11_Layer_KaMap_getTile(t) {
t.plan(2);
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
//test with tile creation
layer = new OpenLayers.Layer.KaMap(name, url, params, units);
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];
var gotTile = layer.getTile(tile.id);
t.ok( gotTile == tile, "got right tile");
gotTile = layer.getTile("chicken");
t.ok( gotTile == null, "getTile() of bogus id returns null");
}
function test_99_Layer_KaMap_destroy (t) {
t.plan( 4 );
t.plan( 3 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.KaMap(name, url, params, units);
map.addLayer(layer);
layer.destroy();
t.eq( layer.grid, null, "layer.grid is null after destroy" );
t.eq( layer.alpha, null, "layer.alpha is null after destroy" );
t.eq( layer.tileSize, null, "layer.tileSize is null after destroy" );

View File

@@ -27,7 +27,7 @@
t.ok( map.controls instanceof Array, "map.controls is an Array" );
t.ok( map.events instanceof OpenLayers.Events, "map.events is an OpenLayers.Events" );
t.ok( map.getMaxExtent() instanceof OpenLayers.Bounds, "map.maxExtent is an OpenLayers.Bounds" );
t.ok( map.getMaxZoomLevel() > 0, "map.maxZoomLevel is set" );
t.ok( map.getNumZoomLevels() > 0, "map has a default numZoomLevels" );
}
function test_02_Map_center(t) {
t.plan(3);
@@ -63,8 +63,8 @@
}
function test_04_Map_options(t) {
t.plan(2);
map = new OpenLayers.Map($('map'), {maxZoomLevel: 5, maxResolution: 3.14159});
t.eq( map.maxZoomLevel, 5, "map.maxZoomLevel set correctly via options hashtable" );
map = new OpenLayers.Map($('map'), {numZoomLevels: 6, maxResolution: 3.14159});
t.eq( map.numZoomLevels, 6, "map.numZoomLevels set correctly via options hashtable" );
t.eq( map.maxResolution, 3.14159, "map.maxResolution set correctly via options hashtable" );
}
function test_05_Map_center(t) {
@@ -151,18 +151,10 @@
}
t.ok(!found, "popup.div successfully removed from the map's viewPort");
}
function test_10_Map_auto_res(t) {
t.plan(2);
map = new OpenLayers.Map($('map'), {maxZoomLevel: 5, maxResolution: 'auto'});
t.eq( map.maxResolution, 1/3, "map.maxResolution set correctly via auto" );
map = new OpenLayers.Map($('map'), {maxZoomLevel: 5, maxResolution: null});
t.eq( map.maxResolution, 1/3, "map.maxResolution set correctly via null" );
}
/*** THIS IS A GOOD TEST, BUT IT SHOULD BE MOVED TO WMS.
* Also, it won't work until we figure out the viewSize bug
function test_08_Map_px_lonlat_translation (t) {
function 08_Map_px_lonlat_translation (t) {
t.plan( 6 );
map = new OpenLayers.Map($('map'));
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",