Changeset 1369
- Timestamp:
- 08/25/06 14:17:06 (2 years ago)
- Files:
-
- trunk/openlayers/build/docs.sh (modified) (2 diffs)
- trunk/openlayers/doc/Control.Permalink.txt (modified) (1 diff)
- trunk/openlayers/doc/Layer.GeoRSS.txt (modified) (1 diff)
- trunk/openlayers/doc/Layer.WMS.txt (modified) (2 diffs)
- trunk/openlayers/examples/google.html (modified) (2 diffs)
- trunk/openlayers/examples/kamap.html (modified) (1 diff)
- trunk/openlayers/examples/setextent.html (copied) (copied from branches/openlayers/2.0/examples/setextent.html)
- trunk/openlayers/examples/test.html (copied) (copied from branches/openlayers/2.0/examples/test.html)
- trunk/openlayers/examples/tiger.html (modified) (1 diff)
- trunk/openlayers/examples/urban.html (modified) (2 diffs)
- trunk/openlayers/examples/ve.html (modified) (2 diffs)
- trunk/openlayers/examples/wmst.html (modified) (1 diff)
- trunk/openlayers/examples/zoomLevels.html (copied) (copied from branches/openlayers/2.0/examples/zoomLevels.html)
- trunk/openlayers/img/blank.gif (copied) (copied from branches/openlayers/2.0/img/blank.gif)
- trunk/openlayers/lib/OpenLayers/BaseTypes.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Control/LayerSwitcher.js (modified) (7 diffs)
- trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js (modified) (6 diffs)
- trunk/openlayers/lib/OpenLayers/Control/MouseToolbar.js (modified) (14 diffs)
- trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js (modified) (9 diffs)
- trunk/openlayers/lib/OpenLayers/Feature/WFS.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer.js (modified) (8 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/EventPane.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/GeoRSS.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/Google.js (modified) (8 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/Grid.js (modified) (10 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/HTTPRequest.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/KaMap.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/Text.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/VirtualEarth.js (modified) (5 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/WFS.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/WMS.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/WorldWind.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (19 diffs)
- trunk/openlayers/lib/OpenLayers/Tile/Image.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Tile/WFS.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (1 diff)
- trunk/openlayers/news.txt (copied) (copied from branches/openlayers/2.0/news.txt)
- trunk/openlayers/readme.txt (modified) (1 diff)
- trunk/openlayers/tests/list-tests.html (modified) (1 diff)
- trunk/openlayers/tests/test_Control_MouseToolbar.html (copied) (copied from branches/openlayers/2.0/tests/test_Control_MouseToolbar.html)
- trunk/openlayers/tests/test_Control_Permalink.html (modified) (1 diff)
- trunk/openlayers/tests/test_Layer.html (modified) (2 diffs)
- trunk/openlayers/tests/test_Layer_EventPane.html (modified) (1 diff)
- trunk/openlayers/tests/test_Layer_Grid.html (modified) (3 diffs)
- trunk/openlayers/tests/test_Layer_KaMap.html (modified) (3 diffs)
- trunk/openlayers/tests/test_Map.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/build/docs.sh
r1270 r1369 3 3 rm ../doc/reference.html 4 4 CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MouseToolbar Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds" 5 echo "<html><head><title>OpenLayers Class Reference Documentation</title><style type='text/css'> .type { background-color: #ddd } td { border: black solid 1px; padding: 3px; } table { border-collapse: collapse; margin: 5px 10px; } .classref { margin-left: 20px; } 6 div.index { float:left; width: 300px; } 7 </style></head><body>" >> ../doc/reference.html 5 echo "<html> 6 <head> 7 <title>OpenLayers Class Reference Documentation</title> 8 <style type='text/css'> 9 .type { background-color: #ddd } 10 td { border: black solid 1px; padding: 3px; } 11 table { border-collapse: collapse; margin: 5px 10px; } 12 .classref { margin-left: 20px; } 13 div.index { float:left; width: 300px; } 14 </style> 15 </head> 16 <body>" >> ../doc/reference.html 8 17 9 18 for i in $CLASSES; do … … 15 24 for i in $CLASSES; do 16 25 cat ../doc/$i.txt | \ 17 perl -pe 's!^(.*?) -- (.*?) -- (.*?)$! <tr><td>$1</td><td>$2</td><td>$3</td></tr>!g ' | \18 perl -pe 's!^( \* )?(.*?) -- (.*?)$! <tr><td>$2</td><td>$3</td></tr>!g' | \ 19 perl -pe 's!^ \* (.*)$! </table>\n\n<h3>$1</h3>\n <table>!' | \ 20 perl -pe 's!{OpenLayers.(.*?)\|(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">\2</a>!g' | \ 21 perl -pe 's!{OpenLayers.(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">OpenLayers.$1</a>!' | \ 22 perl -pe 's!{([A-Za-z]+?)\|(.+?)}!<span class="type" title="$1">\2<\/span>!g' | \ 23 perl -pe 's!{([A-Za-z]+?)}!<span class="type" title="$1">$1<\/span>!g' | \ 24 perl -pe 's!^\* (.*)$!</table>\n<h2>$1</h2>\n<table>!' | \ 25 perl -pe 's!^OpenLayers\.(.*)$!<h1><a name="OpenLayers.$1">OpenLayers.$1</a></h1><div class="classref">!' \26 perl -pe 's!^(.*?) -- (.*?) -- (.*?)$! <tr><td>$1</td><td>$2</td><td>$3</td></tr>!g; 27 s!^( \* )?(.*?) -- (.*?)$! <tr><td>$2</td><td>$3</td></tr>!g; 28 s!^ \* (.*)$! </table>\n\n<h3>$1</h3>\n <table>!; 29 s!{OpenLayers.(.*?)\|(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">\2</a>!g; 30 s!{OpenLayers.(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">OpenLayers.$1</a>!; 31 s!{([A-Za-z]+?)\|(.+?)}!<span class="type" title="$1">\2<\/span>!g; 32 s!{([A-Za-z]+?)}!<span class="type" title="$1">$1<\/span>!g; 33 s!^\* (.*)$!</table>\n<h2>$1</h2>\n<table>!; 34 s!^OpenLayers\.(.*)$!<h1><a name="OpenLayers.$1">OpenLayers.$1</a></h1><div class="classref">!' \ 26 35 >> ../doc/reference.html 27 36 echo '</table></div>' >> ../doc/reference.html 28 37 done 29 echo "</body></html>" >> ../doc/reference.html 38 echo " </body> 39 </html>" >> ../doc/reference.html trunk/openlayers/doc/Control.Permalink.txt
r1247 r1369 1 1 OpenLayers.Control.Permalink 2 2 3 A small control which updates a "Permalink" to the map every time the viewport changes. This allows users to copy a link to a specfic map view. By default, it places itself in the lower right corner of the map ,3 A small control which updates a "Permalink" to the map every time the viewport changes. This allows users to copy a link to a specfic map view. By default, it places itself in the lower right corner of the map. This control must be added to the map after a baselayer has been set. 4 4 5 5 * Constructor trunk/openlayers/doc/Layer.GeoRSS.txt
r1265 r1369 1 1 OpenLayers.Layer.GeoRSS 2 2 3 GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map. 3 GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map. The GeoRSS layer supports 1.0 and 2.0 in IE and Firefox, and supports 2.0 in Safari. (Ticket #111 explains the reason for this difference.) 4 4 5 5 6 * Constructor trunk/openlayers/doc/Layer.WMS.txt
r1261 r1369 1 1 OpenLayers.Layer.WMS 2 2 3 The WMS layer allows one to connect to a WMS server to obtain images. 3 The WMS layer allows one to connect to a WMS server to obtain images. Params are available as a hash on the layer object, however, all keys are upper-cased automatically for maximum compatibility with WMS servers, so a parameter which is set as 'layers' will be uppercased to LAYERS. Where 'layer' is your Javscript variable for the layer, layer.params.LAYERS is the value of the layers param as set by the constructor. 4 5 If you wish to change params, you should use mergeNewParams, rather than accessing the parameters directly. 4 6 5 7 * Constructor … … 10 12 All other methods are inherited from {OpenLayers.Layer.Grid} 11 13 12 * Parameters14 * Options 13 15 isBaseLayer -- WMS layers default to being base layers unless one of their parameters is 'transparent':'true'. trunk/openlayers/examples/google.html
r1243 r1369 24 24 25 25 function init(){ 26 map = new OpenLayers.Map( $('map') ); 26 map = new OpenLayers.Map( $('map') , 27 { controls: [new OpenLayers.Control.MouseDefaults()] }); 27 28 28 var normal = new OpenLayers.Layer.Google( "Google" ); 29 var normal = new OpenLayers.Layer.Google( "Google", // ); 30 { minZoomLevel: 3, maxZoomLevel: 8 }); 29 31 var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP }); 30 32 var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_MAP }); 31 33 32 34 33 map.addLayers([ normal, satellite, hybrid]);35 map.addLayers([satellite, normal, hybrid]); 34 36 35 37 markers = new OpenLayers.Layer.Markers("markers"); … … 38 40 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 39 41 map.addControl( new OpenLayers.Control.LayerSwitcher() ); 42 map.addControl( new OpenLayers.Control.PanZoomBar() ); 40 43 41 44 } trunk/openlayers/examples/kamap.html
r1244 r1369 19 19 20 20 var jpl_wms = new OpenLayers.Layer.KaMap( "Satellite", 21 " /world/index.php", {g: "satellite", map: "world"});21 "http://www.openlayers.org/world/index.php", {g: "satellite", map: "world"}); 22 22 var dm_wms = new OpenLayers.Layer.WMS( "Canada", 23 23 "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap", trunk/openlayers/examples/tiger.html
r822 r1369 15 15 16 16 var ka_wms = new OpenLayers.Layer.KaMap( "TIGER (KaMap)", 17 "http://boston.freemap.in/tile.php" , { map: 'tiger', layers: 'TIGER' } , 'degrees', 72);17 "http://boston.freemap.in/tile.php" , { map: 'tiger', layers: 'TIGER' }); 18 18 var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", 19 19 "http://wms.jpl.nasa.gov/wms.cgi", 20 20 {layers: "modis,global_mosaic"}); 21 21 jpl_wms.setVisibility(false); 22 ka_wms.isBaseLayer = false; 22 23 map.addLayers([jpl_wms,ka_wms]); 23 24 map.addControl(new OpenLayers.Control.LayerSwitcher()); trunk/openlayers/examples/urban.html
r697 r1369 12 12 <!-- 13 13 function init(){ 14 var map = new OpenLayers.Map('map', {'maxResolution': 1.6, maxZoomLevel:20}); 15 14 var mapOptions = { maxResolution: 1.6, numZoomLevels: 21}; 15 var map = new OpenLayers.Map('map', mapOptions); 16 16 17 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 17 18 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} ); … … 19 20 var ww = new OpenLayers.Layer.WorldWind( "Urban", 20 21 "http://worldwind25.arc.nasa.gov/tile/tile.aspx?", .8, 9, 21 {T:"104"}); 22 ww.setTileSize(new OpenLayers.Size(512,512)); 22 {T:"104"}, { tileSize: new OpenLayers.Size(512,512) }); 23 23 24 24 trunk/openlayers/examples/ve.html
r1242 r1369 19 19 var lon = 5; 20 20 var lat = 40; 21 var zoom = 5;21 var zoom = 15; 22 22 var map, velayer, layer; 23 23 24 24 function init(){ 25 map = new OpenLayers.Map( $('map') ); 25 map = new OpenLayers.Map( $('map') , 26 {controls:[new OpenLayers.Control.MouseDefaults()]}); 26 27 27 velayer = new OpenLayers.Layer.VirtualEarth( "VE"); 28 velayer = new OpenLayers.Layer.VirtualEarth( "VE", 29 { minZoomLevel: 4, maxZoomLevel: 6 }); 28 30 map.addLayer(velayer); 29 31 … … 31 33 map.addLayer(markers); 32 34 33 map.setCenter(new OpenLayers.LonLat(lon, lat), 2);35 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 34 36 map.addControl( new OpenLayers.Control.LayerSwitcher() ); 37 map.addControl( new OpenLayers.Control.PanZoomBar() ); 35 38 } 36 39 trunk/openlayers/examples/wmst.html
r844 r1369 36 36 <h1>OpenLayers Example</h1> 37 37 <p>WMS-T example: update the times, and the radar image will change. Uses Layer.changeParams. Thanks to David Bitner for the inspiration, the original code, and the kick in the butt!</p> 38 <input type='text' id='time' value="2005-08-29T13:00:00Z" onChange='ia_wms. changeParams({"time":this.value});' >38 <input type='text' id='time' value="2005-08-29T13:00:00Z" onChange='ia_wms.mergeNewParams({"time":this.value});' > 39 39 <div id="map"></div> 40 40 </body> trunk/openlayers/lib/OpenLayers/BaseTypes.js
r1228 r1369 421 421 */ 422 422 add:function(x, y){ 423 return new OpenLayers.Bo x(this.left + x, this.bottom + y,424 this.right + x, this.top + y);423 return new OpenLayers.Bounds(this.left + x, this.bottom + y, 424 this.right + x, this.top + y); 425 425 }, 426 426 trunk/openlayers/lib/OpenLayers/Control/LayerSwitcher.js
r1206 r1369 120 120 inputElem.value = layer.name; 121 121 inputElem.checked = checked; 122 inputElem.defaultChecked = checked; 122 123 inputElem.layer = layer; 124 inputElem.control = this; 125 Event.observe(inputElem, "mouseup", 126 this.onInputClick.bindAsEventListener(inputElem)); 123 127 124 128 // create span … … 126 130 labelSpan.innerHTML = layer.name; 127 131 labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "auto"; 128 Event.observe(labelSpan, 129 "click", 130 this.onLabelClick.bindAsEventListener(inputElem)); 131 132 Event.observe(labelSpan, "click", 133 this.onInputClick.bindAsEventListener(inputElem)); 132 134 // create line break 133 135 var br = document.createElement("br"); … … 159 161 * @param {Event} e 160 162 */ 161 onLabelClick: function(e) { 162 var clickedRadioButton = ((this.type == "radio") && (this.checked)); 163 if (!clickedRadioButton) { 163 164 onInputClick: function(e) { 165 if (this.type == "radio") { 166 this.checked = true; 167 this.layer.map.setBaseLayer(this.layer, true); 168 this.layer.map.events.triggerEvent("changebaselayer"); 169 } else { 164 170 this.checked = !this.checked; 165 } 171 this.control.updateMap(); 172 } 173 Event.stop(e); 166 174 }, 167 175 … … 190 198 var input = this.baseLayerInputs[i]; 191 199 if (input.checked) { 192 this.map.setBaseLayer(input.layer, true);200 this.map.setBaseLayer(input.layer, false); 193 201 } 194 202 } … … 272 280 Event.observe(this.div, "mouseup", 273 281 this.mouseUp.bindAsEventListener(this)); 282 Event.observe(this.div, "click", 283 this.ignoreEvent); 274 284 Event.observe(this.div, "mousedown", 275 285 this.mouseDown.bindAsEventListener(this)); … … 302 312 this.baseLayersDiv = document.createElement("div"); 303 313 this.baseLayersDiv.style.paddingLeft = "10px"; 304 Event.observe(this.baseLayersDiv, "click",314 /*Event.observe(this.baseLayersDiv, "click", 305 315 this.onLayerClick.bindAsEventListener(this)); 316 */ 306 317 this.layersDiv.appendChild(this.baseLayersDiv); 307 318 … … 316 327 this.dataLayersDiv = document.createElement("div"); 317 328 this.dataLayersDiv.style.paddingLeft = "10px"; 318 Event.observe(this.dataLayersDiv, "click",329 /*Event.observe(this.dataLayersDiv, "click", 319 330 this.onLayerClick.bindAsEventListener(this)); 331 */ 320 332 this.layersDiv.appendChild(this.dataLayersDiv); 321 333 trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js
r1248 r1369 61 61 this.map.setCenter(newCenter, this.map.zoom + 1); 62 62 Event.stop(evt); 63 return false; 63 64 }, 64 65 … … 81 82 this.zoomBox.style.filter = "alpha(opacity=50)"; // IE 82 83 this.zoomBox.style.opacity = "0.50"; 84 this.zoomBox.style.fontSize = "1px"; 83 85 this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; 84 86 this.map.viewPortDiv.appendChild(this.zoomBox); … … 96 98 var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); 97 99 var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); 98 this.zoomBox.style.width = deltaX+"px";99 this.zoomBox.style.height = deltaY+"px";100 this.zoomBox.style.width = Math.max(1, deltaX) + "px"; 101 this.zoomBox.style.height = Math.max(1, deltaY) + "px"; 100 102 if (evt.xy.x < this.mouseDragStart.x) { 101 103 this.zoomBox.style.left = evt.xy.x+"px"; … … 125 127 if (!Event.isLeftClick(evt)) return; 126 128 if (this.zoomBox) { 127 var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart ); 128 var end = this.map.getLonLatFromViewPortPx( evt.xy ); 129 var top = Math.max(start.lat, end.lat); 130 var bottom = Math.min(start.lat, end.lat); 131 var left = Math.min(start.lon, end.lon); 132 var right = Math.max(start.lon, end.lon); 133 var bounds = new OpenLayers.Bounds(left, bottom, right, top); 134 var zoom = this.map.getZoomForExtent(bounds); 135 this.map.setCenter(new OpenLayers.LonLat( 136 (start.lon + end.lon) / 2, 137 (start.lat + end.lat) / 2 138 ), zoom); 139 this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 140 this.zoomBox = null; 129 this.zoomBoxEnd(evt); 141 130 } else { 142 131 if (this.performedDrag) { … … 172 161 defaultWheelDown: function() { 173 162 this.map.zoomOut(); 163 }, 164 165 /** Zoombox function. 166 * 167 */ 168 zoomBoxEnd: function(evt) { 169 if (this.mouseDragStart != null) { 170 if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 || 171 Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) { 172 var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart ); 173 var end = this.map.getLonLatFromViewPortPx( evt.xy ); 174 var top = Math.max(start.lat, end.lat); 175 var bottom = Math.min(start.lat, end.lat); 176 var left = Math.min(start.lon, end.lon); 177 var right = Math.max(start.lon, end.lon); 178 var bounds = new OpenLayers.Bounds(left, bottom, right, top); 179 var zoom = this.map.getZoomForExtent(bounds); 180 this.map.setCenter(new OpenLayers.LonLat( 181 (start.lon + end.lon) / 2, 182 (start.lat + end.lat) / 2 183 ), zoom); 184 } else { 185 var end = this.map.getLonLatFromViewPortPx( evt.xy ); 186 this.map.setCenter(new OpenLayers.LonLat( 187 (end.lon), 188 (end.lat) 189 ), this.map.getZoom() + 1); 190 } 191 this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 192 this.zoomBox = null; 193 } 174 194 }, 175 195 … … 190 210 var elem = Event.element(e); 191 211 while(elem != null) { 192 if ( elem == this.map.div) {212 if (this.map && elem == this.map.div) { 193 213 inMap = true; 194 214 break; trunk/openlayers/lib/OpenLayers/Control/MouseToolbar.js
r1206 r1369 7 7 * 8 8 * @requires OpenLayers/Control.js 9 * @requires OpenLayers/Control/MouseDefaults.js 9 10 */ 10 11 OpenLayers.Control.MouseToolbar = Class.create(); … … 12 13 OpenLayers.Control.MouseToolbar.Y = 300; 13 14 OpenLayers.Control.MouseToolbar.prototype = 14 Object.extend( new OpenLayers.Control(), { 15 Object.extend( new OpenLayers.Control(), 16 Object.extend( new OpenLayers.Control.MouseDefaults(), { 15 17 16 18 mode: null, … … 36 38 OpenLayers.Control.prototype.draw.apply(this, arguments); 37 39 this.buttons = new Object(); 40 this.map.events.register( "click", this, this.defaultClick ); 38 41 this.map.events.register( "dblclick", this, this.defaultDblClick ); 39 42 this.map.events.register( "mousedown", this, this.defaultMouseDown ); … … 47 50 this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan."); 48 51 centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); 49 this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz, "Hold alt when clicking to show distance between selected points");50 52 this.switchModeTo("pan"); 51 this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); });52 53 return this.div; 53 54 … … 70 71 btn.events.register("mousedown", this, this.buttonClick); 71 72 btn.events.register("mouseup", this, Event.stop); 73 btn.events.register("click", this, Event.stop); 72 74 btn.action = id; 73 75 btn.title = title; … … 94 96 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy ); 95 97 this.map.setCenter(newCenter, this.map.zoom + 2); 98 Event.stop(evt); 99 return false; 96 100 }, 97 101 … … 103 107 this.mouseDragStart = evt.xy.clone(); 104 108 this.performedDrag = false; 109 this.startViaKeyboard = false; 105 110 if (evt.shiftKey && this.mode !="zoombox") { 106 111 this.switchModeTo("zoombox"); 112 this.startViaKeyboard = true; 107 113 } else if (evt.altKey && this.mode !="measure") { 108 114 this.switchModeTo("measure"); … … 123 129 this.zoomBox.style.filter = "alpha(opacity=50)"; // IE 124 130 this.zoomBox.style.opacity = "0.50"; 131 this.zoomBox.style.fontSize = "1px"; 125 132 this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; 126 133 this.map.viewPortDiv.appendChild(this.zoomBox); 134 this.performedDrag = true; 127 135 break; 128 136 case "measure": … … 145 153 this.measureBox.style.width="4px"; 146 154 this.measureBox.style.height="4px"; 155 this.measureBox.style.fontSize = "1px"; 147 156 this.measureBox.style.backgroundColor="red"; 148 157 this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; … … 176 185 switchModeTo: function(mode) { 177 186 if (mode != this.mode) { 178 if (this.mode ) {187 if (this.mode && this.buttons[this.mode]) { 179 188 OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation); 180 189 } … … 189 198 } 190 199 this.mode = mode; 191 OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation); 200 if (this.buttons[mode]) { 201 OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation); 202 } 192 203 } 193 204 }, … … 206 217 var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); 207 218 var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); 208 this.zoomBox.style.width = deltaX+"px";209 this.zoomBox.style.height = deltaY+"px";219 this.zoomBox.style.width = Math.max(1, deltaX) + "px"; 220 this.zoomBox.style.height = Math.max(1, deltaY) + "px"; 210 221 if (evt.xy.x < this.mouseDragStart.x) { 211 222 this.zoomBox.style.left = evt.xy.x+"px"; … … 236 247 switch (this.mode) { 237 248 case "zoombox": 238 var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart ); 239 var end = this.map.getLonLatFromViewPortPx( evt.xy ); 240 var top = Math.max(start.lat, end.lat); 241 var bottom = Math.min(start.lat, end.lat); 242 var left = Math.min(start.lon, end.lon); 243 var right = Math.max(start.lon, end.lon); 244 var bounds = new OpenLayers.Bounds(left, bottom, right, top); 245 var zoom = this.map.getZoomForExtent(bounds); 246 this.map.setCenter(new OpenLayers.LonLat( 247 (start.lon + end.lon) / 2, 248 (start.lat + end.lat) / 2 249 ), zoom); 250 this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 251 this.zoomBox = null; 252 this.leaveMode(); 249 this.zoomBoxEnd(evt); 250 if (this.startViaKeyboard) this.leaveMode(); 253 251 break; 254 252 case "pan": … … 267 265 this.defaultMouseUp(evt); 268 266 } 267 }, 268 defaultClick: function (evt) { 269 if (this.performedDrag) { 270 this.performedDrag = false; 271 return false; 272 } 269 273 } 270 }) ;271 274 })); 275 trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js
r1206 r1369 26 26 this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X, 27 27 OpenLayers.Control.PanZoomBar.Y); 28 29 // put code here to catch "changebaselayer" event from map, because 30 // we are going to have to redraw this thing each time, because 31 // maxZoom will/might change. 32 }, 33 28 }, 29 30 /** 31 * @param {OpenLayers.Map} map 32 */ 33 setMap: function(map) { 34 OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments); 35 this.map.events.register("changebaselayer", this, this.redraw); 36 }, 37 38 /** clear the div and start over. 39 * 40 */ 41 redraw: function() { 42 if (this.div != null) { 43 this.div.innerHTML = ""; 44 } 45 this.draw(); 46 }, 47 34 48 /** 35 49 * @param {OpenLayers.Pixel} px … … 38 52 // initialize our internal div 39 53 OpenLayers.Control.prototype.draw.apply(this, arguments); 40 px = this.position ;54 px = this.position.clone(); 41 55 42 56 // place the controls … … 64 78 65 79 var id = "OpenLayers_Control_PanZoomBar_Slider" + this.map.id; 80 var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom(); 66 81 var slider = OpenLayers.Util.createAlphaImageDiv(id, 67 centered.add(-1, 68 (this.map.getMaxZoomLevel())*this.zoomStopHeight), 82 centered.add(-1, zoomsToEnd * this.zoomStopHeight), 69 83 new OpenLayers.Size(20,9), 70 84 imgLocation+"slider.png", … … 80 94 81 95 sz = new OpenLayers.Size(); 82 sz.h = this.zoomStopHeight *(this.map.getMaxZoomLevel()+1);96 sz.h = this.zoomStopHeight * this.map.getNumZoomLevels(); 83 97 sz.w = this.zoomStopWidth; 84 98 var div = null … … 116 130 117 131 centered = centered.add(0, 118 this.zoomStopHeight *(this.map.getMaxZoomLevel()+1));132 this.zoomStopHeight * this.map.getNumZoomLevels()); 119 133 return centered; 120 134 }, … … 137 151 var top = Position.page(evt.object)[1]; 138 152 var levels = Math.floor((y - top)/this.zoomStopHeight); 139 this.map.zoomTo( this.map.getMaxZoomLevel() -levels);153 this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels); 140 154 Event.stop(evt); 141 155 }, … … 171 185 } 172 186 this.mouseDragStart = evt.xy.clone(); 187 Event.stop(evt); 173 188 } 174 Event.stop(evt);175 189 }, 176 190 … … 184 198 if (this.zoomStart) { 185 199 this.div.style.cursor="default"; 186 this.map.events. remove("mousemove");187 this.map.events. remove("mouseup");200 this.map.events.unregister("mouseup", this, this.passEventToSlider); 201 this.map.events.unregister("mousemove", this, this.passEventToSlider); 188 202 var deltaY = this.zoomStart.y - evt.xy.y 189 203 this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); … … 199 213 moveZoomBar:function() { 200 214 var newTop = 201 ( this.map.getMaxZoomLevel() - this.map.getZoom()) * this.zoomStopHeight202 + this.startTop + 1;215 ((this.map.getNumZoomLevels()-1) - this.map.getZoom()) * 216 this.zoomStopHeight + this.startTop + 1; 203 217 this.slider.style.top = newTop + "px"; 204 218 }, trunk/openlayers/lib/OpenLayers/Feature/WFS.js
r1206 r1369 49 49 // must return an Object with 'id' and 'lonlat' values set 50 50 var point = xmlNode.getElementsByTagName("Point"); 51 var text = OpenLayers.Util.getXmlNodeValue(point[0] );51 var text = OpenLayers.Util.getXmlNodeValue(point[0].getElementsByTagName("coordinates")[0]); 52 52 var floats = text.split(","); 53 54 53 return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]), 55 54 parseFloat(floats[1])), trunk/openlayers/lib/OpenLayers/Layer.js
r1259 r1369 52 52 53 53 /** @type int */ 54 minZoomLevel: null, 55 56 /** @type int */ 57 maxZoomLevel: null, 54 numZoomLevels: null, 58 55 59 56 /** @type float */ … … 149 146 }, 150 147 148 /** 149 * 150 */ 151 onMapResize: function() { 152 //this function can be implemented by subclasses 153 }, 151 154 152 155 /** … … 164 167 * they have their map variable set. 165 168 * 169 * Here we take care to bring over any of the necessary default properties 170 * from the map. 171 * 166 172 * @param {OpenLayers.Map} map 167 173 */ … … 170 176 171 177 var properties = new Array( 172 'projection', 'minExtent', 'maxExtent', 173 'minScale', 'maxScale', 178 'projection', 'units', 179 'scales', 'resolutions', 180 'maxScale', 'minScale', 174 181 'maxResolution', 'minResolution', 175 'minZoomLevel', 'maxZoomLevel', 'units', 176 'scales', 'resolutions' 177 182 'minExtent', 'maxExtent', 183 'numZoomLevels' 178 184 ); 185 if (this.map.maxZoomLevel && !this.numZoomLevels) { 186 this.numZoomLevels = this.map.maxZoomLevel + 1; 187 } 179 188 for(var i=0; i < properties.length; i++) { 180 189 if (this[properties[i]] == null) { … … 221 230 /********************************************************/ 222 231 232 /** 233 * @param {Boolean} isBaseLayer 234 */ 235 setIsBaseLayer: function(isBaseLayer) { 236 this.isBaseLayer = isBaseLayer; 237 if (this.map != null) { 238 this.map.events.triggerEvent("changelayer"); 239 } 240 }, 241 223 242 /** 224 243 * @type String … … 243 262 244 263 /** 245 * @returns The minimum zoom level that can be reached in this layer264 * @returns The total number of zoom levels this layer can reach 246 265 * @type int 247 266 */ 248 getMinZoomLevel: function() { 249 return this.minZoomLevel; 250 }, 251 252 /** 253 * @returns The maximum zoom level that can be reached in this layer 254 * @type int 255 */ 256 getMaxZoomLevel: function() { 257 return this.maxZoomLevel; 267 getNumZoomLevels: function() { 268 return this.numZoomLevels; 258 269 }, 259 270 … … 273 284 getResolution: function() { 274 285 var viewSize = this.map.getSize(); 275 var extent = this. map.getExtent();286 var extent = this.getExtent(); 276 287 return Math.max( extent.getWidth() / viewSize.w, 277 288 extent.getHeight() / viewSize.h ); … … 317 328 getLonLatFromViewPortPx: function (viewPortPx) { 318 329 var size = this.map.getSize(); 319 var center = this.map.getCenter(); //map center lon/lat330 var center = this.map.getCenter(); 320 331 var res = this.map.getResolution(); 321 332 trunk/openlayers/lib/OpenLayers/Layer/EventPane.js
r1337 r1369 38 38 if (this.pane == null) { 39 39 this.pane = OpenLayers.Util.createDiv(); 40 this.pane.style.width = "100%";41 this.pane.style.height = "100%";42 this.pane.style.backgroundColor = "transparent";43 40 } 44 41 } … … 53 50 setMap: function(map) { 54 51 OpenLayers.Layer.prototype.setMap.apply(this, arguments); 55 52 56 53 this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1; 57 54 this.pane.style.display = this.div.style.display; 55 this.pane.style.width="100%"; 56 this.pane.style.height="100%"; 57 if (/MSIE/.test(navigator.userAgent)) { 58 this.pane.style.background = "url("+OpenLayers.Util.getImagesLocation()+"blank.gif)"; 59 } 60 58 61 if (this.isFixed) { 59 62 this.map.viewPortDiv.appendChild(this.pane);
