[OpenLayers-Commits] r3876 - in sandbox/tschaub/feature: examples examples/xml lib lib/OpenLayers lib/OpenLayers/BaseTypes lib/OpenLayers/Control lib/OpenLayers/Feature lib/OpenLayers/Format lib/OpenLayers/Geometry lib/OpenLayers/Handler lib/OpenLayers/Layer lib/OpenLayers/Renderer lib/OpenLayers/Tile lib/Rico tests tests/BaseTypes tests/Control tests/Format tests/Handler tests/Layer tools
commits at openlayers.org
commits at openlayers.org
Wed Aug 8 16:32:47 EDT 2007
Author: tschaub
Date: 2007-08-08 16:32:43 -0400 (Wed, 08 Aug 2007)
New Revision: 3876
Added:
sandbox/tschaub/feature/examples/xml.html
sandbox/tschaub/feature/examples/xml/
sandbox/tschaub/feature/examples/xml/features.xml
sandbox/tschaub/feature/lib/OpenLayers/Format/XML.js
sandbox/tschaub/feature/tests/Format/test_XML.html
sandbox/tschaub/feature/tests/Layer/test_Yahoo.html
sandbox/tschaub/feature/tests/test_BaseTypes.html
Removed:
sandbox/tschaub/feature/examples/xml/features.xml
Modified:
sandbox/tschaub/feature/examples/layerswitcher.html
sandbox/tschaub/feature/lib/OpenLayers.js
sandbox/tschaub/feature/lib/OpenLayers/Ajax.js
sandbox/tschaub/feature/lib/OpenLayers/BaseTypes.js
sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Bounds.js
sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Class.js
sandbox/tschaub/feature/lib/OpenLayers/Control/ArgParser.js
sandbox/tschaub/feature/lib/OpenLayers/Control/EditingToolbar.js
sandbox/tschaub/feature/lib/OpenLayers/Control/LayerSwitcher.js
sandbox/tschaub/feature/lib/OpenLayers/Control/MouseToolbar.js
sandbox/tschaub/feature/lib/OpenLayers/Control/OverviewMap.js
sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoom.js
sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoomBar.js
sandbox/tschaub/feature/lib/OpenLayers/Events.js
sandbox/tschaub/feature/lib/OpenLayers/Feature.js
sandbox/tschaub/feature/lib/OpenLayers/Feature/Vector.js
sandbox/tschaub/feature/lib/OpenLayers/Format/GML.js
sandbox/tschaub/feature/lib/OpenLayers/Format/WFS.js
sandbox/tschaub/feature/lib/OpenLayers/Geometry/Collection.js
sandbox/tschaub/feature/lib/OpenLayers/Geometry/MultiLineString.js
sandbox/tschaub/feature/lib/OpenLayers/Geometry/Point.js
sandbox/tschaub/feature/lib/OpenLayers/Handler.js
sandbox/tschaub/feature/lib/OpenLayers/Handler/Feature.js
sandbox/tschaub/feature/lib/OpenLayers/Handler/Path.js
sandbox/tschaub/feature/lib/OpenLayers/Handler/Point.js
sandbox/tschaub/feature/lib/OpenLayers/Handler/Polygon.js
sandbox/tschaub/feature/lib/OpenLayers/Layer.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/GML.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/GeoRSS.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/Google.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/Grid.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/HTTPRequest.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/KaMap.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/MapServer.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/Markers.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/TMS.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/Text.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/TileCache.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/Vector.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/WFS.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/WMS.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/WorldWind.js
sandbox/tschaub/feature/lib/OpenLayers/Layer/Yahoo.js
sandbox/tschaub/feature/lib/OpenLayers/Map.js
sandbox/tschaub/feature/lib/OpenLayers/Renderer/SVG.js
sandbox/tschaub/feature/lib/OpenLayers/Tile/WFS.js
sandbox/tschaub/feature/lib/OpenLayers/Util.js
sandbox/tschaub/feature/lib/Rico/Corner.js
sandbox/tschaub/feature/tests/BaseTypes/test_Bounds.html
sandbox/tschaub/feature/tests/BaseTypes/test_Element.html
sandbox/tschaub/feature/tests/Control/test_LayerSwitcher.html
sandbox/tschaub/feature/tests/Control/test_Panel.html
sandbox/tschaub/feature/tests/Format/test_GML.html
sandbox/tschaub/feature/tests/Handler/test_Drag.html
sandbox/tschaub/feature/tests/Layer/test_EventPane.html
sandbox/tschaub/feature/tests/Layer/test_Grid.html
sandbox/tschaub/feature/tests/Layer/test_MapServer.html
sandbox/tschaub/feature/tests/Layer/test_MapServer_Untiled.html
sandbox/tschaub/feature/tests/Layer/test_WMS.html
sandbox/tschaub/feature/tests/list-tests.html
sandbox/tschaub/feature/tests/test_Feature.html
sandbox/tschaub/feature/tests/test_Tile.html
sandbox/tschaub/feature/tests/test_Util.html
sandbox/tschaub/feature/tools/mergejs.py
Log:
merge r3794:HEAD from trunk
Modified: sandbox/tschaub/feature/examples/layerswitcher.html
===================================================================
--- sandbox/tschaub/feature/examples/layerswitcher.html 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/examples/layerswitcher.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -17,11 +17,11 @@
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
- {layers: 'basic'} );
+ {layers: 'basic'}, {'displayInLayerSwitcher':false} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"});
+ {layers: "modis,global_mosaic"}, {'isBaseLayer': false});
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
@@ -42,5 +42,10 @@
<h1>OpenLayers Example</h1>
<div id="layerswitcher" style="float:right; width: 20em;"></div>
<div id="map"></div>
+ <div id="docs">
+ <p>This demonstrates use of the LayerSwitcher outside the map div. It also shows use
+ of the displayInLayerSwitcher option on the Layer to cause it to not display in the
+ LayerSwitcher.</p>
+ </div>
</body>
</html>
Copied: sandbox/tschaub/feature/examples/xml (from rev 3875, trunk/openlayers/examples/xml)
Deleted: sandbox/tschaub/feature/examples/xml/features.xml
===================================================================
--- trunk/openlayers/examples/xml/features.xml 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/examples/xml/features.xml 2007-08-08 20:32:43 UTC (rev 3876)
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wfs:FeatureCollection numberOfFeatures="2" timeStamp="2007-08-03T13:10:00.071-06:00" xsi:schemaLocation="http://www.openplans.org/topp http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:leases http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:topp="http://www.openplans.org/topp" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ows="http://www.opengis.net/ows" xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMembers><topp:leases gml:id="leases.1"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.11.2:4267"><gml:lowerCorner>-107.7912454726602 43.649560413854424</gml:lowerCorner><gml:upperCorner>-107.75539905577847 43.66774946861892</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:meridian>6</topp:meridian><topp:township>0430N</topp:township><topp:range>0910W</topp:range><topp:section>27</topp:section><topp:surveytype>A</topp:surveytype><topp:aliquot>w2sw;</topp:aliquot><topp:serialnumb>WYB 0016999A</topp:serialnumb><topp:adminagenc>BUREAU OF LAND MGMT</topp:adminagenc><topp:price>0.0</topp:price><topp:acres>614.3</topp:acres><topp:dispositio>Authorized</topp:dispositio><topp:casetypeco>310781</topp:casetypeco><topp:casetype>O&g renewal lease - pd</topp:casetype><topp:commodity>Oil & gas</topp:commodity><topp:expireyear>0</topp:expireyear><topp:effectdate>6/5/1926</topp:effectdate><topp:royaltyrt>Rlty rate - 5%</topp:royaltyrt><topp:hbp>HBP</topp:hbp><topp:or>OR</topp:or><topp:name1>GAS VENTURES LLC</topp:name1><topp:perint1>100.0</topp:perint1><topp:perint2>0.0</topp:perint2><topp:perint3>0.0</topp:perint3><topp:perint4>0.0</topp:perint4><topp:updatedate>6/1/2006</topp:updatedate><topp:the_geom><gml:MultiPolygon><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>-107.75540341813374 43.65318043604783 -107.75540766903033 43.649560413854424 -107.76039213131902 43.64957232716459 -107.76537647481773 43.649584044882054 -107.76600694778301 43.649585553307226 -107.76600544447962 43.65320449790224 -107.76600393275089 43.65682260581091 -107.77035309969853 43.6568319555119 -107.77533746205971 43.65684246461631 -107.77533369030677 43.66046005010295 -107.78032119967183 43.66047517767307 -107.78114989067903 43.660477553258325 -107.7811491411714 43.66409732386495 -107.78530636850998 43.66411137468226 -107.78619730956676 43.664114220754314 -107.79029430779957 43.6641274142625 -107.7912454726602 43.66413046978637 -107.79124472581245 43.66774946861892 -107.79029254907311 43.667746432392896 -107.78530411910795 43.66773049422058 -107.7803154837038 43.66771429284182 -107.77532694645721 43.66769786251535 -107.77034201441859 43.66768723301139 -107.76599111151326 43.667677746482155 -107.76599928176243 43.66406177993355 -107.76600204937104 43.66044527933786 -107.76536482605789 43.660441720601554 -107.76095267723535 43.66043320984291 -107.76037976752744 43.6604312952967 -107.76038385503145 43.656811633534815 -107.75539905577847 43.65680054792165 -107.75540341813374 43.65318043604783</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom></topp:leases><topp:leases gml:id="leases.2"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.11.2:4267"><gml:lowerCorner>-107.76038385503497 43.65314461898675</gml:lowerCorner><gml:upperCorner>-107.74044949722713 43.66043129530163</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:meridian>6</topp:meridian><topp:township>0430N</topp:township><topp:range>0910W</topp:range><topp:section>34</topp:section><topp:surveytype>A</topp:surveytype><topp:aliquot>nene;</topp:aliquot><topp:serialnumb>WYB 0017060A</topp:serialnumb><topp:adminagenc>BUREAU OF LAND MGMT</topp:adminagenc><topp:price>0.0</topp:price><topp:acres>190.0</topp:acres><topp:dispositio>Authorized</topp:dispositio><topp:casetypeco>310781</topp:casetypeco><topp:casetype>O&g renewal lease - pd</topp:casetype><topp:commodity>Oil & gas</topp:commodity><topp:expireyear>0</topp:expireyear><topp:effectdate>8/14/1929</topp:effectdate><topp:royaltyrt>Rlty rate - 5%</topp:royaltyrt><topp:hbp>HBP</topp:hbp><topp:or>OR</topp:or><topp:name1>TEXACO EXPL & PROD INC</topp:name1><topp:perint1>100.0</topp:perint1><topp:perint2>0.0</topp:perint2><topp:perint3>0.0</topp:perint3><topp:perint4>0.0</topp:perint4><topp:updatedate>6/1/2006</topp:updatedate><topp:the_geom><gml:MultiPolygon><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>-107.74605488318316 43.65994411135142 -107.74543221894442 43.659942507723265 -107.74543182097408 43.66039495347534 -107.74044949722713 43.66038434024628 -107.74045205662398 43.65676451042827 -107.74045468122058 43.65314461898675 -107.74543785843247 43.65315677493463 -107.74543483251206 43.656775865277204 -107.74792589467117 43.656782141688055 -107.7504169506792 43.65678836105594 -107.75290800688019 43.65679449548188 -107.75539905578172 43.65680054791882 -107.76038385503497 43.6568116335444 -107.76037976752876 43.66043129530163 -107.75590467181928 43.66042401057107 -107.75539470030401 43.66042058014666 -107.75539522492454 43.65996803160492 -107.75477258519014 43.65996648396323 -107.75414984843758 43.659964934969224 -107.75352723875065 43.65996338002915 -107.7529045032101 43.65996182230788 -107.7522817671415 43.65996026343829 -107.75165902657075 43.65995861118674 -107.75103641630865 43.65995704018709 -107.75041368089654 43.65995547101946 -107.74979106335141 43.659953806253434 -107.74916845036381 43.659952225696536 -107.74854571394238 43.659950645819315 -107.74792297797997 43.659949063070066 -107.74730023769644 43.65994738546058 -107.74667762361214 43.6599457929788 -107.74605488318316 43.65994411135142</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom></topp:leases></gml:featureMembers></wfs:FeatureCollection>
\ No newline at end of file
Copied: sandbox/tschaub/feature/examples/xml/features.xml (from rev 3875, trunk/openlayers/examples/xml/features.xml)
===================================================================
--- sandbox/tschaub/feature/examples/xml/features.xml (rev 0)
+++ sandbox/tschaub/feature/examples/xml/features.xml 2007-08-08 20:32:43 UTC (rev 3876)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wfs:FeatureCollection numberOfFeatures="2" timeStamp="2007-08-03T13:10:00.071-06:00" xsi:schemaLocation="http://www.openplans.org/topp http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:leases http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:topp="http://www.openplans.org/topp" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ows="http://www.opengis.net/ows" xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMembers><topp:leases gml:id="leases.1"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.11.2:4267"><gml:lowerCorner>-107.7912454726602 43.649560413854424</gml:lowerCorner><gml:upperCorner>-107.75539905577847 43.66774946861892</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:meridian>6</topp:meridian><topp:township>0430N</topp:township><topp:range>0910W</topp:range><topp:section>27</topp:section><topp:surveytype>A</topp:surveytype><topp:aliquot>w2sw;</topp:aliquot><topp:serialnumb>WYB 0016999A</topp:serialnumb><topp:adminagenc>BUREAU OF LAND MGMT</topp:adminagenc><topp:price>0.0</topp:price><topp:acres>614.3</topp:acres><topp:dispositio>Authorized</topp:dispositio><topp:casetypeco>310781</topp:casetypeco><topp:casetype>O&g renewal lease - pd</topp:casetype><topp:commodity>Oil & gas</topp:commodity><topp:expireyear>0</topp:expireyear><topp:effectdate>6/5/1926</topp:effectdate><topp:royaltyrt>Rlty rate - 5%</topp:royaltyrt><topp:hbp>HBP</topp:hbp><topp:or>OR</topp:or><topp:name1>GAS VENTURES LLC</topp:name1><topp:perint1>100.0</topp:perint1><topp:perint2>0.0</topp:perint2><topp:perint3>0.0</topp:perint3><topp:perint4>0.0</topp:perint4><topp:updatedate>6/1/2006</topp:updatedate><topp:the_geom><gml:MultiPolygon><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>-107.75540341813374 43.65318043604783 -107.75540766903033 43.649560413854424 -107.76039213131902 43.64957232716459 -107.76537647481773 43.649584044882054 -107.76600694778301 43.649585553307226 -107.76600544447962 43.65320449790224 -107.76600393275089 43.65682260581091 -107.77035309969853 43.6568319555119 -107.77533746205971 43.65684246461631 -107.77533369030677 43.66046005010295 -107.78032119967183 43.66047517767307 -107.78114989067903 43.660477553258325 -107.7811491411714 43.66409732386495 -107.78530636850998 43.66411137468226 -107.78619730956676 43.664114220754314 -107.79029430779957 43.6641274142625 -107.7912454726602 43.66413046978637 -107.79124472581245 43.66774946861892 -107.79029254907311 43.667746432392896 -107.78530411910795 43.66773049422058 -107.7803154837038 43.66771429284182 -107.77532694645721 43.66769786251535 -107.77034201441859 43.66768723301139 -107.76599111151326 43.667677746482155 -107.76599928176243 43.66406177993355 -107.76600204937104 43.66044527933786 -107.76536482605789 43.660441720601554 -107.76095267723535 43.66043320984291 -107.76037976752744 43.6604312952967 -107.76038385503145 43.656811633534815 -107.75539905577847 43.65680054792165 -107.75540341813374 43.65318043604783</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom></topp:leases><topp:leases gml:id="leases.2"><gml:boundedBy><gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:6.11.2:4267"><gml:lowerCorner>-107.76038385503497 43.65314461898675</gml:lowerCorner><gml:upperCorner>-107.74044949722713 43.66043129530163</gml:upperCorner></gml:Envelope></gml:boundedBy><topp:meridian>6</topp:meridian><topp:township>0430N</topp:township><topp:range>0910W</topp:range><topp:section>34</topp:section><topp:surveytype>A</topp:surveytype><topp:aliquot>nene;</topp:aliquot><topp:serialnumb>WYB 0017060A</topp:serialnumb><topp:adminagenc>BUREAU OF LAND MGMT</topp:adminagenc><topp:price>0.0</topp:price><topp:acres>190.0</topp:acres><topp:dispositio>Authorized</topp:dispositio><topp:casetypeco>310781</topp:casetypeco><topp:casetype>O&g renewal lease - pd</topp:casetype><topp:commodity>Oil & gas</topp:commodity><topp:expireyear>0</topp:expireyear><topp:effectdate>8/14/1929</topp:effectdate><topp:royaltyrt>Rlty rate - 5%</topp:royaltyrt><topp:hbp>HBP</topp:hbp><topp:or>OR</topp:or><topp:name1>TEXACO EXPL & PROD INC</topp:name1><topp:perint1>100.0</topp:perint1><topp:perint2>0.0</topp:perint2><topp:perint3>0.0</topp:perint3><topp:perint4>0.0</topp:perint4><topp:updatedate>6/1/2006</topp:updatedate><topp:the_geom><gml:MultiPolygon><gml:polygonMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>-107.74605488318316 43.65994411135142 -107.74543221894442 43.659942507723265 -107.74543182097408 43.66039495347534 -107.74044949722713 43.66038434024628 -107.74045205662398 43.65676451042827 -107.74045468122058 43.65314461898675 -107.74543785843247 43.65315677493463 -107.74543483251206 43.656775865277204 -107.74792589467117 43.656782141688055 -107.7504169506792 43.65678836105594 -107.75290800688019 43.65679449548188 -107.75539905578172 43.65680054791882 -107.76038385503497 43.6568116335444 -107.76037976752876 43.66043129530163 -107.75590467181928 43.66042401057107 -107.75539470030401 43.66042058014666 -107.75539522492454 43.65996803160492 -107.75477258519014 43.65996648396323 -107.75414984843758 43.659964934969224 -107.75352723875065 43.65996338002915 -107.7529045032101 43.65996182230788 -107.7522817671415 43.65996026343829 -107.75165902657075 43.65995861118674 -107.75103641630865 43.65995704018709 -107.75041368089654 43.65995547101946 -107.74979106335141 43.659953806253434 -107.74916845036381 43.659952225696536 -107.74854571394238 43.659950645819315 -107.74792297797997 43.659949063070066 -107.74730023769644 43.65994738546058 -107.74667762361214 43.6599457929788 -107.74605488318316 43.65994411135142</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom></topp:leases></gml:featureMembers></wfs:FeatureCollection>
\ No newline at end of file
Copied: sandbox/tschaub/feature/examples/xml.html (from rev 3875, trunk/openlayers/examples/xml.html)
===================================================================
--- sandbox/tschaub/feature/examples/xml.html (rev 0)
+++ sandbox/tschaub/feature/examples/xml.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -0,0 +1,145 @@
+<!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>XML Parsing Example</title>
+ <style type="text/css">
+ body {
+ margin: 0 2em;
+ font-family: sans-serif;
+ }
+ #output {
+ font-family: monospace;
+ background-color: #efefef;
+ font-size: 0.9em;
+ padding: 1em;
+ }
+ span.code {
+ font-family: monospace;
+ background-color: #efefef;
+ font-size: 0.9em;
+ padding: 0.25em;
+ line-height: 1.5em;
+ }
+ ul {
+ margin: 0;
+ padding: 0 0 1em 1.5em;
+ }
+ ul li {
+ padding-left: 0;
+ }
+
+ </style>
+ <script src="../lib/Firebug/firebug.js" type="text/javascript"></script>
+ <script src="../lib/OpenLayers.js" type="text/javascript"></script>
+ <script type="text/javascript">
+ //<![CDATA[
+
+ var format = new OpenLayers.Format.XML();
+ var doc = null;
+
+ function init() {
+ var url = "xml/features.xml";
+ OpenLayers.loadURL(url, null, null, loadSuccess, loadFailure);
+ }
+
+ function loadSuccess(request) {
+ updateStatus("loaded");
+ if(!request.responseXML.documentElement) {
+ doc = format.read(request.responseText);
+ } else {
+ doc = request.responseXML;
+ }
+ }
+
+ function loadFailure(request) {
+ updateStatus("failed to load");
+ }
+
+ function updateStatus(msg) {
+ document.getElementById("loadStatus").firstChild.nodeValue = msg;
+ }
+
+ function updateOutput(text) {
+ document.getElementById("output").firstChild.nodeValue = text;
+ }
+
+ function write() {
+ var text = format.write(doc);
+ updateOutput(text);
+ }
+
+ function getElementsByTagNameNS(node, uri, name) {
+ var nodes = format.getElementsByTagNameNS(node, uri, name);
+ var pieces = [];
+ for(var i=0; i<nodes.length; ++i) {
+ pieces.push(format.write(nodes[i]));
+ }
+ updateOutput(pieces.join(' '));
+ }
+
+ function hasAttributeNS(node, uri, name) {
+ updateOutput(format.hasAttributeNS(node, uri, name))
+ }
+
+ function getAttributeNodeNS(node, uri, name) {
+ var attributeNode = format.getAttributeNodeNS(node, uri, name);
+ updateOutput(attributeNode.nodeName + ' = "' +
+ attributeNode.nodeValue + '"');
+ }
+
+ function getAttributeNS(node, uri, name) {
+ var attributeValue = format.getAttributeNS(node, uri, name);
+ updateOutput('"' + attributeValue + '"')
+ }
+
+ function createElementNS(uri, name) {
+ var node = format.createElementNS(uri, name);
+ doc.documentElement.appendChild(node);
+ write();
+ }
+
+ function createTextNode(text) {
+ var node = format.createTextNode(text);
+ doc.documentElement.appendChild(node);
+ write();
+ }
+
+ window.onload = init;
+
+ //]]>
+ </script>
+ </head>
+ <body>
+ <h3>OpenLayers XML Example</h3>
+ <p>OpenLayers has a very simple XML format class (OpenLayers.Format.XML)
+ that can be used to read/write XML docs. The methods available on the
+ XML format (or parser if you like) allow for reading and writing of the
+ various XML flavors used by the library - in particular the vector data
+ formats. It is by no means intended to be a full-fledged XML toolset.
+ Additional methods will be added only as needed elsewhere in the
+ library.</p>
+ <p>This page loads an XML document and demonstrates a few of the methods
+ available in the parser.</p>
+ <p>Status: <b>XML document <span id="loadStatus">loading..</span>.</b></p>
+ <p>After the XML document loads, see the result of a few of the methods
+ below. Assume that you start with the following code:
+ <br />
+ <span class="code">
+ var format = new OpenLayers.Format.XML();
+ </span>
+ </p>
+ Sample methods
+ <ul>
+ <li><a href="javascript:void write();">format.write()</a> - write the XML doc as text</li>
+ <li><a href="javascript:void getElementsByTagNameNS(doc, 'http://www.opengis.net/gml', 'MultiPolygon');">format.getElementsByTagNameNS()</a> - get all gml:MultiPolygon</li>
+ <li><a href="javascript:void hasAttributeNS(doc.documentElement, 'http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation');">format.hasAttributeNS()</a> - test to see schemaLocation attribute exists in the http://www.w3.org/2001/XMLSchema-instance namespace</li>
+ <li><a href="javascript:void getAttributeNodeNS(doc.documentElement, 'http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation');">format.getAttributeNodeNS()</a> - get schemaLocation attribute in the http://www.w3.org/2001/XMLSchema-instance namespace</li>
+ <li><a href="javascript:void getAttributeNS(doc.documentElement, 'http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation');">format.getAttributeNS()</a> - get schemaLocation attribute value in the http://www.w3.org/2001/XMLSchema-instance namespace</li>
+ <li><a href="javascript:void createElementNS('http://bar.com/foo', 'foo:TestNode');">format.createElementNS()</a> - create a foo:TestNode element (and append it to the doc)</li>
+ <li><a href="javascript:void createTextNode('test text ');">format.createTextNode()</a> - create a text node (and append it to the doc)</li>
+ </ul>
+ Output:
+ <div id="output"> </div>
+ </body>
+</html>
Modified: sandbox/tschaub/feature/lib/OpenLayers/Ajax.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Ajax.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Ajax.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -183,6 +183,7 @@
* json - {?}
*/
dispatch: function(callback, request, transport, json) {
+ var responder;
for (var i = 0; i < this.responders.length; i++) {
responder = this.responders[i];
Modified: sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Bounds.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Bounds.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Bounds.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -429,7 +429,7 @@
* merely a copy of this one.
*/
wrapDateLine: function(maxExtent, options) {
- options = options || new Object();
+ options = options || {};
var leftTolerance = options.leftTolerance || 0;
var rightTolerance = options.rightTolerance || 0;
@@ -480,7 +480,7 @@
* from an array
*
* Parameters:
- * bbox - {Array} Array of bounds values (ex. <i>[5,42,10,45]</i>)
+ * bbox - {Array(Float)} Array of bounds values (ex. <i>[5,42,10,45]</i>)
*
* Return:
* {<OpenLayers.Bounds>} New <OpenLayers.Bounds> object built from the
Modified: sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Class.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Class.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/BaseTypes/Class.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -32,7 +32,7 @@
this.initialize.apply(this, arguments);
}
}
- var extended = new Object();
+ var extended = {};
var parent;
for(var i=0; i<arguments.length; ++i) {
if(typeof arguments[i] == "function") {
Modified: sandbox/tschaub/feature/lib/OpenLayers/BaseTypes.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/BaseTypes.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/BaseTypes.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -15,10 +15,11 @@
/**
- * APIFunction: String.startsWith
+ * APIMethod: String.startsWith
+ * Whether or not a string starts with another string.
*
* Parameters:
- * sStart - {Sring}
+ * sStart - {Sring} The string we're testing for.
*
* Return:
* {Boolean} Whether or not this string starts with the string passed in.
@@ -28,10 +29,11 @@
};
/**
- * APIFunction: String.contains
+ * APIMethod: String.contains
+ * Whether or not a string contains another string.
*
* Parameters:
- * str - {String}
+ * str - {String} The string that we're testing for.
*
* Return:
* {Boolean} Whether or not this string contains with the string passed in.
@@ -42,6 +44,7 @@
/**
* APIMethod: String.trim
+ * Removes leading and trailing whitespace characters from a string.
*
* Return:
* {String} A trimmed version of the string - all leading and
@@ -63,7 +66,8 @@
};
/**
- * APIFunction: String.indexOf
+ * APIMethod: String.indexOf
+ * Index of a character in a string.
*
* Parameters:
* object - {Object} Can be a string or a number
@@ -72,30 +76,32 @@
* {Integer} The index of the encountered object, or -1 if not found.
*/
String.indexOf = function(object) {
- for (var i = 0; i < this.length; i++)
- if (this[i] == object) return i;
- return -1;
+ var index = -1;
+ for (var i = 0; i < this.length; i++) {
+ if (this[i] == object) {
+ index = i;
+ break;
+ }
+ }
+ return index;
};
/**
- * APIFunction: camelize
+ * APIMethod: camelize
+ * Camel-case a hyphenated string.
+ * Ex. "chicken-head" becomes "chickenHead", and
+ * "-chicken-head" becomes "ChickenHead".
*
* Return:
* {String} The string, camelized
*/
String.prototype.camelize = function() {
var oStringList = this.split('-');
- if (oStringList.length == 1) return oStringList[0];
-
- var camelizedString = this.indexOf('-') == 0
- ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
- : oStringList[0];
-
- for (var i = 1, len = oStringList.length; i < len; i++) {
- var s = oStringList[i];
- camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
+ var camelizedString = oStringList[0];
+ for (var i = 1; i < oStringList.length; i++) {
+ var s = oStringList[i];
+ camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
}
-
return camelizedString;
};
@@ -107,15 +113,16 @@
*********************/
/**
- * APIFunction: Number.limitSigDigs
- * Works only with integer values does *not* work with floats!
+ * APIMethod: Number.limitSigDigs
+ * Limit the number of significant digits on an integer. Does *not* work
+ * with floats!
*
* Parameters:
* sig - {Integer}
*
* Return:
* {Integer} The number, rounded to the specified number of significant digits.
- * If null, 0, or negaive value passed in, returns 0
+ * If null, 0, or negative value passed in, returns 0
*/
Number.prototype.limitSigDigs = function(sig) {
var number = (sig > 0) ? this.toString() : 0;
@@ -134,37 +141,48 @@
*********************/
/**
- * APIFunction: Function.bind
+ * APIMethod: Function.bind
+ * Bind a function to an object.
+ * Method to easily create closures with 'this' altered.
*
* Parameters:
- * object - {Object}
+ * object - {Object} the this parameter
*
* Return:
- * {Function}
+ * {Function} A closure with 'this' altered to the first
+ * argument.
*/
Function.prototype.bind = function() {
- var __method = this, args = [], object = arguments[0];
- for (var i = 1; i < arguments.length; i++)
- args.push(arguments[i]);
- return function(moreargs) {
- for (var i = 0; i < arguments.length; i++)
- args.push(arguments[i]);
- return __method.apply(object, args);
- }
+ var __method = this;
+ var args = [];
+ var object = arguments[0];
+
+ for (var i = 1; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+
+ return function(moreargs) {
+ for (var i = 0; i < arguments.length; i++) {
+ args.push(arguments[i]);
+ }
+ return __method.apply(object, args);
+ };
};
/**
- * APIFunction: Function.bindAsEventListener
- *
+ * APIMethod: Function.bindAsEventListener
+ * Bind a function to an object, and configure it to receive the event object
+ * as first parameter when called.
+ *
* Parameters:
- * object - {Object}
+ * object - {Object} A reference to this.
*
* Return:
* {Function}
*/
Function.prototype.bindAsEventListener = function(object) {
- var __method = this;
- return function(event) {
- return __method.call(object, event || window.event);
- }
-};
\ No newline at end of file
+ var __method = this;
+ return function(event) {
+ return __method.call(object, event || window.event);
+ };
+};
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/ArgParser.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/ArgParser.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/ArgParser.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -27,7 +27,7 @@
/**
* Parameter: layers
- * {Array}
+ * {Array(<OpenLayers.Layer>)}
*/
layers: null,
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/EditingToolbar.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/EditingToolbar.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/EditingToolbar.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -6,6 +6,9 @@
* @requires OpenLayers/Control/Panel.js
* @requires OpenLayers/Control/Navigation.js
* @requires OpenLayers/Control/DrawFeature.js
+ * @requires OpenLayers/Handler/Point.js
+ * @requires OpenLayers/Handler/Path.js
+ * @requires OpenLayers/Handler/Polygon.js
*
* Class: OpenLayers.Control.EditingToolbar
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/LayerSwitcher.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/LayerSwitcher.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/LayerSwitcher.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -34,7 +34,7 @@
/**
* Property: baseLayers
- * {Array}
+ * {Array(<OpenLayers.Layer>)}
*/
baseLayers: null,
@@ -53,7 +53,7 @@
/**
* Property: dataLayers
- * {Array}
+ * {Array(<OpenLayers.Layer>)}
*/
dataLayers: null,
@@ -165,7 +165,7 @@
}
}
this[layersType + "LayersDiv"].innerHTML = "";
- this[layersType + "Layers"] = new Array();
+ this[layersType + "Layers"] = [];
},
@@ -185,6 +185,7 @@
this.clearLayersArray("data");
var containsOverlays = false;
+ var containsBaseLayers = false;
var layers = this.map.layers.slice();
if (!this.ascending) { layers.reverse(); }
@@ -192,11 +193,13 @@
var layer = layers[i];
var baseLayer = layer.isBaseLayer;
- if (baseLayer || layer.displayInLayerSwitcher) {
+ if (layer.displayInLayerSwitcher) {
- if (!baseLayer) {
+ if (baseLayer) {
+ containsBaseLayers = true;
+ } else {
containsOverlays = true;
- }
+ }
// only check a baselayer if it is *the* baselayer, check data
// layers if they are visible
@@ -256,6 +259,9 @@
// if no overlays, dont display the overlay label
this.dataLbl.style.display = (containsOverlays) ? "" : "none";
+
+ // if no baselayers, dont display the baselayer label
+ this.baseLbl.style.display = (containsBaseLayers) ? "" : "none";
return this.div;
},
@@ -426,11 +432,11 @@
this.layersDiv.style.height = "100%";
- var baseLbl = document.createElement("div");
- baseLbl.innerHTML = "<u>Base Layer</u>";
- baseLbl.style.marginTop = "3px";
- baseLbl.style.marginLeft = "3px";
- baseLbl.style.marginBottom = "3px";
+ this.baseLbl = document.createElement("div");
+ this.baseLbl.innerHTML = "<u>Base Layer</u>";
+ this.baseLbl.style.marginTop = "3px";
+ this.baseLbl.style.marginLeft = "3px";
+ this.baseLbl.style.marginBottom = "3px";
this.baseLayersDiv = document.createElement("div");
this.baseLayersDiv.style.paddingLeft = "10px";
@@ -449,14 +455,14 @@
this.dataLayersDiv.style.paddingLeft = "10px";
if (this.ascending) {
- this.layersDiv.appendChild(baseLbl);
+ this.layersDiv.appendChild(this.baseLbl);
this.layersDiv.appendChild(this.baseLayersDiv);
this.layersDiv.appendChild(this.dataLbl);
this.layersDiv.appendChild(this.dataLayersDiv);
} else {
this.layersDiv.appendChild(this.dataLbl);
this.layersDiv.appendChild(this.dataLayersDiv);
- this.layersDiv.appendChild(baseLbl);
+ this.layersDiv.appendChild(this.baseLbl);
this.layersDiv.appendChild(this.baseLayersDiv);
}
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/MouseToolbar.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/MouseToolbar.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/MouseToolbar.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -74,7 +74,7 @@
draw: function() {
OpenLayers.Control.prototype.draw.apply(this, arguments);
OpenLayers.Control.MouseDefaults.prototype.draw.apply(this, arguments);
- this.buttons = new Object();
+ this.buttons = {};
var sz = new OpenLayers.Size(28,28);
var centered = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);
this._addButton("zoombox", "drag-rectangle-off.png", "drag-rectangle-on.png", centered, sz, "Shift->Drag to zoom to area");
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/OverviewMap.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/OverviewMap.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/OverviewMap.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -83,7 +83,7 @@
* control, set <mapOptions> as one of the options properties.
*/
initialize: function(options) {
- this.layers = new Array();
+ this.layers = [];
OpenLayers.Control.prototype.initialize.apply(this, [options]);
},
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoom.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoom.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoom.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -69,7 +69,7 @@
px = this.position;
// place the controls
- this.buttons = new Array();
+ this.buttons = [];
var sz = new OpenLayers.Size(18,18);
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoomBar.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Control/PanZoomBar.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -111,7 +111,7 @@
px = this.position.clone();
// place the controls
- this.buttons = new Array();
+ this.buttons = [];
var sz = new OpenLayers.Size(18,18);
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Events.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Events.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Events.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -171,7 +171,7 @@
//if observers cache has not yet been created, create it
if (!this.observers) {
- this.observers = new Object();
+ this.observers = {};
}
//if not already assigned, make a new unique cache ID
@@ -187,7 +187,7 @@
//if there is not yet a hash entry for this element, add one
if (!this.observers[cacheID]) {
- this.observers[cacheID] = new Array();
+ this.observers[cacheID] = [];
}
//add a new observer to this element's list
@@ -337,7 +337,7 @@
/**
* Constant: BROWSER_EVENTS
- * {Array} supported events
+ * {Array(String)} supported events
*/
BROWSER_EVENTS: [
"mouseover", "mouseout",
@@ -366,7 +366,7 @@
/**
* Property: eventTypes
- * {Array} list of support application events
+ * {Array(String)} list of support application events
*/
eventTypes: null,
@@ -389,7 +389,7 @@
* Parameters:
* object - {Object} The js object to which this Events object is being
* added element - {DOMElement} A dom element to respond to browser events
- * eventTypes - {Array} Array of custom application events
+ * eventTypes - {Array(String)} Array of custom application events
* fallThrough - {Boolean} Allow events to fall through after these have
* been handled?
*/
@@ -398,7 +398,7 @@
this.element = element;
this.eventTypes = eventTypes;
this.fallThrough = fallThrough;
- this.listeners = new Object();
+ this.listeners = {};
// keep a bound copy of handleBrowserEvent() so that we can
// pass the same function to both Event.observe() and .stopObserving()
@@ -445,7 +445,7 @@
*/
addEventType: function(eventName) {
if (!this.listeners[eventName]) {
- this.listeners[eventName] = new Array();
+ this.listeners[eventName] = [];
}
},
@@ -573,7 +573,7 @@
*/
remove: function(type) {
if (this.listeners[type] != null) {
- this.listeners[type] = new Array();
+ this.listeners[type] = [];
}
},
@@ -589,7 +589,7 @@
// prep evt object with object & div references
if (evt == null) {
- evt = new Object();
+ evt = {};
}
evt.object = this.object;
evt.element = this.element;
Modified: sandbox/tschaub/feature/lib/OpenLayers/Feature/Vector.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Feature/Vector.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Feature/Vector.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -74,7 +74,7 @@
this.lonlat = null;
this.geometry = geometry;
this.state = null;
- this.attributes = new Object();
+ this.attributes = {};
if (attributes) {
this.attributes = OpenLayers.Util.extend(this.attributes,
attributes);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Feature.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Feature.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Feature.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -70,7 +70,7 @@
initialize: function(layer, lonlat, data) {
this.layer = layer;
this.lonlat = lonlat;
- this.data = (data != null) ? data : new Object();
+ this.data = (data != null) ? data : {};
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
},
Modified: sandbox/tschaub/feature/lib/OpenLayers/Format/GML.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Format/GML.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Format/GML.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -333,7 +333,7 @@
while (nums[nums.length-1] == "")
nums.pop();
- for(i = 0; i < nums.length; i = i + this.dim) {
+ for(var i = 0; i < nums.length; i = i + this.dim) {
x = parseFloat(nums[i]);
y = parseFloat(nums[i+1]);
p.points.push(new OpenLayers.Geometry.Point(x, y));
Modified: sandbox/tschaub/feature/lib/OpenLayers/Format/WFS.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Format/WFS.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Format/WFS.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -52,7 +52,7 @@
* Takes a feature list, and generates a WFS-T Transaction
*
* Parameters:
- * features - {Array}
+ * features - {Array(<OpenLayers.Feature.Vector>)}
*/
write: function(features) {
Copied: sandbox/tschaub/feature/lib/OpenLayers/Format/XML.js (from rev 3875, trunk/openlayers/lib/OpenLayers/Format/XML.js)
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Format/XML.js (rev 0)
+++ sandbox/tschaub/feature/lib/OpenLayers/Format/XML.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -0,0 +1,285 @@
+/* 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. */
+
+/**
+ * @requires OpenLayers/Format.js
+ *
+ * Class: OpenLayers.Format.XML
+ * Read and write XML. For cross-browser XML generation, use methods on an
+ * instance of the XML format class instead of on <code>document<end>.
+ * The DOM creation and traversing methods exposed here all mimic the
+ * W3C XML DOM methods. Create a new parser with the
+ * <OpenLayers.Format.XML> constructor.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format>
+ */
+OpenLayers.Format.XML = OpenLayers.Class.create();
+OpenLayers.Format.XML.prototype =
+ OpenLayers.Class.inherit(OpenLayers.Format, {
+
+ /**
+ * Property: xmldom
+ * {XMLDom} If this browser uses ActiveX, this will be set to a XMLDOM
+ * object. It is not intended to be a browser sniffing property.
+ * Instead, the xmldom property is used instead of <code>document<end>
+ * where namespaced node creation methods are not supported. In all
+ * other browsers, this remains null.
+ */
+ xmldom: null,
+
+ /**
+ * Constructor: OpenLayers.Format.XML
+ * Construct an XML parser. The parser is used to read and write XML.
+ * Reading XML from a string returns a DOM element. Writing XML from
+ * a DOM element returns a string.
+ *
+ * Parameters:
+ * options - {Object} Optional object whose properties will be set on
+ * the object.
+ */
+ initialize: function(options) {
+ if(window.ActiveXObject) {
+ this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
+ }
+ OpenLayers.Format.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * APIMethod: read
+ * Deserialize a XML string and return a DOM node.
+ *
+ * Parameters:
+ * text - {String} A XML string
+
+ * Returns:
+ * {DOMElement} A DOM node
+ */
+ read: function(text) {
+ var index = text.indexOf('<');
+ if(index > 0) {
+ text = text.substring(index);
+ }
+ var node = OpenLayers.Util.Try(
+ (function() {
+ var xmldom;
+ /**
+ * Since we want to be able to call this method on the prototype
+ * itself, this.xmldom may not exist even if in IE.
+ */
+ if(window.ActiveXObject && !this.xmldom) {
+ xmldom = new ActiveXObject("Microsoft.XMLDOM");
+ } else {
+ xmldom = this.xmldom;
+
+ }
+ xmldom.loadXML(text);
+ return xmldom;
+ }).bind(this),
+ function() {
+ return new DOMParser().parseFromString(text, 'text/xml');
+ },
+ function() {
+ var req = new XMLHttpRequest();
+ req.open("GET", "data:" + "text/xml" +
+ ";charset=utf-8," + encodeURIComponent(text), false);
+ if(req.overrideMimeType) {
+ req.overrideMimeType("text/xml");
+ }
+ req.send(null);
+ return req.responseXML;
+ }
+ );
+ return node;
+ },
+
+ /**
+ * APIMethod: write
+ * Serialize a DOM node into a XML string.
+ *
+ * Parameters:
+ * node - {DOMElement} A DOM node.
+ *
+ * Returns:
+ * {String} The XML string representation of the input node.
+ */
+ write: function(node) {
+ var data;
+ if(this.xmldom) {
+ data = node.xml;
+ } else {
+ var serializer = new XMLSerializer();
+ data = serializer.serializeToString(node);
+ }
+ return data;
+ },
+
+ /**
+ * APIMethod: createElementNS
+ * Create a new element with namespace. This node can be appended to
+ * another node with the standard node.appendChild method. For
+ * cross-browser support, this method must be used instead of
+ * document.createElementNS.
+ *
+ * Parameters:
+ * uri - {String} Namespace URI for the element.
+ * name - {String} The qualified name of the element (prefix:localname).
+ *
+ * Returns:
+ * {Element} A DOM element with namespace.
+ */
+ createElementNS: function(uri, name) {
+ var element;
+ if(this.xmldom) {
+ element = this.xmldom.createNode(1, name, uri);
+ } else {
+ element = document.createElementNS(uri, name);
+ }
+ return element;
+ },
+
+ /**
+ * APIMethod: createTextNode
+ * Create a text node. This node can be appended to another node with
+ * the standard node.appendChild method. For cross-browser support,
+ * this method must be used instead of document.createTextNode.
+ *
+ * Parameters:
+ * text - {String} The text of the node.
+ *
+ * Returns:
+ * {DOMElement} A DOM text node.
+ */
+ createTextNode: function(text) {
+ var node;
+ if(this.xmldom) {
+ node = this.xmldom.createTextNode(text);
+ } else {
+ node = document.createTextNode(text);
+ }
+ return node;
+ },
+
+ /**
+ * APIMethod: getElementsByTagNameNS
+ * Get a list of elements on a node given the namespace URI and local name.
+ * To return all nodes in a given namespace, use '*' for the name
+ * argument. To return all nodes of a given (local) name, regardless
+ * of namespace, use '*' for the uri argument.
+ *
+ * Parameters:
+ * node - {Element} Node on which to search for other nodes.
+ * uri - {String} Namespace URI.
+ * name - {String} Local name of the tag (without the prefix).
+ *
+ * Returns:
+ * {NodeList} A node list or array of elements.
+ */
+ getElementsByTagNameNS: function(node, uri, name) {
+ var elements = [];
+ if(node.getElementsByTagNameNS) {
+ elements = node.getElementsByTagNameNS(uri, name);
+ } else {
+ // brute force method
+ var allNodes = node.getElementsByTagName("*");
+ var potentialNode, fullName;
+ for(var i=0; i<allNodes.length; ++i) {
+ potentialNode = allNodes[i];
+ fullName = (potentialNode.prefix) ?
+ (potentialNode.prefix + ":" + name) : name;
+ if((name == "*") || (fullName == potentialNode.nodeName)) {
+ if((uri == "*") || (uri == potentialNode.namespaceURI)) {
+ elements.push(potentialNode);
+ }
+ }
+ }
+ }
+ return elements;
+ },
+
+ /**
+ * APIMethod: getAttributeNodeNS
+ * Get an attribute node given the namespace URI and local name.
+ *
+ * Parameters:
+ * node - {Element} Node on which to search for attribute nodes.
+ * uri - {String} Namespace URI.
+ * name - {String} Local name of the attribute (without the prefix).
+ *
+ * Returns:
+ * {DOMElement} An attribute node or null if none found.
+ */
+ getAttributeNodeNS: function(node, uri, name) {
+ var attributeNode = null;
+ if(node.getAttributeNodeNS) {
+ attributeNode = node.getAttributeNodeNS(uri, name);
+ } else {
+ var attributes = node.attributes;
+ var potentialNode, fullName;
+ for(var i=0; i<attributes.length; ++i) {
+ potentialNode = attributes[i];
+ if(potentialNode.namespaceURI == uri) {
+ fullName = (potentialNode.prefix) ?
+ (potentialNode.prefix + ":" + name) : name;
+ if(fullName == potentialNode.nodeName) {
+ attributeNode = potentialNode;
+ break;
+ }
+ }
+ }
+ }
+ return attributeNode;
+ },
+
+ /**
+ * APIMethod: getAttributeNS
+ * Get an attribute value given the namespace URI and local name.
+ *
+ * Parameters:
+ * node - {Element} Node on which to search for an attribute.
+ * uri - {String} Namespace URI.
+ * name - {String} Local name of the attribute (without the prefix).
+ *
+ * Returns:
+ * {String} An attribute value or and empty string if none found.
+ */
+ getAttributeNS: function(node, uri, name) {
+ var attributeValue = "";
+ if(node.getAttributeNS) {
+ attributeValue = node.getAttributeNS(uri, name);
+ } else {
+ var attributeNode = this.getAttributeNodeNS(node, uri, name);
+ if(attributeNode) {
+ attributeValue = attributeNode.nodeValue;
+ }
+ }
+ return attributeValue;
+ },
+
+ /**
+ * APIMethod: hasAttributeNS
+ * Determine whether a node has a particular attribute matching the given
+ * name and namespace.
+ *
+ * Parameters:
+ * node - {Element} Node on which to search for an attribute.
+ * uri - {String} Namespace URI.
+ * name - {String} Local name of the attribute (without the prefix).
+ *
+ * Returns:
+ * {Boolean} The node has an attribute matching the name and namespace.
+ */
+ hasAttributeNS: function(node, uri, name) {
+ var found = false;
+ if(node.hasAttributeNS) {
+ found = node.hasAttributeNS(uri, name);
+ } else {
+ found = !!this.getAttributeNodeNS(node, uri, name);
+ }
+ return found;
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XML"
+
+});
Modified: sandbox/tschaub/feature/lib/OpenLayers/Geometry/Collection.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Geometry/Collection.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Geometry/Collection.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -48,7 +48,7 @@
*/
initialize: function (components) {
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
- this.components = new Array();
+ this.components = [];
if (components != null) {
this.addComponents(components);
}
@@ -250,7 +250,7 @@
* Parameters:
* angle - {Float} Rotation angle in radians (measured counterclockwise
* from the positive x-axis)
- * origin - {OpenLayers.Geometry.Point} Center point for the rotation
+ * origin - {<OpenLayers.Geometry.Point>} Center point for the rotation
*/
rotate: function(angle, origin) {
for(var i=0; i<this.components.length; ++i) {
@@ -268,7 +268,7 @@
* doubles the size of the geometry in each dimension
* (lines, for example, will be twice as long, and polygons
* will have four times the area).
- * origin - {OpenLayers.Geometry.Point} Point of origin for resizing
+ * origin - {<OpenLayers.Geometry.Point>} Point of origin for resizing
*/
resize: function(scale, origin) {
for(var i=0; i<this.components.length; ++i) {
Modified: sandbox/tschaub/feature/lib/OpenLayers/Geometry/MultiLineString.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Geometry/MultiLineString.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Geometry/MultiLineString.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -29,7 +29,7 @@
* Constructor for a MultiLineString Geometry.
*
* Parameters:
- * components - {Array(OpenLayers.Geometry.LineString)}
+ * components - {Array(<OpenLayers.Geometry.LineString>)}
*
*/
initialize: function(components) {
Modified: sandbox/tschaub/feature/lib/OpenLayers/Geometry/Point.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Geometry/Point.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Geometry/Point.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -137,7 +137,7 @@
* Parameters:
* angle - {Float} Rotation angle in radians (measured counterclockwise
* from the positive x-axis)
- * origin - {OpenLayers.Geometry.Point} Center point for the rotation
+ * origin - {<OpenLayers.Geometry.Point>} Center point for the rotation
*/
rotate: function(angle, origin) {
var radius = this.distanceTo(origin);
@@ -156,7 +156,7 @@
* scale - {Float} Ratio of the new distance from the origin to the old
* distance from the origin. A scale of 2 doubles the
* distance between the point and origin.
- * origin - {OpenLayers.Geometry.Point} Point of origin for resizing
+ * origin - {<OpenLayers.Geometry.Point>} Point of origin for resizing
*/
resize: function(scale, origin) {
this.x = origin.x + (scale * (this.x - origin.x));
Modified: sandbox/tschaub/feature/lib/OpenLayers/Handler/Feature.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Handler/Feature.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Handler/Feature.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -38,11 +38,10 @@
*
* Parameters:
* control - {<OpenLayers.Control>}
- * layers - {Array} List of OpenLayers.Layer.Vector
- * callbacks - {Array} An object with a 'over' property whos value is
- * a function to be called when the mouse is over
- * a feature. The callback should expect to recieve
- * a single argument, the feature.
+ * layers - {Array(<OpenLayers.Layer.Vector>)}
+ * callbacks - {Object} An object with a 'over' property whos value is
+ * a function to be called when the mouse is over a feature. The
+ * callback should expect to recieve a single argument, the feature.
* options - {Object}
*/
initialize: function(control, layer, callbacks, options) {
Modified: sandbox/tschaub/feature/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Handler/Path.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Handler/Path.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -47,14 +47,14 @@
*
* Parameters:
* control - {<OpenLayers.Control>}
- * callbacks - {Array} An object with a 'done' property whos value is a
- * function to be called when the path drawing is finished. The callback
- * should expect to recieve a single argument, the line string geometry.
- * If the callbacks object contains a 'point' property, this function will
- * be sent each point as they are added. If the callbacks object contains
- * a 'cancel' property, this function will be called when the handler is
- * deactivated while drawing. The cancel should expect to receive a
- * geometry.
+ * callbacks - {Object} An object with a 'done' property whos value is a
+ * function to be called when the path drawing is finished. The
+ * callback should expect to recieve a single argument, the line
+ * string geometry. If the callbacks object contains a 'point'
+ * property, this function will be sent each point as they are added.
+ * If the callbacks object contains a 'cancel' property, this function
+ * will be called when the handler is deactivated while drawing. The
+ * cancel should expect to receive a geometry.
* options - {Object} An optional object with properties to be set on the
* handler
*/
Modified: sandbox/tschaub/feature/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Handler/Point.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Handler/Point.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -69,7 +69,7 @@
*
* Parameters:
* control - {<OpenLayers.Control>} The control that owns this handler
- * callbacks - {Array} An object with a 'done' property whos value is a
+ * callbacks - {Object} An object with a 'done' property whos value is a
* function to be called when the point drawing is finished.
* The callback should expect to recieve a single argument,
* the point geometry. If the callbacks object contains a
Modified: sandbox/tschaub/feature/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Handler/Polygon.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Handler/Polygon.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -29,7 +29,7 @@
*
* Parameters:
* control - {<OpenLayers.Control>}
- * callbacks - {Array} An object with a 'done' property whos value is
+ * callbacks - {Object} An object with a 'done' property whos value is
* a function to be called when the path drawing is
* finished. The callback should expect to recieve a
* single argument, the polygon geometry.
Modified: sandbox/tschaub/feature/lib/OpenLayers/Handler.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Handler.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Handler.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -183,8 +183,8 @@
* Parameters:
* name - {String} The key for the callback that is one of the properties
* of the handler's callbacks object.
- * args - {Array} An array of arguments with which to call the callback
- * (defined by the control).
+ * args - {Array(*)} An array of arguments (any type) with which to call
+ * the callback (defined by the control).
*/
callback: function (name, args) {
if (this.callbacks[name]) {
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/GML.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/GML.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/GML.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -38,7 +38,7 @@
* options - {Object} Hashtable of extra options to tag onto the layer.
*/
initialize: function(name, url, options) {
- var newArguments = new Array()
+ var newArguments = [];
newArguments.push(name, options);
OpenLayers.Layer.Vector.prototype.initialize.apply(this, newArguments);
this.url = url;
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/GeoRSS.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/GeoRSS.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/GeoRSS.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -53,7 +53,7 @@
initialize: function(name, location, options) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name, options]);
this.location = location;
- this.features = new Array();
+ this.features = [];
OpenLayers.loadURL(location, null, this, this.parseData);
},
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/Google.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/Google.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/Google.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -7,7 +7,7 @@
* @requires OpenLayers/Layer/EventPane.js
* @requires OpenLayers/Layer/FixedZoomLevels.js
*
- * Class: OpenLayers.Layer.Gooogle
+ * Class: OpenLayers.Layer.Google
*
* Inherits:
* - <OpenLayers.Layer.EventPane>
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/Grid.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/Grid.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -23,7 +23,8 @@
/**
* Property: grid
- * {Array} This is an array of rows, each row is an array of tiles
+ * {Array(Array(<OpenLayers.Tile>))} This is an array of rows, each row is
+ * an array of tiles.
*/
grid: null,
@@ -68,7 +69,7 @@
//
this.events.addEventType("tileloaded");
- this.grid = new Array();
+ this.grid = [];
},
/**
@@ -129,7 +130,7 @@
}
// we do not want to copy reference to grid, so we make a new array
- obj.grid = new Array();
+ obj.grid = [];
return obj;
},
@@ -195,8 +196,8 @@
setTileSize: function(size) {
if (this.singleTile) {
var size = this.map.getSize().clone();
- size.h = size.h * this.ratio;
- size.w = size.w * this.ratio;
+ size.h = parseInt(size.h * this.ratio);
+ size.w = parseInt(size.w * this.ratio);
}
OpenLayers.Layer.HTTPRequest.prototype.setTileSize.apply(this, [size]);
},
@@ -267,9 +268,9 @@
var ul = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
var px = this.map.getLayerPxFromLonLat(ul);
-
+
if (!this.grid.length) {
- this.grid[0] = new Array();
+ this.grid[0] = [];
}
var tile = this.grid[0][0];
@@ -331,7 +332,7 @@
do {
var row = this.grid[rowidx++];
if (!row) {
- row = new Array();
+ row = [];
this.grid.push(row);
}
@@ -390,7 +391,7 @@
* outside-in to inside-out), calling draw() on each tile.
*/
spiralTileLoad: function() {
- var tileQueue = new Array();
+ var tileQueue = [];
var directions = ["right", "down", "left", "up"];
@@ -650,5 +651,18 @@
}
},
+ /**
+ * Method: onMapResize
+ * For singleTile layers, this will replace the tile with the
+ * a new one with updated tileSize and extent.
+ */
+ onMapResize: function() {
+ if (this.singleTile) {
+ this.clearGrid();
+ this.setTileSize();
+ this.initSingleTile(this.map.getExtent());
+ }
+ },
+
CLASS_NAME: "OpenLayers.Layer.Grid"
});
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/HTTPRequest.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/HTTPRequest.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/HTTPRequest.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -56,7 +56,7 @@
newArguments = [name, options];
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
this.url = url;
- this.params = OpenLayers.Util.extend( new Object(), params);
+ this.params = OpenLayers.Util.extend( {}, params);
},
/**
@@ -167,7 +167,7 @@
// create a new params hashtable with all the layer params and the
// new params together. then convert to string
- var allParams = OpenLayers.Util.extend(new Object(), this.params);
+ var allParams = OpenLayers.Util.extend({}, this.params);
allParams = OpenLayers.Util.extend(allParams, newParams);
var paramsString = OpenLayers.Util.getParameterString(allParams);
@@ -201,7 +201,8 @@
//serverPath has no ? -- add one
requestString += '?' + paramsString;
} else {
- //serverPath contains ?, so must already have paramsString at the end
+ //serverPath contains ?, so must already have
+ // paramsString at the end
requestString += '&' + paramsString;
}
}
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/KaMap.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/KaMap.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/KaMap.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -59,7 +59,7 @@
* extends, can be overridden through the options parameter.
*/
initialize: function(name, url, params, options) {
- var newArguments = new Array();
+ var newArguments = [];
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
this.params = (params ? params : {});
@@ -150,7 +150,7 @@
row = this.grid[rowidx++];
if (!row) {
- row = new Array();
+ row = [];
this.grid.push(row);
}
@@ -221,7 +221,7 @@
}
// we do not want to copy reference to grid, so we make a new array
- obj.grid = new Array();
+ obj.grid = [];
return obj;
},
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/MapServer.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/MapServer.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/MapServer.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -36,7 +36,7 @@
* options - {Ojbect} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, params, options) {
- var newArguments = new Array();
+ var newArguments = [];
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
@@ -153,7 +153,7 @@
// create a new params hashtable with all the layer params and the
// new params together. then convert to string
- var allParams = OpenLayers.Util.extend(new Object(), this.params);
+ var allParams = OpenLayers.Util.extend({}, this.params);
allParams = OpenLayers.Util.extend(allParams, newParams);
// ignore parameters that are already in the url search string
var urlParams = OpenLayers.Util.upperCaseObject(
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/Markers.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/Markers.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/Markers.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -45,7 +45,7 @@
*/
initialize: function(name, options) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
- this.markers = new Array();
+ this.markers = [];
},
/**
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/TMS.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/TMS.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/TMS.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -41,7 +41,7 @@
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
- var newArguments = new Array();
+ var newArguments = [];
newArguments.push(name, url, {}, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
},
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/Text.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/Text.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/Text.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -5,6 +5,7 @@
/**
* @requires OpenLayers/Layer/Markers.js
+ * @requires OpenLayers/Ajax.js
*
* Class: OpenLayers.Layer.Text
* Tab seperated values file parsing code which creates a markers layer.
@@ -119,7 +120,7 @@
}
}
if (set) {
- var data = new Object();
+ var data = {};
if (url != null) {
data.icon = new OpenLayers.Icon(url,
iconSize,
@@ -158,7 +159,7 @@
* evt - {Event}
*/
markerClick: function(evt) {
- sameMarkerClicked = (this == this.layer.selectedFeature);
+ var sameMarkerClicked = (this == this.layer.selectedFeature);
this.layer.selectedFeature = (!sameMarkerClicked) ? this : null;
for(var i=0; i < this.layer.map.popups.length; i++) {
this.layer.map.removePopup(this.layer.map.popups[i]);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/TileCache.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/TileCache.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -88,7 +88,7 @@
* Method: getURL
*
* Parameters:
- * bounds - {OpenLayers.Bounds}
+ * bounds - {<OpenLayers.Bounds>}
*
* Returns:
* A string with the layer's url and parameters and also the
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/Vector.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/Vector.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -121,8 +121,8 @@
this.displayError();
}
- this.features = new Array();
- this.selectedFeatures = new Array();
+ this.features = [];
+ this.selectedFeatures = [];
},
/**
@@ -310,7 +310,7 @@
* Destroy all features on the layer and empty the selected features array.
*/
destroyFeatures: function () {
- this.selectedFeatures = new Array();
+ this.selectedFeatures = [];
for (var i = this.features.length - 1; i >= 0; i--) {
this.features[i].destroy();
}
@@ -343,7 +343,7 @@
* Erase features from the layer.
*
* Parameters:
- * features - {Array(OpenLayers.Feature.Vector)}
+ * features - {Array(<OpenLayers.Feature.Vector>)}
*/
eraseFeatures: function(features) {
this.renderer.eraseFeatures(features);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/WFS.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/WFS.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/WFS.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -73,7 +73,7 @@
// Turn off error reporting, browsers like Safari may work
// depending on the setup, and we don't want an unneccesary alert.
OpenLayers.Util.extend(options, {'reportError': false});
- var newArguments=new Array()
+ var newArguments = [];
newArguments.push(name, options);
OpenLayers.Layer.Vector.prototype.initialize.apply(this, newArguments);
if (!this.renderer || !this.vectorMode) {
@@ -342,7 +342,7 @@
this.commitReport('WFS Transaction: SUCCESS', response);
for(var i = 0; i < this.features.length; i++) {
- i.state = null;
+ this.features[i].state = null;
}
// TBD redraw the layer or reset the state of features
// foreach features: set state to null
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/WMS.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/WMS.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/WMS.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -64,7 +64,7 @@
* options - {Ojbect} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, params, options) {
- var newArguments = new Array();
+ var newArguments = [];
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params, options);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/WorldWind.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/WorldWind.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/WorldWind.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -49,7 +49,7 @@
initialize: function(name, url, lzd, zoomLevels, params, options) {
this.lzd = lzd;
this.zoomLevels = zoomLevels;
- var newArguments = new Array();
+ var newArguments = [];
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
this.params = (params ? params : {});
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer/Yahoo.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer/Yahoo.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer/Yahoo.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -59,10 +59,22 @@
*/
loadMapObject:function() {
try { //do not crash!
- this.mapObject = new YMap(this.div, this.type);
+ var size = this.getMapObjectSizeFromOLSize(this.map.getSize());
+ this.mapObject = new YMap(this.div, this.type, size);
this.mapObject.disableKeyControls();
} catch(e) {}
},
+
+ /**
+ * Method: onMapResize
+ *
+ */
+ onMapResize: function() {
+ try {
+ var size = this.getMapObjectSizeFromOLSize(this.map.getSize());
+ this.mapObject.resizeTo(size);
+ } catch(e) {}
+ },
/**
@@ -336,6 +348,21 @@
getMapObjectPixelFromXY: function(x, y) {
return new YCoordPoint(x, y);
},
-
+
+ // Size
+
+ /**
+ * APIMethod: getMapObjectSizeFromOLSize
+ *
+ * Parameters:
+ * olSize - {<OpenLayers.Size>}
+ *
+ * Return:
+ * {Object} MapObject Size from olSize parameter
+ */
+ getMapObjectSizeFromOLSize: function(olSize) {
+ return new YSize(olSize.w, olSize.h);
+ },
+
CLASS_NAME: "OpenLayers.Layer.Yahoo"
});
Modified: sandbox/tschaub/feature/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Layer.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Layer.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -43,55 +43,54 @@
/**
* APIProperty: map
* {<OpenLayers.Map>} This variable is set when the layer is added to
- * the map, via the accessor function setMap().
+ * the map, via the accessor function setMap().
*/
map: null,
/**
* APIProperty: isBaseLayer
* {Boolean} Whether or not the layer is a base layer. This should be set
- * individually by all subclasses.
- * Default is false
+ * individually by all subclasses. Default is false
*/
isBaseLayer: false,
/**
* Property: alpha
- * {Boolean} Whether or not the layer's images have an alpha channel
+ * {Boolean} The layer's images have an alpha channel. Default is false.
*/
alpha: false,
/**
* APIProperty: displayInLayerSwitcher
- * {Boolean} Should the layer's name appear in the layer switcher?
+ * {Boolean} Display the layer's name in the layer switcher. Default is
+ * true.
*/
displayInLayerSwitcher: true,
/**
* APIProperty: visibility
- * {Boolean} Whether or not the layer should be displayed in the map
+ * {Boolean} The layer should be displayed in the map. Default is true.
*/
visibility: true,
/**
- * APIProperty: inRange
- * {Boolean} Whether or not the map's current resolution is within this
- * layer's min/max range -- this is set in map's setCenter()
- * whenever zoom changes.
+ * Property: inRange
+ * {Boolean} The current map resolution is within the layer's min/max range.
+ * This is set in <OpenLayers.Map.setCenter> whenever the zoom changes.
*/
inRange: false,
/**
* Propery: imageSize
* {<OpenLayers.Size>} For layers with a gutter, the image is larger than
- * the tile by twice the gutter in each dimension.
+ * the tile by twice the gutter in each dimension.
*/
imageSize: null,
/**
* Property: imageOffset
* {<OpenLayers.Pixel>} For layers with a gutter, the image offset
- * represents displacement due to the gutter.
+ * represents displacement due to the gutter.
*/
imageOffset: null,
@@ -100,57 +99,64 @@
/**
* Property: options
* {Object} An optional object whose properties will be set on the layer.
- * Any of the layer properties can be set as a property of the options
- * object and sent to the constructor when the layer is created.
+ * Any of the layer properties can be set as a property of the options
+ * object and sent to the constructor when the layer is created.
*/
options: null,
/**
* APIProperty: gutter
* {Integer} Determines the width (in pixels) of the gutter around image
- * tiles to ignore. By setting this property to a non-zero
- * value, images will be requested that are wider and taller
- * than the tile size by a value of 2 x gutter. This allows
- * artifacts of rendering at tile edges to be ignored. Set a
- * gutter value that is equal to half the size of the widest
- * symbol that needs to be displayed. Defaults to zero.
- * Non-tiled layers always have zero gutter.
+ * tiles to ignore. By setting this property to a non-zero value,
+ * images will be requested that are wider and taller than the tile
+ * size by a value of 2 x gutter. This allows artifacts of rendering
+ * at tile edges to be ignored. Set a gutter value that is equal to
+ * half the size of the widest symbol that needs to be displayed.
+ * Defaults to zero. Non-tiled layers always have zero gutter.
*/
gutter: 0,
/**
* APIProperty: projection
* {String} Set in the layer options to override the default projection
- * string this layer - also set maxExtent, maxResolution, and
- * units if appropriate.
+ * string this layer - also set maxExtent, maxResolution, and units if
+ * appropriate.
*/
projection: null,
/**
* APIProperty: units
* {String} The layer map units. Defaults to 'degrees'. Possible values
- * are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
+ * are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
*/
units: null,
/**
* APIProperty: scales
- * {Array}
+ * {Array} An array of map scales in descending order. The values in the
+ * array correspond to the map scale denominator. Note that these
+ * values only make sense if the display (monitor) resolution of the
+ * client is correctly guessed by whomever is configuring the
+ * application. In addition, the units property must also be set.
+ * Use <resolutions> instead wherever possible.
*/
scales: null,
/**
* APIProperty: resolutions
* {Array} A list of map resolutions (map units per pixel) in descending
- * order. If this is not set in the layer constructor, it will be set
- * based on other resolution related properties (maxExtent, maxResolution,
- * maxScale, etc.).
+ * order. If this is not set in the layer constructor, it will be set
+ * based on other resolution related properties (maxExtent,
+ * maxResolution, maxScale, etc.).
*/
resolutions: null,
/**
* APIProperty: maxExtent
- * {<OpenLayers.Bounds>}
+ * {<OpenLayers.Bounds>} The center of these bounds will not stray outside
+ * of the viewport extent during panning. In addition, if
+ * <displayOutsideMaxExtent> is set to false, data will not be
+ * requested that falls completely outside of these bounds.
*/
maxExtent: null,
@@ -163,9 +169,9 @@
/**
* APIProperty: maxResolution
* {Float} Default max is 360 deg / 256 px, which corresponds to
- * zoom level 0 on gmaps. Specify a different value in the layer
- * options if you are not using a geographic projection and
- * displaying the whole world.
+ * zoom level 0 on gmaps. Specify a different value in the layer
+ * options if you are not using a geographic projection and
+ * displaying the whole world.
*/
maxResolution: null,
@@ -196,7 +202,7 @@
/**
* APIProperty: displayOutsideMaxExtent
* {Boolean} Request map tiles that are completely outside of the max extent
- * for this layer. Defaults to false
+ * for this layer. Defaults to false.
*/
displayOutsideMaxExtent: false,
@@ -244,9 +250,8 @@
* the Javascript garbage cleaner can not take care of on its own.
*
* Parameters:
- * setNewBaseLayer - {Boolean} Should a new baselayer be selected when
- * this has been removed?
- * Default is true.
+ * setNewBaseLayer - {Boolean} Set a new base layer when this layer has
+ * been destroyed. Default is true.
*/
destroy: function(setNewBaseLayer) {
if (setNewBaseLayer == null) {
@@ -293,9 +298,11 @@
/**
* APIMethod: setName
- *
+ * Sets the new layer name for this layer. Can trigger a changelayer event
+ * on the map.
+ *
* Parameters:
- * newName - {String}
+ * newName - {String} The new name.
*/
setName: function(newName) {
if (newName != this.name) {
@@ -315,7 +322,7 @@
addOptions: function (newOptions) {
if (this.options == null) {
- this.options = new Object();
+ this.options = {};
}
// update our copy for clone
@@ -363,8 +370,8 @@
*
* Parameters:
* bound - {<OpenLayers.Bounds>}
- * zoomChanged - {Boolean} Tells when zoom has changed, as layers
- * have to do some init work in that case.
+ * zoomChanged - {Boolean} Tells when zoom has changed, as layers have to
+ * do some init work in that case.
* dragging - {Boolean}
*/
moveTo:function(bounds, zoomChanged, dragging) {
@@ -416,7 +423,7 @@
*
* Return:
* {<OpenLayers.Size>} The size that the image should be, taking into
- * account gutters.
+ * account gutters.
*/
getImageSize: function() {
return (this.imageSize || this.tileSize);
@@ -452,7 +459,7 @@
* APIMethod: getVisibility
*
* Return:
- * {Boolean} Whether or not the layer should be displayed (if in range)
+ * {Boolean} The layer should be displayed (if in range).
*/
getVisibility: function() {
return this.visibility;
@@ -460,10 +467,10 @@
/**
* APIMethod: setVisibility
- * Set the visibility flag for the layer and hide/show&redraw accordingly.
+ * Set the visibility flag for the layer and hide/show & redraw accordingly.
* Fire event unless otherwise specified
*
- * Note that visibility is no longer simply whether or not the layer's
+ * Note that visibility is no longer simply whether or not the layer's
* style.display is set to "block". Now we store a 'visibility' state
* property on the layer class, this allows us to remember whether or
* not we *desire* for a layer to be visible. In the case where the
@@ -503,8 +510,8 @@
* Method: calculateInRange
*
* Return:
- * {Boolean} Whether or not the layer is displayable at the current map's
- * current resolution
+ * {Boolean} The layer is displayable at the current map's current
+ * resolution.
*/
calculateInRange: function() {
var inRange = false;
@@ -544,11 +551,10 @@
* 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.
+ * The user has several options that determine how the array is set up.
*
- * For a detailed explanation, see the following wiki from the
+ * For a detailed explanation, see the following wiki from the
* openlayers.org homepage:
- *
* http://trac.openlayers.org/wiki/SettingZoomLevels
*/
initResolutions: function() {
@@ -569,7 +575,7 @@
// resolution-related properties that we find in either the layer's
// 'options' array or from the map.
//
- var confProps = new Object();
+ var confProps = {};
for(var i=0; i < props.length; i++) {
var property = props[i];
confProps[property] = this.options[property] || this.map[property];
@@ -588,7 +594,7 @@
if ((confProps.scales != null) || (confProps.resolutions != null)) {
//preset levels
if (confProps.scales != null) {
- confProps.resolutions = new Array();
+ confProps.resolutions = [];
for(var i = 0; i < confProps.scales.length; i++) {
var scale = confProps.scales[i];
confProps.resolutions[i] =
@@ -601,7 +607,7 @@
} else {
//maxResolution and numZoomLevels based calculation
- confProps.resolutions = new Array();
+ confProps.resolutions = [];
// determine maxResolution
if (confProps.minScale) {
@@ -658,7 +664,7 @@
var lastIndex = confProps.resolutions.length - 1;
this.minResolution = confProps.resolutions[lastIndex];
- this.scales = new Array();
+ this.scales = [];
for(var i = 0; i < confProps.resolutions.length; i++) {
this.scales[i] =
OpenLayers.Util.getScaleFromResolution(confProps.resolutions[i],
@@ -675,7 +681,7 @@
*
* Return:
* {Float} The currently selected resolution of the map, taken from the
- * resolutions array, indexed by current zoom level.
+ * resolutions array, indexed by current zoom level.
*/
getResolution: function() {
var zoom = this.map.getZoom();
@@ -687,7 +693,7 @@
*
* Return:
* {<OpenLayers.Bounds>} A Bounds object which represents the lon/lat
- * bounds of the current viewPort.
+ * bounds of the current viewPort.
*/
getExtent: function() {
// just use stock map calculateBounds function -- passing no arguments
@@ -704,10 +710,10 @@
*
* Return:
* {Integer} The index of the zoomLevel (entry in the resolutions array)
- * that still contains the passed-in extent. We do this by
- * calculating the ideal resolution for the given exteng (based
- * on the map size) and then find the smallest resolution that
- * is greater than this ideal resolution.
+ * that still contains the passed-in extent. We do this by calculating
+ * the ideal resolution for the given exteng (based on the map size)
+ * and then find the smallest resolution that is greater than this
+ * ideal resolution.
*/
getZoomForExtent: function(extent) {
var viewSize = this.map.getSize();
@@ -725,8 +731,8 @@
*
* Return:
* {Integer} The index of the zoomLevel (entry in the resolutions array)
- * that is the smallest resolution that is greater than the
- * passed-in resolution.
+ * that is the smallest resolution that is greater than the passed-in
+ * resolution.
*/
getZoomForResolution: function(resolution) {
@@ -746,8 +752,7 @@
*
* Return:
* {<OpenLayers.LonLat>} An OpenLayers.LonLat which is the passed-in
- * view port <OpenLayers.Pixel>, translated into
- * lon/lat by the layer
+ * view port <OpenLayers.Pixel>, translated into lon/lat by the layer.
*/
getLonLatFromViewPortPx: function (viewPortPx) {
var lonlat = null;
@@ -779,8 +784,7 @@
*
* Return:
* {<OpenLayers.Pixel>} An <OpenLayers.Pixel> which is the passed-in
- * <OpenLayers.LonLat>,translated into view
- * port pixels.
+ * <OpenLayers.LonLat>,translated into view port pixels.
*/
getViewPortPxFromLonLat: function (lonlat) {
var px = null;
Modified: sandbox/tschaub/feature/lib/OpenLayers/Map.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Map.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Map.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -25,7 +25,7 @@
/**
* Constant: EVENT_TYPES
- * {Array} supported application event types
+ * {Array(String)} supported application event types
*/
EVENT_TYPES: [
"addlayer", "removelayer", "changelayer", "movestart", "move",
@@ -155,10 +155,10 @@
/**
* APIProperty: resolutions
- * {Array} A list of map resolutions (map units per pixel) in descending
- * order. If this is not set in the layer constructor, it will be set
- * based on other resolution related properties (maxExtent, maxResolution,
- * maxScale, etc.).
+ * {Array(Float)} A list of map resolutions (map units per pixel) in
+ * descending order. If this is not set in the layer constructor, it
+ * will be set based on other resolution related properties
+ * (maxExtent, maxResolution, maxScale, etc.).
*/
resolutions: null,
@@ -327,7 +327,7 @@
this.addControlToMap(this.controls[i]);
}
- this.popups = new Array();
+ this.popups = [];
this.unloadDestroy = this.destroy.bind(this);
Modified: sandbox/tschaub/feature/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Renderer/SVG.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Renderer/SVG.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -510,7 +510,7 @@
* Method: getComponentString
*
* Parameters:
- * components - {Array} Array of points
+ * components - {Array(<OpenLayers.Geometry.Point)} Array of points
*/
getComponentsString: function(components) {
var strings = [];
Modified: sandbox/tschaub/feature/lib/OpenLayers/Tile/WFS.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Tile/WFS.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Tile/WFS.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -45,7 +45,7 @@
initialize: function(layer, position, bounds, url, size) {
OpenLayers.Tile.prototype.initialize.apply(this, arguments);
this.url = url;
- this.features = new Array();
+ this.features = [];
},
/**
Modified: sandbox/tschaub/feature/lib/OpenLayers/Util.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers/Util.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers/Util.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -6,14 +6,14 @@
/**
* Namespace: Util
*/
-OpenLayers.Util = new Object();
+OpenLayers.Util = {};
/**
* Function: getElement
* This is the old $() from prototype
*/
OpenLayers.Util.getElement = function() {
- var elements = new Array();
+ var elements = [];
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
@@ -49,7 +49,7 @@
*/
OpenLayers.Util.extend = function(destination, source) {
if(destination && source) {
- for(property in source) {
+ for(var property in source) {
destination[property] = source[property];
}
/**
@@ -127,14 +127,19 @@
/**
* Function: modifyDOMElement
*
+ * Modifies many properties of a DOM element all at once. Passing in
+ * null to an individual parameter will avoid setting the attribute.
+ *
* Parameters:
- * id - {String}
- * px - {<OpenLayers.Pixel>}
- * sz - {<OpenLayers.Size>}
- * position - {String}
- * border - {String}
- * overflow - {String}
- * opacity - {Float} Fractional value (0.0 - 1.0)
+ * id - {String} The element id attribute to set.
+ * px - {<OpenLayers.Pixel>} The left and top style position.
+ * sz - {<OpenLayers.Size>} The width and height style attributes.
+ * position - {String} The position attribute. eg: absolute,
+ * relative, etc.
+ * border - {String} The style.border attribute. eg:
+ * solid black 2px
+ * overflow - {String} The style.overview attribute.
+ * opacity - {Float} Fractional value (0.0 - 1.0)
*/
OpenLayers.Util.modifyDOMElement = function(element, id, px, sz, position,
border, overflow, opacity) {
@@ -167,17 +172,25 @@
/**
* Function: createDiv
+ * Creates a new div and optionally set some standard attributes.
+ * Null may be passed to each parameter if you do not wish to
+ * set a particular attribute.d
*
* Note: zIndex is NOT set
*
* Parameters:
- * id - {String}
- * px - {<OpenLayers.Pixel>}
- * sz - {<OpenLayers.Size>}
- * imgURL - {String}
- * position - {String}
- * border - {String}
- * overflow - {String}
+ * id - {String} An identifier for this element. If no id is
+ * passed an identifier will be created
+ * automatically.
+ * px - {<OpenLayers.Pixel>} The element left and top position.
+ * sz - {<OpenLayers.Size>} The element width and height.
+ * imgURL - {String} A url pointing to an image to use as a
+ * background image.
+ * position - {String} The style.position value. eg: absolute,
+ * relative etc.
+ * border - {String} The the style.border value.
+ * eg: 2px solid black
+ * overflow - {String} The style.overflow value. Eg. hidden
* opacity - {Float} Fractional value (0.0 - 1.0)
*
* Return:
@@ -207,15 +220,18 @@
/**
* Function: createImage
+ * Creates an img element with specific attribute values.
*
* Parameters:
- * id - {String}
- * px - {<OpenLayers.Pixel>}
- * sz - {<OpenLayers.Size>}
- * imgURL - {String}
- * position - {String}
- * border - {String}
- * delayDisplay - {Boolean}
+ * id - {String} The id field for the img. If none assigned one will be
+ * automatically generated.
+ * px - {<OpenLayers.Pixel>} The left and top positions.
+ * sz - {<OpenLayers.Size>} The style.width and style.height values.
+ * imgURL - {String} The url to use as the image source.
+ * position - {String} The style.position value.
+ * border - {String} The border to place around the image.
+ * delayDisplay - {Boolean} If true waits until the image has been
+ * loaded.
* opacity - {Float} Fractional value (0.0 - 1.0)
*
* Return:
@@ -333,9 +349,12 @@
/**
* Function: alphaHack
+ * Checks whether it's necessary (and possible) to use the png alpha
+ * hack which allows alpha transparency for png images under Internet
+ * Explorer.
*
* Return:
- * {Boolean}
+ * {Boolean} true if alpha has is necessary and possible, false otherwise.
*/
OpenLayers.Util.alphaHack = function() {
var arVersion = navigator.appVersion.split("MSIE");
@@ -459,7 +478,7 @@
* {Object} A new Object with all the same keys but uppercased
*/
OpenLayers.Util.upperCaseObject = function (object) {
- var uObject = new Object();
+ var uObject = {};
for (var key in object) {
uObject[key.toUpperCase()] = object[key];
}
@@ -499,7 +518,7 @@
* of being URL escaped (foo%3Abar).
*/
OpenLayers.Util.getParameterString = function(params) {
- paramsArray = new Array();
+ paramsArray = [];
for (var key in params) {
var value = params[key];
@@ -507,7 +526,7 @@
var encodedValue;
if (typeof value == 'object' && value.constructor == Array) {
/* value is an array; encode items and separate with "," */
- var encodedItemArray = new Array();
+ var encodedItemArray = [];
for (var itemIndex=0; itemIndex<value.length; itemIndex++) {
encodedItemArray.push(encodeURIComponent(value[itemIndex]));
}
@@ -543,10 +562,21 @@
/**
* Function: Try
+ * Execute functions until one of them doesn't throw an error.
+ * Capitalized because "try" is a reserved word in JavaScript.
+ * Taken directly from OpenLayers.Util.Try()
*
+ * Parameters:
+ * [*] - {Function} Any number of parameters may be passed to Try()
+ * It will attempt to execute each of them until one of them
+ * successfully executes.
+ * If none executes successfully, returns null.
+ *
+ * Return:
+ * {*} The value returned by the first successfully executed function.
*/
OpenLayers.Util.Try = function() {
- var returnValue;
+ var returnValue = null;
for (var i = 0; i < arguments.length; i++) {
var lambda = arguments[i];
@@ -596,7 +626,7 @@
* {Array}
*/
OpenLayers.Util._getNodes=function(nodes, tagName) {
- var retArray = new Array();
+ var retArray = [];
for (var i=0;i<nodes.length;i++) {
if (nodes[i].nodeName==tagName) {
retArray.push(nodes[i]);
@@ -767,7 +797,7 @@
return {};
}
- var args = new Object();
+ var args = {};
pairs = query.split(/[&;]/);
for(var i = 0; i < pairs.length; ++i) {
keyValue = pairs[i].split('=');
@@ -793,7 +823,7 @@
* Function: createUniqueID
*
* Parameters:
- * prefix {String} String to prefix random id.
+ * prefix {String} String to prefix unique id.
* If null, default is "id_"
*
* Return:
@@ -832,7 +862,7 @@
* Function: normalzeScale
*
* Parameters:
- * scale {float}
+ * scale - {float}
*
* Return:
* {Float} A normalized scale value, in 1 / X format.
@@ -914,7 +944,8 @@
/**
* Function: pagePositon
- *
+ * Calculates the position of an element on the page.
+ *
* Parameters:
* forElement - {DOMElement}
*
@@ -971,7 +1002,7 @@
* {Boolean} Whether or not the two URLs are equivalent
*/
OpenLayers.Util.isEquivalentUrl = function(url1, url2, options) {
- options = options || new Object();
+ options = options || {};
OpenLayers.Util.applyDefaults(options, {
ignoreCase: true,
@@ -1034,16 +1065,19 @@
*
* Parameters:
* url - {String}
- * options - {Object}
+ * options - {Object} A hash of options. Can be one of:
+ * ignoreCase: lowercase url,
+ * ignorePort80: don't include explicit port if port is 80,
+ * ignoreHash: Don't include part of url after the hash (#).
*
* Return:
* {Object} An object with separate url, a, port, host, and args parsed out
* and ready for comparison
*/
OpenLayers.Util.createUrlObject = function(url, options) {
- options = options || new Object();
+ options = options || {};
- var urlObject = new Object();
+ var urlObject = {};
if (options.ignoreCase) {
url = url.toLowerCase();
@@ -1142,9 +1176,10 @@
/**
* Function: removeTail
+ * Takes a url and removes everything after the ? and #
*
* Parameters:
- * url - {String}
+ * url - {String} The url to process
*
* Return:
* {String} The string with all queryString and Hash removed
Modified: sandbox/tschaub/feature/lib/OpenLayers.js
===================================================================
--- sandbox/tschaub/feature/lib/OpenLayers.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/OpenLayers.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -165,6 +165,7 @@
"OpenLayers/Layer/Vector.js",
"OpenLayers/Layer/GML.js",
"OpenLayers/Format.js",
+ "OpenLayers/Format/XML.js",
"OpenLayers/Format/GML.js",
"OpenLayers/Format/KML.js",
"OpenLayers/Format/GeoRSS.js",
Modified: sandbox/tschaub/feature/lib/Rico/Corner.js
===================================================================
--- sandbox/tschaub/feature/lib/Rico/Corner.js 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/lib/Rico/Corner.js 2007-08-08 20:32:43 UTC (rev 3876)
@@ -92,7 +92,7 @@
* @param {DOM} theDiv - A child of the outer <div> that was
* supplied to the `round` method.
*
- * @param {Array} options - list of options
+ * @param {Object} options - list of options
*/
reRound: function(theDiv, options) {
Modified: sandbox/tschaub/feature/tests/BaseTypes/test_Bounds.html
===================================================================
--- sandbox/tschaub/feature/tests/BaseTypes/test_Bounds.html 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/tests/BaseTypes/test_Bounds.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -304,7 +304,7 @@
t.ok(bounds.equals(originalBounds), "null to extend does not crash or change original bounds");
//obj with no classname
- var object = new Object();
+ var object = {};
bounds.extend(object);
t.ok(bounds.equals(originalBounds), "extend() passing object with no classname does not crash or change original bounds")
Modified: sandbox/tschaub/feature/tests/BaseTypes/test_Element.html
===================================================================
--- sandbox/tschaub/feature/tests/BaseTypes/test_Element.html 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/tests/BaseTypes/test_Element.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -115,7 +115,7 @@
//shown
t.open_window( "BaseTypes/test_Element.html", function( wnd ) {
- t.delay_call( function() {
+ t.delay_call( 0.2, function() {
var elem = wnd.document.getElementById("elemID");
var dims = OpenLayers.Element.getDimensions(elem);
Modified: sandbox/tschaub/feature/tests/Control/test_LayerSwitcher.html
===================================================================
--- sandbox/tschaub/feature/tests/Control/test_LayerSwitcher.html 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/tests/Control/test_LayerSwitcher.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -115,8 +115,33 @@
t.ok(control2.div.childNodes[1].childNodes[2].innerHTML.match("Base Layer"), "Base Layers last in LayerSwitcher with ascending false");
t.ok(control2.div.childNodes[1].childNodes[0].innerHTML.match("Overlays"), "Base Layers last in LayerSwitcher with ascending false");
}
+
+ function test_Control_LayerSwitcher_displayInLayerSwitcher (t) {
+ t.plan( 2 );
+ map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.WMS("WMS",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"}, {'displayInLayerSwitcher': false});
+ map.addLayer(layer);
+
+ control = new OpenLayers.Control.LayerSwitcher();
+ map.addControl(control);
+ t.eq(control.div.childNodes[1].childNodes[0].style.display, "none" , "Base layer display off when no visble base layer");
+
+ map = new OpenLayers.Map('map');
+ var layer = new OpenLayers.Layer.WMS("WMS",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(layer);
+
+ control = new OpenLayers.Control.LayerSwitcher();
+ map.addControl(control);
+ t.eq(control.div.childNodes[1].childNodes[0].style.display, "" , "Base layer display on when visble base layer");
+ }
+
+
// -->
</script>
</head>
Modified: sandbox/tschaub/feature/tests/Control/test_Panel.html
===================================================================
--- sandbox/tschaub/feature/tests/Control/test_Panel.html 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/tests/Control/test_Panel.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -10,42 +10,42 @@
t.eq( control.displayClass, "olControlPanel", "displayClass is correct" );
}
function test_01_Control_Panel_constructor (t) {
- t.plan(5);
- var map = new OpenLayers.Map('map');
- var panel = new OpenLayers.Control.Panel();
- var toolControl = new OpenLayers.Control.ZoomBox();
- var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
- CLASS_NAME: 'mbControl.TestTool',
- type: OpenLayers.Control.TYPE_TOOL
- });
- var anotherToolControl = new AnotherToolControl();
- var ToggleControl = OpenLayers.Class(OpenLayers.Control, {
- CLASS_NAME: 'mbControl.TestToggle',
- type: OpenLayers.Control.TYPE_TOGGLE
- });
- var toggleControl = new ToggleControl();
+ t.plan(5);
+ var map = new OpenLayers.Map('map');
+ var panel = new OpenLayers.Control.Panel();
+ var toolControl = new OpenLayers.Control.ZoomBox();
+ var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
+ CLASS_NAME: 'mbControl.TestTool',
+ type: OpenLayers.Control.TYPE_TOOL
+ });
+ var anotherToolControl = new AnotherToolControl();
+ var ToggleControl = OpenLayers.Class(OpenLayers.Control, {
+ CLASS_NAME: 'mbControl.TestToggle',
+ type: OpenLayers.Control.TYPE_TOGGLE
+ });
+ var toggleControl = new ToggleControl();
t.ok(panel instanceof OpenLayers.Control.Panel,
- "new OpenLayers.Control.Panel returns object");
+ "new OpenLayers.Control.Panel returns object");
- panel.addControls([toolControl, anotherToolControl, toggleControl]);
+ panel.addControls([toolControl, anotherToolControl, toggleControl]);
t.eq(panel.controls.length, 3,
- "added three controls to the panel");
+ "added three controls to the panel");
map.addControl(panel);
- panel.activateControl(toolControl);
- t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
- "activated one tool control, the other one is inactive and the toggle control also.");
-
- panel.activateControl(toggleControl);
- t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
- "activated the toggle control, which has no influence on the tool controls.");
-
- panel.activateControl(anotherToolControl);
- t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
- "activated the other tool control, the first one is inactive and the toggle control still active.");
- }
+ panel.activateControl(toolControl);
+ t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
+ "activated one tool control, the other one is inactive and the toggle control also.");
+
+ panel.activateControl(toggleControl);
+ t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
+ "activated the toggle control, which has no influence on the tool controls.");
+
+ panel.activateControl(anotherToolControl);
+ t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
+ "activated the other tool control, the first one is inactive and the toggle control still active.");
+ }
// -->
</script>
</head>
Modified: sandbox/tschaub/feature/tests/Format/test_GML.html
===================================================================
--- sandbox/tschaub/feature/tests/Format/test_GML.html 2007-08-08 16:19:31 UTC (rev 3875)
+++ sandbox/tschaub/feature/tests/Format/test_GML.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -49,6 +49,13 @@
t.eq(data[0].fid, '221', 'fid on polygons set correctly (with whitespace)');
t.eq(data[1].fid, '8', 'fid on linestrings set correctly with whitespace');
}
+ function test_Format_GML_no_clobber(t) {
+ t.plan(1);
+ var parser = new OpenLayers.Format.GML();
+ data = parser.read(test_content);
+ t.eq(window.i, undefined,
+ "i is undefined in window scope after reading.");
+ }
// -->
</script>
</head>
Copied: sandbox/tschaub/feature/tests/Format/test_XML.html (from rev 3875, trunk/openlayers/tests/Format/test_XML.html)
===================================================================
--- sandbox/tschaub/feature/tests/Format/test_XML.html (rev 0)
+++ sandbox/tschaub/feature/tests/Format/test_XML.html 2007-08-08 20:32:43 UTC (rev 3876)
@@ -0,0 +1,219 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var text =
+ '<?xml version="1.0"?>' +
+ '<ol:root xmlns="http://namespace.default.net" ' +
+ 'xmlns:ol="http://namespace.openlayers.org" ' +
+ 'xmlns:ta="http://namespace.testattribute.net">' +
+ '<ol:child ta:attribute="value1" ' +
+ 'attribute="value2">' +
+ 'junk1' +
+ '<' + '/ol:child>' +
+ '<ol:child>junk2<' + '/ol:child>' +
+ '<ol:child>junk3<' + '/ol:child>' +
+ '<element>junk4<' + '/element>' +
+ '<ol:element>junk5<' + '/ol:element>' +
+ '<' + '/ol:root>';
+
+ function test_Format_XML_constructor(t) {
+ t.plan(window.ActiveXObject ? 5 : 4);
+
+ var options = {'foo': 'bar'};
+ var format = new OpenLayers.Format.XML(options);
+ t.ok(format instanceof OpenLayers.Format.XML,
+ "new OpenLayers.Format.XML returns object" );
+ t.eq(format.foo, "bar", "constructor sets options correctly");
+ t.eq(typeof format.read, "function", "format has a read function");
+ t.eq(typeof format.write, "function", "format has a write function");
+
+ if(format.xmldom) {
+ t.ok(true, "format only has xmldom in browsers with ActiveX");
+ }
+ }
+
+ function test_Format_XML_read(t) {
+
+ var format = new OpenLayers.Format.XML();
+ t.plan(format.xmldom ? 11 : 10);
+
+ var doc = format.read(text);
+ t.eq(doc.nodeType, 9,
+ "doc has the correct node type");
+ t.eq(doc.nodeName, "#document",
+ "doc has the correct node name");
+ t.ok(doc.documentElement,
+ "ok to access doc.documentElement");
+ t.eq(doc.documentElement.nodeName, "ol:root",
+ "doc root has the correct node name");
+ t.eq(doc.documentElement.childNodes[1].firstChild.nodeValue, "junk2",
+ "second child of doc root has correct child node");
+
+ // read can also be called on the prototype directly
+ doc = OpenLayers.Format.XML.prototype.read(text);
+ t.eq(doc.nodeType, 9,
+ "doc has the correct node type");
+ t.eq(doc.nodeName, "#document",
+ "doc has the correct node name");
+ t.ok(doc.documentElement,
+ "ok to access doc.documentElement");
+ t.eq(doc.documentElement.nodeName, "ol:root",
+ "doc root has the correct node name");
+ t.eq(doc.documentElement.childNodes[1].firstChild.nodeValue, "junk2",
+ "second child of doc root has correct child node");
+
+ // where appropriate, make sure doc is loaded into xmldom property
+ if(format.xmldom) {
+ t.eq(format.xmldom.documentElement.childNodes[1].firstChild.nodeValue,
+ "junk2",
+ "second child of doc root ha