Changeset 1501
- Timestamp:
- 09/26/06 15:24:00 (2 years ago)
- Files:
-
- branches/openlayers/2.1/examples/fullScreen.html (copied) (copied from trunk/openlayers/examples/fullScreen.html)
- branches/openlayers/2.1/examples/getfeatureinfo.html (copied) (copied from trunk/openlayers/examples/getfeatureinfo.html)
- branches/openlayers/2.1/examples/layer-opacity.html (copied) (copied from trunk/openlayers/examples/layer-opacity.html)
- branches/openlayers/2.1/examples/proxy.cgi (modified) (1 diff)
- branches/openlayers/2.1/examples/scroll.html (copied) (copied from trunk/openlayers/examples/scroll.html)
- branches/openlayers/2.1/examples/worldwind.html (modified) (2 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Feature.js (modified) (2 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Layer.js (modified) (2 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Layer/WorldWind.js (modified) (3 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Map.js (modified) (4 diffs)
- branches/openlayers/2.1/lib/OpenLayers/Marker.js (modified) (1 diff)
- branches/openlayers/2.1/lib/OpenLayers/Util.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/openlayers/2.1/examples/proxy.cgi
r1424 r1501 21 21 # Designed to prevent Open Proxy type stuff. 22 22 23 allowedHosts = ['www.openlayers.org', 'openlayers.org', 'octo.metacarta.com', 'merrimack.metacarta.com', 'labs.metacarta.com' ]23 allowedHosts = ['www.openlayers.org', 'openlayers.org', 'octo.metacarta.com', 'merrimack.metacarta.com', 'labs.metacarta.com', 'world.freemap.in'] 24 24 25 25 try: branches/openlayers/2.1/examples/worldwind.html
r1424 r1501 11 11 <script type="text/javascript"> 12 12 <!-- 13 var ol_wms, ww, ww2; 13 14 function init(){ 14 var map = new OpenLayers.Map('map', {'maxResolution': . 0703125*4});15 var map = new OpenLayers.Map('map', {'maxResolution': .28125, tileSize: new OpenLayers.Size(512, 512)}); 15 16 16 varol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",17 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );17 ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 18 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} ); 18 19 19 var ww = new OpenLayers.Layer.WorldWind( "Bathy", 20 "http://worldwind25.arc.nasa.gov/tile/tile.aspx?", 36, 4, 21 {T:"bmng.topo.bathy.200406"}); 22 ww.setTileSize(new OpenLayers.Size(512,512)); 23 var ww2 = new OpenLayers.Layer.WorldWind( "LANDSAT", 20 ww = new OpenLayers.Layer.WorldWind( "Bathy", 21 "http://worldwind25.arc.nasa.gov/tile/tile.aspx?", 36, 4, 22 {T:"bmng.topo.bathy.200406"}); 23 ww2 = new OpenLayers.Layer.WorldWind( "LANDSAT", 24 24 "http://worldwind25.arc.nasa.gov/tile/tile.aspx", 2.25, 4, 25 25 {T:"105"}); 26 ww2.setTileSize(new OpenLayers.Size(512,512));27 26 28 27 … … 38 37 <h1>OpenLayers Example</h1> 39 38 <div id="map"></div> 39 <p>This is a demonstration of using Tiled WorldWind layers. WorldWind requires you to define a "LZTD" -- the 3rd param of the constructor -- and the number of zoom levels it supports. When a worldwind layer is not visible at a given tile level, and empty tile is placed there instead. Note that the maxResolution of the map times 512px, must be a multiple of a power of two different from the LZTD -- in this case, .28125 * 512 is 144, which is 36*4, and 2.25*64.</p> 40 <p>This example has a 'Bathy' layer, visible as you zoom out, and a 'landsat' layer, visible as you zoom in, both visible at zoom level 6.</p> 40 41 </body> 41 42 </html> branches/openlayers/2.1/lib/OpenLayers/Feature.js
r1424 r1501 64 64 this.data = null; 65 65 if (this.marker != null) { 66 this. marker.destroy();66 this.destroyMarker(this.marker); 67 67 this.marker = null; 68 68 } … … 90 90 }, 91 91 92 destroyMarker: function() { 93 this.marker.destroy(); 94 }, 95 92 96 /** 93 97 * branches/openlayers/2.1/lib/OpenLayers/Layer.js
r1481 r1501 410 410 */ 411 411 getLonLatFromViewPortPx: function (viewPortPx) { 412 var size = this.map.getSize(); 413 var center = this.map.getCenter(); 414 var res = this.map.getResolution(); 415 416 var delta_x = viewPortPx.x - (size.w / 2); 417 var delta_y = viewPortPx.y - (size.h / 2); 418 419 return new OpenLayers.LonLat(center.lon + delta_x * res , 420 center.lat - delta_y * res); 412 var lonlat = null; 413 if (viewPortPx != null) { 414 var size = this.map.getSize(); 415 var center = this.map.getCenter(); 416 var res = this.map.getResolution(); 417 418 var delta_x = viewPortPx.x - (size.w / 2); 419 var delta_y = viewPortPx.y - (size.h / 2); 420 421 lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , 422 center.lat - delta_y * res); 423 } 424 return lonlat; 421 425 }, 422 426 … … 429 433 */ 430 434 getViewPortPxFromLonLat: function (lonlat) { 431 var resolution = this.map.getResolution(); 432 var extent = this.map.getExtent(); 433 return new OpenLayers.Pixel( 434 Math.round(1/resolution * (lonlat.lon - extent.left)), 435 Math.round(1/resolution * (extent.top - lonlat.lat)) 436 ); 435 var px = null; 436 if (lonlat != null) { 437 var resolution = this.map.getResolution(); 438 var extent = this.map.getExtent(); 439 px = new OpenLayers.Pixel( 440 Math.round(1/resolution * (lonlat.lon - extent.left)), 441 Math.round(1/resolution * (extent.top - lonlat.lat)) 442 ); 443 } 444 return px; 437 445 }, 438 446 branches/openlayers/2.1/lib/OpenLayers/Layer/WorldWind.js
r1424 r1501 47 47 url, this.tileSize); 48 48 } else { 49 var tile = new Object(); 50 tile.draw = function() {}; 51 tile.destroy = function() {}; 52 tile.bounds = bounds; 53 tile.bounds = position; 54 return tile; 49 return new OpenLayers.Tile.Image(this, position, bounds, 50 OpenLayers.Util.getImagesLocation() + "blank.gif", 51 this.tileSize); 55 52 } 56 53 }, … … 59 56 var zoom = this.map.getZoom(); 60 57 var extent = this.map.getMaxExtent(); 61 zoom = zoom - Math.log(this.ma p.maxResolution / (this.lzd/512))/Math.log(2);58 zoom = zoom - Math.log(this.maxResolution / (this.lzd/512))/Math.log(2); 62 59 return zoom; 63 60 }, … … 72 69 */ 73 70 getURL: function (bounds) { 71 var zoom = this.getZoom(); 72 var extent = this.map.getMaxExtent(); 74 73 var deg = this.lzd/Math.pow(2,this.getZoom()); 75 74 var x = Math.floor((bounds.left - extent.left)/deg); 76 75 var y = Math.floor((bounds.bottom - extent.bottom)/deg); 77 return this.getFullRequestString( 76 if (this.map.getResolution() <= (this.lzd/512) 77 && this.getZoom() <= this.zoomLevels) { 78 return this.getFullRequestString( 78 79 { L: zoom, 79 80 X: x, 80 81 Y: y 81 82 }); 83 } else { 84 return OpenLayers.Util.getImagesLocation() + "blank.gif"; 85 } 82 86 83 87 }, branches/openlayers/2.1/lib/OpenLayers/Map.js
r1448 r1501 439 439 this.popups.remove(popup); 440 440 if (popup.div) { 441 this.layerContainerDiv.removeChild(popup.div); 441 try { this.layerContainerDiv.removeChild(popup.div); } 442 catch (e) { } // Popups sometimes apparently get disconnected 443 // from the layerContainerDiv, and cause complaints. 442 444 } 443 445 popup.map = null; … … 476 478 this.layers[i].onMapResize(); 477 479 } 478 479 var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2);480 481 var zoom = this.getZoom();482 this.zoom = null;483 this.setCenter(center, zoom);484 480 485 481 // store the new size … … 487 483 // the div might have moved on the page, also 488 484 this.events.element.offsets = null; 485 486 if (this.baseLayer != null) { 487 var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2); 488 var centerLL = this.getLonLatFromViewPortPx(center); 489 var zoom = this.getZoom(); 490 this.zoom = null; 491 this.setCenter(this.getCenter(), zoom); 492 } 493 489 494 } 490 495 }, … … 993 998 var dY = -parseInt(this.layerContainerDiv.style.top); 994 999 layerPx = viewPortPx.add(dX, dY); 995 }996 if (!isNaN(layerPx.x) && !isNaN(layerPx.y)) {997 return layerPx;998 } 999 return null;1000 if (isNaN(layerPx.x) || isNaN(layerPx.y)) { 1001 layerPx = null; 1002 } 1003 } 1004 return layerPx; 1000 1005 }, 1001 1006 branches/openlayers/2.1/lib/OpenLayers/Marker.js
r1424 r1501 31 31 if (arguments.length > 0) { 32 32 this.lonlat = lonlat; 33 this.icon = (icon) ? icon : OpenLayers.Marker.defaultIcon(); 33 34 var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon(); 35 if (this.icon == null) { 36 this.icon = newIcon; 37 } else { 38 this.icon.url = newIcon.url; 39 this.icon.size = newIcon.size; 40 this.icon.offset = newIcon.offset; 41 this.icon.calculateOffset = newIcon.calculateOffset; 42 } 34 43 this.events = new OpenLayers.Events(this, this.icon.imageDiv, null); 35 44 } branches/openlayers/2.1/lib/OpenLayers/Util.js
r1440 r1501 149 149 OpenLayers.Util.onImageLoadError = function() { 150 150 this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor; 151 this.style.display = ""; 151 152 }; 152 153
