[OpenLayers-Commits] r5119 - in sandbox/camptocamp/text: examples lib/OpenLayers lib/OpenLayers/Control lib/OpenLayers/Format lib/OpenLayers/Handler lib/OpenLayers/Layer tests/Control tests/Handler tests/Layer
commits at openlayers.org
commits at openlayers.org
Tue Nov 6 08:50:05 EST 2007
Author: pgiraud
Date: 2007-11-06 08:49:59 -0500 (Tue, 06 Nov 2007)
New Revision: 5119
Added:
sandbox/camptocamp/text/examples/walkthru.html
Modified:
sandbox/camptocamp/text/examples/attribution.html
sandbox/camptocamp/text/examples/click.html
sandbox/camptocamp/text/examples/controls.html
sandbox/camptocamp/text/examples/example.html
sandbox/camptocamp/text/examples/fullScreen.html
sandbox/camptocamp/text/examples/image-layer.html
sandbox/camptocamp/text/examples/layerswitcher.html
sandbox/camptocamp/text/examples/lite.html
sandbox/camptocamp/text/examples/mvs.html
sandbox/camptocamp/text/examples/overviewmap.html
sandbox/camptocamp/text/examples/spherical-mercator.html
sandbox/camptocamp/text/examples/tilecache.html
sandbox/camptocamp/text/examples/wmst.html
sandbox/camptocamp/text/lib/OpenLayers/BaseTypes.js
sandbox/camptocamp/text/lib/OpenLayers/Control/ModifyFeature.js
sandbox/camptocamp/text/lib/OpenLayers/Format/WFS.js
sandbox/camptocamp/text/lib/OpenLayers/Handler/Drag.js
sandbox/camptocamp/text/lib/OpenLayers/Handler/Point.js
sandbox/camptocamp/text/lib/OpenLayers/Handler/RegularPolygon.js
sandbox/camptocamp/text/lib/OpenLayers/Layer/TileCache.js
sandbox/camptocamp/text/lib/OpenLayers/Util.js
sandbox/camptocamp/text/tests/Control/test_ModifyFeature.html
sandbox/camptocamp/text/tests/Handler/test_Drag.html
sandbox/camptocamp/text/tests/Handler/test_Point.html
sandbox/camptocamp/text/tests/Handler/test_RegularPolygon.html
sandbox/camptocamp/text/tests/Layer/test_TileCache.html
Log:
merge from r5058 to trunk HEAD
Modified: sandbox/camptocamp/text/examples/attribution.html
===================================================================
--- sandbox/camptocamp/text/examples/attribution.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/attribution.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -18,8 +18,8 @@
{'attribution': 'Provided by <a href="http://labs.metacarta.com/">MetaCarta</a>'});
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"},{attribution:"Provided by NASA"});
+ "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
+ {layers: "landsat7"},{attribution:"Provided by Telascience"});
map.addLayers([ol_wms, jpl_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
Modified: sandbox/camptocamp/text/examples/click.html
===================================================================
--- sandbox/camptocamp/text/examples/click.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/click.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -17,8 +17,8 @@
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"});
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"});
jpl_wms.setVisibility(false);
Modified: sandbox/camptocamp/text/examples/controls.html
===================================================================
--- sandbox/camptocamp/text/examples/controls.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/controls.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -27,8 +27,8 @@
{layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"});
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"});
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
Modified: sandbox/camptocamp/text/examples/example.html
===================================================================
--- sandbox/camptocamp/text/examples/example.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/example.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -59,8 +59,8 @@
resolutions: [0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101]
};
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"}, options2);
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"}, options2);
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
Modified: sandbox/camptocamp/text/examples/fullScreen.html
===================================================================
--- sandbox/camptocamp/text/examples/fullScreen.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/fullScreen.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -17,8 +17,8 @@
"http://labs.metacarta.com:80/wms/vmap0?", {layers: 'basic'});
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"});
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"});
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
Modified: sandbox/camptocamp/text/examples/image-layer.html
===================================================================
--- sandbox/camptocamp/text/examples/image-layer.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/image-layer.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -26,8 +26,8 @@
options);
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"}, options);
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"}, options);
map.addLayers([graphic, jpl_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
Modified: sandbox/camptocamp/text/examples/layerswitcher.html
===================================================================
--- sandbox/camptocamp/text/examples/layerswitcher.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/layerswitcher.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -20,8 +20,8 @@
{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"}, {'isBaseLayer': false});
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"}, {'isBaseLayer': false});
var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
Modified: sandbox/camptocamp/text/examples/lite.html
===================================================================
--- sandbox/camptocamp/text/examples/lite.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/lite.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -1,26 +1,18 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
- #map {
- width: 800px;
- height: 475px;
- border: 1px solid black;
- }
+ #map { width:512px; height:256px; border:1px solid black; }
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
- var lon = 5;
- var lat = 40;
- var zoom = 5;
var map, layer;
-
function init(){
map = new OpenLayers.Map( 'map' );
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} );
map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
+ map.zoomToMaxExtent();
}
</script>
</head>
Modified: sandbox/camptocamp/text/examples/mvs.html
===================================================================
--- sandbox/camptocamp/text/examples/mvs.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/mvs.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -88,10 +88,10 @@
case 'nasa':
theMVS.addLayer(
new OpenLayers.Layer.WMS("NASA Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
{"EXCEPTIONS" : "application/vnd.ogc.se_inimage",
"format" : "image/jpeg",
- layers:"modis,global_mosaic"}
+ layers:"landsat7"}
));
break;
case 'gmaps':
Modified: sandbox/camptocamp/text/examples/overviewmap.html
===================================================================
--- sandbox/camptocamp/text/examples/overviewmap.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/overviewmap.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -1,47 +1,96 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Overview Map Example</title>
-<script src="../lib/OpenLayers.js" type="text/javascript"></script>
-<style>
-#map{
- width:100%;
- height:500px;
- border:1px solid;
-}
-</style>
-</head>
-<body>
- <div id="map"></div>
- <script defer="defer" type="text/javascript">
- var map = new OpenLayers.Map('map');
- // my city
- var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
- var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
- var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
+<html>
+ <head>
+ <title>Overview Map Example</title>
+ <script src="../lib/OpenLayers.js" type="text/javascript"></script>
+ <style>
+ #map1 {
+ width: 500px;
+ height: 300px;
+ border: 1px solid gray;
+ }
+ #map2 {
+ width: 500px;
+ height: 300px;
+ border: 1px solid gray;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="map1"></div>
+ <p>The above map has an overview map control that is created with
+ the default options. Much like a regular map, the map contained by
+ the overview map control defaults to a geographic projection.</p>
+ <div id="map2"></div>
+ <p>The second map has an overview map control that is created with
+ non-default options. In this case, the mapOptions property of the
+ control has been set to use non-default projection related properties.
+ In addition, any other properties of the overview map control can be
+ set in this way.</p>
+ <script defer="defer" type="text/javascript">
+
+ // create the top map (with default overview map control)
+ var map1 = new OpenLayers.Map('map1');
+
+ var ol = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
+ "http://labs.metacarta.com/wms/vmap0",
+ {layers: 'basic'}
+ );
+
+ var jpl = new OpenLayers.Layer.WMS(
+ "NASA Global Mosaic",
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"}
+ );
+
+ map1.addLayers([ol, jpl]);
+ map1.addControl(new OpenLayers.Control.LayerSwitcher());
+
+ // create an overview map control with the default options
+ var overview1 = new OpenLayers.Control.OverviewMap();
+ map1.addControl(overview1);
+
+ map1.setCenter(new OpenLayers.LonLat(0, 0), 2);
+
+ // expand the overview map control
+ overview1.maximizeControl();
+
+
+ // create the bottom map (with advanced overview map control)
+ var mapOptions = {
+ maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656),
+ maxResolution: 296985/1024,
+ projection: "EPSG:2805",
+ units: "m"
+ };
- map.addLayers([
- nasa_wms,
- wms
- ]);
-
- map.addControl(new OpenLayers.Control.LayerSwitcher());
-
- var options = {
- layers: [wms.clone()],
- minRatio: 8,
- maxRatio: 128
- };
- var overview = new OpenLayers.Control.OverviewMap(options);
+ var map2 = new OpenLayers.Map('map2', mapOptions);
- map.addControl(overview);
-
- map.setCenter(constantina, 4);
-
- overview.maximizeControl();
- </script>
-</body>
+ var bos = new OpenLayers.Layer.WMS(
+ "Boston",
+ "http://boston.freemap.in/cgi-bin/mapserv",
+ {
+ map: '/www/freemap.in/boston/map/gmaps.map',
+ layers: 'border,water,roads,rapid_transit,buildings',
+ format: 'png'
+ }
+ );
+
+ map2.addLayers([bos]);
+ map2.addControl(new OpenLayers.Control.LayerSwitcher());
+
+ // create an overview map control with the default options
+ var controlOptions = {
+ mapOptions: mapOptions
+ }
+ var overview2 = new OpenLayers.Control.OverviewMap(controlOptions);
+ map2.addControl(overview2);
+
+ map2.setCenter(new OpenLayers.LonLat(182500, 868500), 3);
+
+ // expand the overview map control
+ overview2.maximizeControl();
+
+ </script>
+ </body>
</html>
Modified: sandbox/camptocamp/text/examples/spherical-mercator.html
===================================================================
--- sandbox/camptocamp/text/examples/spherical-mercator.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/spherical-mercator.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -90,7 +90,7 @@
"http://world.freemap.in/tiles/",
{'layers': 'factbook-overlay', 'format':'png'},
{
- 'reproject': false, 'opacity': 0.4,
+ 'opacity': 0.4,
'isBaseLayer': false,'wrapDateLine': true
}
);
Modified: sandbox/camptocamp/text/examples/tilecache.html
===================================================================
--- sandbox/camptocamp/text/examples/tilecache.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/tilecache.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -28,7 +28,7 @@
"http://c2.labs.metacarta.com/wms-c/cache/",
"http://c3.labs.metacarta.com/wms-c/cache/",
"http://c4.labs.metacarta.com/wms-c/cache/"],
- "basic");
+ "basic", {'format': 'image/png'});
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
}
Copied: sandbox/camptocamp/text/examples/walkthru.html (from rev 5118, trunk/openlayers/examples/walkthru.html)
===================================================================
--- sandbox/camptocamp/text/examples/walkthru.html (rev 0)
+++ sandbox/camptocamp/text/examples/walkthru.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -0,0 +1,96 @@
+<html>
+<head>
+<title>OpenLayers examples walkthrough</title>
+<style type="text/css">
+ a { color:blue; text-decoration: none; }
+ a:hover { text-decoration: underline; }
+</style>
+<base href="http://openlayers.org/dev/examples/">
+</head>
+<body style="font-family: sans-serif">
+<h1><pre style="font-size: larger"><ol></pre></h1>
+<p>API documentation: <a href="http://dev.openlayers.org/docs/">http://dev.openlayers.org/docs/</a></p>
+<p>Examples: <a href="http://dev.openlayers.org/examples/">http://openlayers.org/dev/examples/</a></p>
+<h2>Maps</h2>
+<ol>
+ <li><a href="lite.html">Basic example</a></li>
+ <li><a href="layerswitcher.html">Layer switcher (aka legend)</a></li>
+ <li><a href="example.html">Base layers versus overlays</a></li>
+ <li><a href="multiserver.html">Multiple WMS mirrors</a></li>
+ <li><a href="fullScreen.html">Full screen map</a></li>
+ <li><a href="wrapDateLine.html">Wrapping the date line</a></li>
+ <li><a href="projected-map.html">Other cartographic projections</a></li>
+ <li><a href="layer-opacity.html">Translucent overlays</a></li>
+</ol>
+
+<h2>Raster Layers</h2>
+<ol>
+ <li><a href="wms-untiled.html">Untiled WMS layer</a></li>
+ <li><a href="kamap.html">Ka-Map layer</a></li>
+ <li><a href="mapserver.html">MapServer layer</a></li>
+ <li><a href="worldwind.html">Worldwind layer</a></li>
+ <li><a href="tms.html">TMS layer</a></li>
+ <li><a href="image-layer.html">Image layer</a></li>
+ <li><a href="google.html">Google layer</a></li>
+ <li><a href="ve.html">VirtualEarth layer</a></li>
+ <li><a href="spherical-mercator.html">Spherical Mercator ("EPSG:900913")</a></li>
+ <li><a href="http://tilecache.org/">TileCache</a></li>
+</ol>
+
+<h2>Marker Layers</h2>
+<ol>
+ <li><a href="markers.html">Markers</a></li>
+ <li><a href="markerResize.html">Changing marker properties dynamically</a></li>
+ <li><a href="popups.html">Popups</a></li>
+ <li><a href="georss.html">GeoRSS</a> (<a href="georss.xml">example data</a>)</a></li>
+ <li><a href="georss-markers.html">GeoRSS with custom markers</a></li>
+ <li><a href="wfs.html">Point layer from WFS</a></li>
+ <li><a href="getfeatureinfo.html">WFS GetFeatureInfo example</a></li>
+</ol>
+
+<h2>Events and Controls</h2>
+<ol>
+ <li><a href="navtoolbar.html">Navigation tools on the map</a></li>
+ <li><a href="navtoolbar-outsidemap.html">Navigation toolbar off the map</a></li>
+ <li><a href="mouse-position.html">Tracking the mouse position</a></li>
+ <li><a href="overview.html">Overview map</a></li>
+ <li><a href="attribution.html">Layer attribution</a></li>
+ <li><a href="controls.html">Full range of controls</a></li>
+ <li><a href="custom-control.html">Custom controls #1</a></li>
+ <li><a href="custom-control.html">Custom controls #2</a></li>
+ <li><a href="custom-style.html">Custom control styles</a></li>
+ <li><a href="click.html">Trapping click events</a></li>
+ <li><a href="layerLoadMonitoring.html">Tracking map events</a></li>
+</ol>
+
+<h2>Vector Layers</h2>
+<ol>
+ <li><a href="vector-features.html">Generating features in JavaScript</a></li>
+ <li><a href="gml-layer.html">Loading features from GML</a></li>
+ <li><a href="kml-layer.html">Loading features from KML</a></li>
+ <li><a href="gml-serialize.html">Serializing features to GML</a></li>
+ <li><a href="vector-formats.html">Serializing to other formats</a></li>
+ <li><a href="select-feature.html">Selecting features</a></li>
+ <li><a href="select-feature-openpopup.html">Attaching popups to features</a></li>
+</ol>
+
+<h2>Editing Tools</h2>
+<ol>
+ <li><a href="draw-feature.html">Drawing features</a></li>
+ <li><a href="editingtoolbar.html">Editing toolbar</a> (<a href="editingtoolbar-outside.html">outside the map</a>)</li>
+ <li><a href="regular-polygons.html">Creating regular polygons</a></li>
+ <li><a href="modify-feature.html">Modifying features</a></li>
+ <li><a href="resize-features.html">Resizing features</a></li>
+ <li><a href="rotate-features.html">Rotating features</a></li>
+ <li><a href="wfs-t.html">Transactional WFS example</a></li>
+ <li><a href="http://featureserver.org/">FeatureServer</a></li>
+</ol>
+
+<h2>Testing</h2>
+<ol>
+ <li><a href="../tests/run-tests.html">Test.AnotherWay suite</a></li>
+</ol>
+
+<h1><pre style="font-size: larger"></ol></pre></h1>
+</body>
+</html>
Modified: sandbox/camptocamp/text/examples/wmst.html
===================================================================
--- sandbox/camptocamp/text/examples/wmst.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/examples/wmst.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -17,8 +17,8 @@
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://wms.jpl.nasa.gov/wms.cgi",
- {layers: "modis,global_mosaic"});
+ "http://t1.hypercube.telascience.org/tiles/landsat7",
+ {layers: "landsat7"});
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:"2005-08-29T13:00:00Z"});
Modified: sandbox/camptocamp/text/lib/OpenLayers/BaseTypes.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/BaseTypes.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/BaseTypes.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -22,7 +22,7 @@
OpenLayers.String = {
/**
- * APIMethod: OpenLayers.String.startsWith
+ * APIFunction: OpenLayers.String.startsWith
* Test whether a string starts with another string.
*
* Parameters:
@@ -37,7 +37,7 @@
},
/**
- * APIMethod: OpenLayers.String.contains
+ * APIFunction: OpenLayers.String.contains
* Test whether a string contains another string.
*
* Parameters:
@@ -52,7 +52,7 @@
},
/**
- * APIMethod: OpenLayers.String.trim
+ * APIFunction: OpenLayers.String.trim
* Removes leading and trailing whitespace characters from a string.
*
* Parameters:
@@ -68,7 +68,7 @@
},
/**
- * APIMethod: OpenLayers.String.camelize
+ * APIFunction: OpenLayers.String.camelize
* Camel-case a hyphenated string.
* Ex. "chicken-head" becomes "chickenHead", and
* "-chicken-head" becomes "ChickenHead".
@@ -175,23 +175,21 @@
OpenLayers.Number = {
/**
- * APIMethod: OpenLayers.Number.limitSigDigs
- * Limit the number of significant digits on an integer.
+ * APIFunction: OpenLayers.Number.limitSigDigs
+ * Limit the number of significant digits on a float.
*
* Parameters:
- * num - {Integer}
+ * num - {Float}
* sig - {Integer}
*
* Returns:
- * {Integer} The number, rounded to the specified number of significant
+ * {Float} The number, rounded to the specified number of significant
* digits.
*/
limitSigDigs: function(num, sig) {
- var fig;
- if(sig > 0) {
+ var fig = 0;
+ if (sig > 0) {
fig = parseFloat(num.toPrecision(sig));
- } else {
- fig = 0;
}
return fig;
}
@@ -227,7 +225,7 @@
OpenLayers.Function = {
/**
- * APIMethod: OpenLayers.Function.bind
+ * APIFunction: OpenLayers.Function.bind
* Bind a function to an object. Method to easily create closures with
* 'this' altered.
*
@@ -252,7 +250,7 @@
},
/**
- * APIMethod: OpenLayers.Function.bindAsEventListener
+ * APIFunction: OpenLayers.Function.bindAsEventListener
* Bind a function to an object, and configure it to receive the event
* object as first parameter when called.
*
Modified: sandbox/camptocamp/text/lib/OpenLayers/Control/ModifyFeature.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Control/ModifyFeature.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Control/ModifyFeature.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -384,7 +384,8 @@
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {
var vertex = this.dragControl.feature;
if(vertex &&
- OpenLayers.Util.indexOf(this.vertices, vertex) != -1) {
+ OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
+ !this.dragControl.dragHandler.dragging) {
// remove the vertex
vertex.geometry.parent.removeComponent(vertex.geometry);
this.layer.drawFeature(this.feature,
Modified: sandbox/camptocamp/text/lib/OpenLayers/Format/WFS.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Format/WFS.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Format/WFS.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -155,8 +155,8 @@
* feature - {<OpenLayers.Feature.Vector>}
*/
remove: function(feature) {
- if (!feature.attributes.fid) {
- alert("Can't update a feature for which there is no FID.");
+ if (!feature.fid) {
+ alert("Can't delete a feature for which there is no FID.");
return false;
}
var deleteNode = document.createElementNS(this.featureNS, 'wfs:Delete');
@@ -164,7 +164,7 @@
var filterNode = document.createElementNS('http://www.opengis.net/ogc', 'ogc:Filter');
var filterIdNode = document.createElementNS('http://www.opengis.net/ogc', 'ogc:FeatureId');
- filterIdNode.setAttribute("fid", feature.attributes.fid);
+ filterIdNode.setAttribute("fid", feature.fid);
filterNode.appendChild(filterIdNode);
deleteNode.appendChild(filterNode);
Modified: sandbox/camptocamp/text/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Handler/Drag.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Handler/Drag.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -16,7 +16,9 @@
* when the drag begins, with each move, and when the drag is done. In
* addition, controls can have callbacks keyed to 'up' and 'out' if they
* care to differentiate between the types of events that correspond with
- * the end of a drag sequence.
+ * the end of a drag sequence. If no drag actually occurs (no mouse move)
+ * the 'down' and 'up' callbacks will be called, but not the 'done'
+ * callback.
*
* Create a new drag handler with the <OpenLayers.Handler.Drag> constructor.
*
@@ -207,13 +209,16 @@
*/
mouseup: function (evt) {
if (this.started) {
+ var dragged = (this.start != this.last);
this.started = false;
this.dragging = false;
// TBD replace with CSS classes
this.map.div.style.cursor = "";
this.up(evt);
this.callback("up", [evt.xy]);
- this.callback("done", [evt.xy]);
+ if(dragged) {
+ this.callback("done", [evt.xy]);
+ }
document.onselectstart = this.oldOnselectstart;
}
return true;
@@ -231,16 +236,19 @@
*/
mouseout: function (evt) {
if (this.started && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
+ var dragged = (this.start != this.last);
this.started = false;
this.dragging = false;
// TBD replace with CSS classes
this.map.div.style.cursor = "";
this.out(evt);
this.callback("out", []);
+ if(dragged) {
+ this.callback("done", [evt.xy]);
+ }
if(document.onselectstart) {
document.onselectstart = this.oldOnselectstart;
}
- this.callback("done", [evt.xy]);
}
return true;
},
Modified: sandbox/camptocamp/text/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Handler/Point.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Handler/Point.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -114,8 +114,14 @@
if(this.drawing) {
this.cancel();
}
- this.map.removeLayer(this.layer, false);
- this.layer.destroy();
+ // If a layer's map property is set to null, it means that that layer
+ // isn't added to the map. Since we ourself added the layer to the map
+ // in activate(), we can assume that if this.layer.map is null it means
+ // that the layer has been destroyed (as a result of map.destroy() for
+ // example.
+ if (this.layer.map != null) {
+ this.layer.destroy(false);
+ }
this.layer = null;
return true;
},
Modified: sandbox/camptocamp/text/lib/OpenLayers/Handler/RegularPolygon.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Handler/RegularPolygon.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Handler/RegularPolygon.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -164,11 +164,19 @@
if(this.dragging) {
this.cancel();
}
- this.map.removeLayer(this.layer, false);
- this.layer.destroy();
- if (this.feature) {
- this.feature.destroy();
- }
+ // If a layer's map property is set to null, it means that that
+ // layer isn't added to the map. Since we ourself added the layer
+ // to the map in activate(), we can assume that if this.layer.map
+ // is null it means that the layer has been destroyed (as a result
+ // of map.destroy() for example.
+ if (this.layer.map != null) {
+ this.layer.destroy(false);
+ if (this.feature) {
+ this.feature.destroy();
+ }
+ }
+ this.layer = null;
+ this.feature = null;
deactivated = true;
}
return deactivated;
Modified: sandbox/camptocamp/text/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Layer/TileCache.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Layer/TileCache.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -52,7 +52,7 @@
OpenLayers.Layer.Grid.prototype.initialize.apply(this,
[name, url, {}, options]);
this.extension = this.format.split('/')[1].toLowerCase();
- this.extension = (this.extension == 'jpeg') ? 'jpg' : this.extension;
+ this.extension = (this.extension == 'jpg') ? 'jpeg' : this.extension;
},
/**
Modified: sandbox/camptocamp/text/lib/OpenLayers/Util.js
===================================================================
--- sandbox/camptocamp/text/lib/OpenLayers/Util.js 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/lib/OpenLayers/Util.js 2007-11-06 13:49:59 UTC (rev 5119)
@@ -879,6 +879,7 @@
/**
* Constant: INCHES_PER_UNIT
* {Object} Constant inches per unit -- borrowed from MapServer mapscale.c
+ * derivation of nautical miles from http://en.wikipedia.org/wiki/Nautical_mile
*/
OpenLayers.INCHES_PER_UNIT = {
'inches': 1.0,
@@ -886,10 +887,12 @@
'mi': 63360.0,
'm': 39.3701,
'km': 39370.1,
- 'dd': 4374754
+ 'dd': 4374754,
+ 'yd': 36
};
OpenLayers.INCHES_PER_UNIT["in"]= OpenLayers.INCHES_PER_UNIT.inches;
OpenLayers.INCHES_PER_UNIT["degrees"] = OpenLayers.INCHES_PER_UNIT.dd;
+OpenLayers.INCHES_PER_UNIT["nmi"] = 1852 * OpenLayers.INCHES_PER_UNIT.m;
/**
* Constant: DOTS_PER_INCH
Modified: sandbox/camptocamp/text/tests/Control/test_ModifyFeature.html
===================================================================
--- sandbox/camptocamp/text/tests/Control/test_ModifyFeature.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/tests/Control/test_ModifyFeature.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -168,6 +168,11 @@
// run the above four tests twice
control.handleKeypress(delKey);
control.handleKeypress(dKey);
+
+ // now make sure nothing happens if the vertex is mid-drag
+ control.dragControl.dragHandler.dragging = true;
+ control.handleKeypress(delKey);
+
// reset modified methods
control.onModification = function() {};
Modified: sandbox/camptocamp/text/tests/Handler/test_Drag.html
===================================================================
--- sandbox/camptocamp/text/tests/Handler/test_Drag.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/tests/Handler/test_Drag.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -87,7 +87,7 @@
}
function test_Handler_Drag_callbacks(t) {
- t.plan(33);
+ t.plan(34);
var map = new OpenLayers.Map('map', {controls: []});
@@ -187,6 +187,14 @@
OpenLayers.Event.isLeftClick = oldIsLeftClick;
handler.checkModifiers = oldCheckModifiers;
+ // test mouseup before mousemove
+ var realUp = testEvents.up;
+ testEvents.up = testEvents.down;
+ // this will fail with notice about the done callback being called
+ // if done is called when it shouldn't be
+ map.events.triggerEvent("mouseup", testEvents.up);
+ testEvents.up = realUp;
+
// test mousemove
handler.started = false;
map.events.triggerEvent("mousemove", {xy: {x: null, y: null}});
Modified: sandbox/camptocamp/text/tests/Handler/test_Point.html
===================================================================
--- sandbox/camptocamp/text/tests/Handler/test_Point.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/tests/Handler/test_Point.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -43,6 +43,21 @@
"deactivate returns true if the handler was active already");
}
+ function test_Handler_Point_deactivation(t) {
+ t.plan(1);
+ var map = new OpenLayers.Map('map');
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+
+ var handler = new OpenLayers.Handler.Point(control, {foo: 'bar'});
+ handler.activate();
+ handler.layer.destroy();
+ handler.deactivate();
+ t.eq(handler.layer, null,
+ "deactivate doesn't throw an error if layer was" +
+ " previously destroyed");
+ }
+
function test_Handler_Point_bounds(t) {
t.plan(4);
var map = new OpenLayers.Map('map');
Modified: sandbox/camptocamp/text/tests/Handler/test_RegularPolygon.html
===================================================================
--- sandbox/camptocamp/text/tests/Handler/test_RegularPolygon.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/tests/Handler/test_RegularPolygon.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -43,6 +43,21 @@
"deactivate returns true if the handler was active already");
}
+ function test_Handler_RegularPolygon_deactivation(t) {
+ t.plan(1);
+ var map = new OpenLayers.Map('map');
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+
+ var handler = new OpenLayers.Handler.RegularPolygon(control, {foo: 'bar'});
+ handler.activate();
+ handler.layer.destroy();
+ handler.deactivate();
+ t.eq(handler.layer, null,
+ "deactivate doesn't throw an error if layer was" +
+ " previously destroyed");
+ }
+
function test_Handler_RegularPolygon_four_corners(t) {
t.plan(7);
var map = new OpenLayers.Map('map');
Modified: sandbox/camptocamp/text/tests/Layer/test_TileCache.html
===================================================================
--- sandbox/camptocamp/text/tests/Layer/test_TileCache.html 2007-11-06 11:26:29 UTC (rev 5118)
+++ sandbox/camptocamp/text/tests/Layer/test_TileCache.html 2007-11-06 13:49:59 UTC (rev 5119)
@@ -110,16 +110,16 @@
t.plan(2);
var map = new OpenLayers.Map('map', options);
- var options = {'layername':'basic', 'type':'png'};
+ var options = {'layername':'basic', 'format':'image/jpg'};
layer = new OpenLayers.Layer.TileCache(name, url, layername, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 9);
var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
- t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/basic/09/000/000/522/000/000/384.png", "Tile URL is correct");
+ t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/basic/09/000/000/522/000/000/384.jpeg", "Tile URL is correct");
layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
- t.eq(tileurl, "http://tilecache3/basic/09/000/000/522/000/000/384.png", "Tile URL is deterministic");
+ t.eq(tileurl, "http://tilecache2/basic/09/000/000/522/000/000/384.jpeg", "Tile URL is deterministic");
}
function test_11_Layer_TileCache_setMap(t) {
More information about the Commits
mailing list