Changeset 1695
- Timestamp:
- 10/13/06 16:41:21 (2 years ago)
- Files:
-
- trunk/openlayers/build/docs.sh (modified) (1 diff)
- trunk/openlayers/build/library.cfg (modified) (1 diff)
- trunk/openlayers/doc/Layer.HTTPRequest.txt (modified) (1 diff)
- trunk/openlayers/doc/Layer.txt (modified) (2 diffs)
- trunk/openlayers/doc/authors.txt (modified) (1 diff)
- trunk/openlayers/examples/baseLayers.html (modified) (3 diffs)
- trunk/openlayers/examples/controls.html (modified) (1 diff)
- trunk/openlayers/examples/google.html (modified) (2 diffs)
- trunk/openlayers/examples/layer-opacity.html (modified) (1 diff)
- trunk/openlayers/examples/notile.html (modified) (1 diff)
- trunk/openlayers/examples/tiger.html (modified) (1 diff)
- trunk/openlayers/examples/ve.html (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Control.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/EventPane.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/FixedZoomLevels.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/GeoRSS.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/Google.js (modified) (6 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/HTTPRequest.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/MultiMap.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/VirtualEarth.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/WMS.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/Yahoo.js (modified) (3 diffs)
- trunk/openlayers/lib/OpenLayers/Map.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Popup.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Popup/AnchoredBubble.js (modified) (4 diffs)
- trunk/openlayers/lib/OpenLayers/Tile.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Tile/Image.js (modified) (5 diffs)
- trunk/openlayers/lib/OpenLayers/Util.js (modified) (1 diff)
- trunk/openlayers/tests/list-tests.html (modified) (2 diffs)
- trunk/openlayers/tests/test_Layer_EventPane.html (modified) (2 diffs)
- trunk/openlayers/tests/test_Layer_WMS.html (modified) (5 diffs)
- trunk/openlayers/tests/test_Popup.html (modified) (1 diff)
- trunk/openlayers/tests/test_Tile_Image.html (modified) (5 diffs)
- trunk/openlayers/theme/default/style.css (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/build/docs.sh
r1665 r1695 2 2 3 3 rm ../doc/reference.html 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.MousePosition Control.MouseToolbar Control. PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util"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.MousePosition Control.MouseToolbar Control.OverviewMap Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds Util Ajax" 5 5 echo "<html> 6 6 <head> trunk/openlayers/build/library.cfg
r1594 r1695 3 3 OpenLayers.js 4 4 OpenLayers/BaseTypes.js 5 OpenLayers/Util.js 5 6 Rico/Corner.js 6 7 trunk/openlayers/doc/Layer.HTTPRequest.txt
r1424 r1695 7 7 8 8 * Methods 9 initResolutions() -- none -- Based on the current minScale/maxScale/maxResolution/ maxZoomLevels/scales/resolutions parameters, initializes an array of 'zoom levels' as this.resolutions, which are then used as an index into when zooming.9 initResolutions() -- none -- Based on the current minScale/maxScale/maxResolution/numZoomLevel/scales/resolutions parameters, initializes an array of 'zoom levels' as this.resolutions, which are then used as an index into when zooming. 10 10 getFullRequestString(newParams) -- {String} -- Returns the full request string for a combination of the defaults on this layer and the parameters passed via newParams. 11 11 12 * Options 13 reproject -- If reproject is true, then the layer will alter the bounding boxes of its tiles to be based on the geographic location of the pixel bounds in the base layer. This is important for reprojecting WMS tiles onto something like Google Maps. Tile locations are calculated, and then when creating the tile request, the bounding box is adjusted to match the bounding box of the base layer at that location. trunk/openlayers/doc/Layer.txt
r1531 r1695 21 21 getLonLatFromViewPortPx({OpenLayers.Pixel|pixel}) -- {OpenLayers.LonLat} -- Returns an OpenLayers.LonLat which is the passed-in view port OpenLayers.Pixel, translated into lon/lat by the laye 22 22 getViewPortPxFromLonLat({OpenLayers.LonLat|lonlat}) -- {OpenLayers.Pixel} -- Returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, translated into view port pixels 23 addOptions({options})) -- none -- Change the options on the layer. This is the supported way to change properties of the layer. 23 24 24 25 * Parameters … … 32 33 maxScale -- The scale at the highest zoom level. If this is set on the map before the Layer is added to the map, it will inherit from the map. 33 34 units -- The units the map is projected into. If this is set on the map before the Layer is added to the map, it will inherit from the map. 35 34 36 35 37 trunk/openlayers/doc/authors.txt
r1665 r1695 12 12 Tim Schaub 13 13 Jeff Dege 14 Sean Gilles 14 15 15 16 OpenLayers is graciously supported by MetaCarta, Inc. trunk/openlayers/examples/baseLayers.html
r1592 r1695 14 14 <!-- Localhost key --> 15 15 <!-- <script src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>--> 16 <script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script> 16 17 <script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script> 18 <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script> 17 19 <script src="../lib/OpenLayers.js"></script> 18 20 <script type="text/javascript"> … … 35 37 var google = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_MAP }); 36 38 var ve = new OpenLayers.Layer.VirtualEarth( "VE"); 39 var yahoo = new OpenLayers.Layer.Yahoo( "Yahoo"); 40 var mm = new OpenLayers.Layer.MultiMap( "MultiMap"); 37 41 38 42 39 map.addLayers([wms, google, ve ]);43 map.addLayers([wms, google, ve, yahoo, mm]); 40 44 41 45 markers = new OpenLayers.Layer.Markers("markers"); … … 44 48 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 45 49 map.addControl( new OpenLayers.Control.LayerSwitcher() ); 50 map.addControl( new OpenLayers.Control.MousePosition() ); 46 51 47 52 } trunk/openlayers/examples/controls.html
r1665 r1695 20 20 map.addControl(new OpenLayers.Control.Permalink($('permalink'))); 21 21 map.addControl(new OpenLayers.Control.MousePosition()); 22 map.addControl(new OpenLayers.Control.OverviewMap()); 22 23 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 23 24 "http://labs.metacarta.com/wms/vmap0", trunk/openlayers/examples/google.html
r1592 r1695 19 19 var lon = 5; 20 20 var lat = 40; 21 var zoom = 1 8;21 var zoom = 17; 22 22 var map, layer; 23 23 … … 30 30 31 31 map.addLayers([satellite]); 32 32 layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 33 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic', 'transparent':true}, 34 {isBaseLayer: false} ); 35 layer.setVisibility(false); 36 layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 37 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic', 'transparent':true}, 38 {isBaseLayer: false} ); 39 layer.setVisibility(false); 40 map.addLayer(layer); 41 var twms = new OpenLayers.Layer.WMS( "World Map", 42 "http://world.freemap.in/cgi-bin/mapserv?", 43 {map: '/www/freemap.in/world/map/factbooktrans.map', transparent:'true', 44 layers: 'factbook', 'format':'png'} ); 45 map.addLayer(twms); 33 46 markers = new OpenLayers.Layer.Markers("markers"); 34 47 map.addLayer(markers); 35 48 36 map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), zoom);49 map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5); 37 50 map.addControl( new OpenLayers.Control.LayerSwitcher() ); 38 51 map.addControl( new OpenLayers.Control.PanZoomBar() ); trunk/openlayers/examples/layer-opacity.html
r1490 r1695 41 41 var minOpacity = 0.1; 42 42 function changeOpacity(byOpacity) { 43 var newOpacity = (parseFloat($ F('opacity')) + byOpacity).toFixed(1);43 var newOpacity = (parseFloat($('opacity').value) + byOpacity).toFixed(1); 44 44 newOpacity = Math.min(maxOpacity, 45 45 Math.max(minOpacity, newOpacity)); trunk/openlayers/examples/notile.html
r1424 r1695 16 16 var ol_wms = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS", 17 17 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} ); 18 ol_wms. isBaseLayer = true;18 ol_wms.addOptions({isBaseLayer: true}); 19 19 map.addLayers([ol_wms]); 20 20 map.addControl(new OpenLayers.Control.LayerSwitcher()); trunk/openlayers/examples/tiger.html
r1424 r1695 20 20 {layers: "modis,global_mosaic"}); 21 21 jpl_wms.setVisibility(false); 22 ka_wms. isBaseLayer = false;22 ka_wms.addOptions({isBaseLayer: false}); 23 23 map.addLayers([jpl_wms,ka_wms]); 24 24 map.addControl(new OpenLayers.Control.LayerSwitcher()); trunk/openlayers/examples/ve.html
r1592 r1695 28 28 { minZoomLevel: 4, maxZoomLevel: 6, 'type': VEMapStyle.Aerial}); 29 29 map.addLayer(velayer); 30 31 var twms = new OpenLayers.Layer.WMS( "World Map", 32 "http://world.freemap.in/cgi-bin/mapserv?", 33 { map: '/www/freemap.in/world/map/factbooktrans.map', 34 transparent:'true', 35 layers: 'factbook', 36 'format':'png'} ); 37 map.addLayer(twms); 30 38 31 39 markers = new OpenLayers.Layer.Markers("markers"); trunk/openlayers/lib/OpenLayers.js
r1665 r1695 91 91 "OpenLayers/Control/MouseToolbar.js", 92 92 "OpenLayers/Control/MousePosition.js", 93 "OpenLayers/Control/OverviewMap.js", 93 94 "OpenLayers/Control/KeyboardDefaults.js", 94 95 "OpenLayers/Control/PanZoom.js", trunk/openlayers/lib/OpenLayers/Control.js
r1588 r1695 64 64 this.div = OpenLayers.Util.createDiv(); 65 65 this.div.id = this.id; 66 this.div.className = 'olControl'; 66 67 } 67 68 if (px != null) { trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js
r1651 r1695 180 180 var right = Math.max(start.lon, end.lon); 181 181 var bounds = new OpenLayers.Bounds(left, bottom, right, top); 182 var zoom = this.map.getZoomForExtent(bounds); 183 this.map.setCenter(new OpenLayers.LonLat( 184 (start.lon + end.lon) / 2, 185 (start.lat + end.lat) / 2 186 ), zoom); 182 this.map.zoomToExtent(bounds); 187 183 } else { 188 184 var end = this.map.getLonLatFromViewPortPx( evt.xy ); trunk/openlayers/lib/OpenLayers/Layer.js
r1662 r1695 192 192 */ 193 193 moveTo:function(bounds, zoomChanged, dragging) { 194 this.display(this.visibility && this.inRange); 194 var display = this.visibility; 195 if (!this.isBaseLayer) { 196 display = display && this.inRange; 197 } 198 this.display(display); 195 199 }, 196 200 … … 207 211 this.map = map; 208 212 213 // grab some essential layer data from the map if it hasn't already 214 // been set 215 this.maxExtent = this.maxExtent || this.map.maxExtent; 216 this.projection = this.projection || this.map.projection; 217 this.units = this.units || this.map.units; 218 209 219 this.initResolutions(); 210 220 211 this.inRange = this.calculateInRange(); 212 221 if (!this.isBaseLayer) { 222 this.inRange = this.calculateInRange(); 223 } 213 224 }, 214 225 … … 407 418 // dimensions) 408 419 // 409 this.projection = confProps.projection;410 this.units = confProps.units;411 420 412 421 this.resolutions = confProps.resolutions; … … 423 432 this.minScale = this.scales[0]; 424 433 this.maxScale = this.scales[this.scales.length - 1]; 425 426 this.minExtent = confProps.minExtent;427 this.maxExtent = confProps.maxExtent;428 434 429 435 this.numZoomLevels = confProps.numZoomLevels; trunk/openlayers/lib/OpenLayers/Layer/EventPane.js
r1651 r1695 26 26 pane: null, 27 27 28 29 /** This is the object which will be used to load the 3rd party library 30 * in the case of the google layer, this will be of type GMap, 31 * in the case of the ve layer, this will be of type VEMap 32 * 33 * @type Object */ 34 mapObject: null, 35 36 28 37 /** 29 38 * @constructor … … 35 44 OpenLayers.Layer.prototype.initialize.apply(this, arguments); 36 45 if (this.pane == null) { 37 this.pane = OpenLayers.Util.createDiv(); 38 } 39 }, 46 this.pane = OpenLayers.Util.createDiv(this.div.id + "_EventPane"); 47 } 48 }, 49 50 /** 51 * 52 */ 53 destroy: function() { 54 this.mapObject = null; 55 OpenLayers.Layer.prototype.destroy.apply(this, arguments); 56 }, 57 40 58 41 59 /** Set the map property for the layer. This is done through an accessor … … 61 79 this.map.layerContainerDiv.appendChild(this.pane); 62 80 } 63 }, 81 82 // once our layer has been added to the map, we can load it 83 this.loadMapObject(); 84 85 // if map didn't load, display warning 86 if (this.mapObject == null) { 87 this.loadWarningMessage(); 88 } 89 }, 90 91 /** If we can't load the GMap, then display an error message to the 92 * user and tell them where to go for help. 93 * 94 * @private 95 * 96 */ 97 loadWarningMessage:function() { 98 99 this.div.style.backgroundColor = "darkblue"; 100 101 var viewSize = this.map.getSize(); 102 103 msgW = Math.min(viewSize.w, 300); 104 msgH = Math.min(viewSize.h, 200); 105 var size = new OpenLayers.Size(msgW, msgH); 106 107 var centerPx = new OpenLayers.Pixel(viewSize.w/2, viewSize.h/2); 108 109 var topLeft = centerPx.add(-size.w/2, -size.h/2); 110 111 var div = OpenLayers.Util.createDiv(this.name + "_warning", 112 topLeft, 113 size, 114 null, 115 null, 116 null, 117 "auto"); 118 119 div.style.padding = "7px"; 120 div.style.backgroundColor = "yellow"; 121 122 div.innerHTML = this.getWarningHTML(); 123 this.div.appendChild(div); 124 }, 125 64 126 65 127 /** … … 71 133 }, 72 134 73 setZIndex: function (zIdx) { 135 /** 136 * @param {int} zIndex 137 */ 138 setZIndex: function (zIndex) { 74 139 OpenLayers.Layer.prototype.setZIndex.apply(this, arguments); 75 140 this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1; 141 }, 142 143 /** 144 * @param {OpenLayers.Bounds} bounds 145 * @param {Boolean} zoomChanged 146 * @param {Boolean} dragging 147 */ 148 moveTo:function(bounds, zoomChanged, dragging) { 149 OpenLayers.Layer.prototype.moveTo.apply(this, arguments); 150 151 if (this.mapObject != null) { 152 153 var newCenter = this.map.getCenter(); 154 var newZoom = this.map.getZoom(); 155 156 if (newCenter != null) { 157 158 var moOldCenter = this.getMapObjectCenter(); 159 var oldCenter = this.getOLLonLatFromMapObjectLonLat(moOldCenter); 160 161 var moOldZoom = this.getMapObjectZoom(); 162 var oldZoom= this.getOLZoomFromMapObjectZoom(moOldZoom); 163 164 if ( !(newCenter.equals(oldCenter)) || 165 !(newZoom == oldZoom) ) { 166 167 var center = this.getMapObjectLonLatFromOLLonLat(newCenter); 168 var zoom = this.getMapObjectZoomFromOLZoom(newZoom); 169 this.setMapObjectCenter(center, zoom); 170 } 171 } 172 } 173 }, 174 175 176 /********************************************************/ 177 /* */ 178 /* Baselayer Functions */ 179 /* */ 180 /********************************************************/ 181 182 /** 183 * @param {OpenLayers.Pixel} viewPortPx 184 * 185 * @returns An OpenLayers.LonLat which is the passed-in view port 186 * OpenLayers.Pixel, translated into lon/lat by GMAPS 187 * If gmap is not loaded or not centered, returns null 188 * @type OpenLayers.LonLat 189 */ 190 getLonLatFromViewPortPx: function (viewPortPx) { 191 var lonlat = null; 192 if ( (this.mapObject != null) && 193 (this.getMapObjectCenter() != null) ) { 194 var moPixel = this.getMapObjectPixelFromOLPixel(viewPortPx); 195 var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel) 196 lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat); 197 } 198 return lonlat; 199 }, 200 201 202 /** 203 * @param {OpenLayers.LonLat} lonlat 204 * 205 * @returns An OpenLayers.Pixel which is the passed-in OpenLayers.LonLat, 206 * translated into view port pixels BY GMAPS 207 * If gmap is not loaded or not centered, returns null 208 * @type OpenLayers.Pixel 209 */ 210 getViewPortPxFromLonLat: function (lonlat) { 211 var viewPortPx = null; 212 if ( (this.mapObject != null) && 213 (this.getMapObjectCenter() != null) ) { 214 215 var moLonLat = this.getMapObjectLonLatFromOLLonLat(lonlat); 216 var moPixel = this.getMapObjectPixelFromMapObjectLonLat(moLonLat) 217 218 viewPortPx = this.getOLPixelFromMapObjectPixel(moPixel); 219 } 220 return viewPortPx; 221 }, 222 223 /********************************************************/ 224 /* */ 225 /* Translation Functions */ 226 /* */ 227 /* The following functions translate Map Object and */ 228 /* OL formats for Pixel, LonLat */ 229 /* */ 230 /********************************************************/ 231 232 // 233 // TRANSLATION: MapObject LatLng <-> OpenLayers.LonLat 234 // 235 236 /** 237 * @param {Object} moLonLat 238 * 239 * @returns An OpenLayers.LonLat, translated from the passed in 240 * MapObject LonLat 241 * Returns null if null value is passed in 242 * @type OpenLayers.LonLat 243 */ 244 getOLLonLatFromMapObjectLonLat: function(moLonLat) { 245 var olLonLat = null; 246 if (moLonLat != null) { 247 var lon = this.getLongitudeFromMapObjectLonLat(moLonLat); 248 var lat = this.getLatitudeFromMapObjectLonLat(moLonLat); 249 olLonLat = new OpenLayers.LonLat(lon, lat); 250 } 251 return olLonLat; 252 }, 253 254 /** 255 * @param {OpenLayers.LonLat} olLonLat 256 * 257 * @returns A MapObject LonLat, translated from the passed in 258 * OpenLayers.LonLat 259 * Returns null if null value is passed in 260 * @type Object 261 */ 262 getMapObjectLonLatFromOLLonLat: function(olLonLat) { 263 var moLatLng = null; 264 if (olLonLat != null) { 265 moLatLng = this.getMapObjectLonLatFromLonLat(olLonLat.lon, 266 olLonLat.lat); 267 } 268 return moLatLng; 269 }, 270 271 272 // 273 // TRANSLATION: MapObject Pixel <-> OpenLayers.Pixel 274 // 275 276 /** 277 * @param {Object} moPixel 278 * 279 * @returns An OpenLayers.Pixel, translated from the passed in 280 * MapObject Pixel 281 * Returns null if null value is passed in 282 * @type OpenLayers.Pixel 283 */ 284 getOLPixelFromMapObjectPixel: function(moPixel) { 285 var olPixel = null; 286 if (moPixel != null) { 287 var x = this.getXFromMapObjectPixel(moPixel); 288 var y = this.getYFromMapObjectPixel(moPixel); 289 olPixel = new OpenLayers.Pixel(x, y); 290 } 291 return olPixel; 292 }, 293 294 /** 295 * @param {OpenLayers.Pixel} olPixel 296 * 297 * @returns A MapObject Pixel, translated from the passed in 298 * OpenLayers.Pixel 299 * Returns null if null value is passed in 300 * @type Object 301 */ 302 getMapObjectPixelFromOLPixel: function(olPixel) { 303 var moPixel = null; 304 if (olPixel != null) { 305 moPixel = this.getMapObjectPixelFromXY(olPixel.x, olPixel.y); 306 } 307 return moPixel; 76 308 }, 77 309 trunk/openlayers/lib/OpenLayers/Layer/FixedZoomLevels.js
r1599 r1695 68 68 }, 69 69 70 /** 71 * 72 */ 70 73 initResolutions: function() { 71 // resolutions are set automatically in the black-box. this is the 72 // definition of a fixed-zoom-levels layer 74 75 var props = new Array('minZoomLevel', 'maxZoomLevel', 'numZoomLevels'); 76 77 for(var i=0; i < props.length; i++) { 78 var property = props[i]; 79 this[property] = (this.options[property] != null) 80 ? this.options[property] 81 : this.map[property]; 82 } 83 84 if ( (this.minZoomLevel == null) || 85 (this.minZoomLevel < this.MIN_ZOOM_LEVEL) ){ 86 this.minZoomLevel = this.MIN_ZOOM_LEVEL; 87 } 88 89 var limitZoomLevels = this.MAX_ZOOM_LEVEL - this.minZoomLevel + 1; 90 if (this.numZoomLevels != null) { 91 this.numZoomLevels = Math.min(this.numZoomLevels, limitZoomLevels); 92 } else { 93 if (this.maxZoomLevel != null) { 94 var zoomDiff = this.maxZoomLevel - this.minZoomLevel + 1; 95 this.numZoomLevels = Math.min(zoomDiff, limitZoomLevels); 96 } else { 97 this.numZoomLevels = limitZoomLevels; 98 } 99 } 100 101 this.maxZoomLevel = this.minZoomLevel + this.numZoomLevels - 1; 102 103 if (this.RESOLUTIONS != null) { 104 var resolutionsIndex = 0; 105 this.resolutions = []; 106 for(var i= this.minZoomLevel; i < this.numZoomLevels; i++) { 107 this.resolutions[resolutionsIndex++] = this.RESOLUTIONS[i]; 108 } 109 } 73 110 }, 74 111 … … 78 115 */ 79 116 getResolution: function() { 80 var resolution = null; 81 82 var viewSize = this.map.getSize(); 83 var extent = this.getExtent(); 84 85 if ((viewSize != null) && (extent != null)) { 86 resolution = Math.max( extent.getWidth() / viewSize.w, 87 extent.getHeight() / viewSize.h ); 88 } 89 return resolution; 117 118 if (this.resolutions != null) { 119 return OpenLayers.Layer.prototype.getResolution.apply(this, arguments); 120 } else { 121 var resolution = null; 122 123 var viewSize = this.map.getSize(); 124 var extent = this.getExtent(); 125 126 if ((viewSize != null) && (extent != null)) { 127 resolution = Math.max( extent.getWidth() / viewSize.w, 128 extent.getHeight() / viewSize.h ); 129 } 130 return resolution; 131 } 90 132 }, 91 133 … … 128 170 getZoomForResolution: function(resolution) { 129 171 130 var extent = OpenLayers.Layer.prototype.getExtent.apply(this, 131 [resolution]); 132 133 return this.getZoomForExtent(extent); 134 }, 172 if (this.resolutions != null) { 173 return OpenLayers.Layer.prototype.getZoomForResolution.apply(this, arguments); 174 } else { 175 var extent = OpenLayers.Layer.prototype.getExtent.apply(this, 176 [resolution]); 177 178 return this.getZoomForExtent(extent); 179 } 180 }, 181 182 183 184 185 /********************************************************/ 186 /* */ 187 /* Translation Functions */ 188 /* */ 189 /* The following functions translate GMaps and OL */ 190 /* formats for Pixel, LonLat, Bounds, and Zoom */ 191 /* */ 192 /********************************************************/ 193 194 195 // 196 // TRANSLATION: MapObject Zoom <-> OpenLayers Zoom 197 // 198 199 /** 200 * @param {int} gZoom 201 * 202 * @returns An OpenLayers Zoom level, translated from the passed in gZoom 203 * Returns null if null value is passed in 204 * @type int 205 */ 206 getOLZoomFromMapObjectZoom: function(moZoom) { 207 var zoom = null; 208 if (moZoom != null) { 209 zoom = moZoom - this.minZoomLevel; 210 } 211 return zoom; 212 }, 213 214 /** 215 * @param {int} olZoom 216 * 217 * @returns A MapObject level, translated from the passed in olZoom 218 * Returns null if null value is passed in 219 * @type int 220 */ 221 getMapObjectZoomFromOLZoom: function(olZoom) { 222 var zoom = null; 223 if (olZoom != null) { 224 zoom = olZoom + this.minZoomLevel; 225 } 226 return zoom; 227 }, 228 135 229 136 230 /** @final @type String */ trunk/openlayers/lib/OpenLayers/Layer/GeoRSS.js
r1649 r1695 52 52 doc = OpenLayers.parseXMLString(ajaxRequest.responseText); 53 53 } 54 this.name = doc.getElementsByTagName("title")[0].firstChild.nodeValue; 55 var itemlist = doc.getElementsByTagName('item'); 54 55 this.name = null; 56 try { 57 this.name = doc.getElementsByTagNameNS('*', 'title')[0].firstChild.nodeValue; 58 } 59 catch (e) { 60 this.name = doc.getElementsByTagName('title')[0].firstChild.nodeValue; 61 } 62 63 /* Try RSS items first, then Atom entries */ 64 var itemlist = null; 65 try { 66 itemlist = doc.getElementsByTagNameNS('*', 'item'); 67 } 68 catch (e) { 69 itemlist = doc.getElementsByTagName('item'); 70 } 71 72 if (itemlist.length == 0) { 73 try { 74 itemlist = doc.getElementsByTagNameNS('*', 'entry'); 75 } 76 catch(e) { 77 itemlist = doc.getElementsByTagName('entry'); 78 } 79 } 80 56 81 for (var i = 0; i < itemlist.length; i++) { 57 82 var data = {}; … … 73 98 74 99 /* Provide defaults for title and description */ 75 var title = " No title";100 var title = "Untitled"; 76 101 try { 77 102 title = OpenLayers.Util.getNodes(itemlist[i], 78 103 "title")[0].firstChild.nodeValue; 79 104 } 80 catch (e) { alert(e); } 81 82 var description = "No description"; 105 catch (e) { title="Untitled"; } 106 107 /* First try RSS descriptions, then Atom summaries */ 108 var descr_nodes = null; 83 109 try { 84 description = OpenLayers.Util.getNodes(itemlist[i],85 "description")[0].firstChild.nodeValue;110 descr_nodes = itemlist[i].getElementsByTagNameNS("*", 111 "description"); 86 112 } 87 catch (e) { alert(e); } 113 catch (e) { 114 descr_nodes = itemlist[i].getElementsByTagName("description"); 115 } 116 if (descr_nodes.length == 0) { 117 try { 118 descr_nodes = itemlist[i].getElementsByTagNameNS("*", 119 "summary"); 120 } 121 catch (e) { 122 descr_nodes = itemlist[i].getElementsByTagName("summary"); 123 } 124 } 125 126 var description = "No description."; 127 try { 128 description = descr_nodes[0].firstChild.nodeValue; 129 } 130 catch (e) { description="No description."; } 88 131 89 132 try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { } 90 133 data.icon = OpenLayers.Marker.defaultIcon(); 91 data.popupSize = new OpenLayers.Size(250, 1 00);134 data.popupSize = new OpenLayers.Size(250, 120); 92 135 if ((title != null) && (description != null)) { 93 contentHTML = "<br />"; 94 contentHTML += "<div style='margin: -0.5em 0.5em 0.5em 0.5em'>" 95 96 contentHTML += "<div style='height: 1.3em; overflow: hidden'>"; 97 contentHTML += "<span style='font-size: 1.2em; font-weight: bold'>"; 98 if (link) contentHTML += "<a href='"+link+"' target='_blank'>"; 99 contentHTML += title; 100 if (link) contentHTML += "</a>"; 101 contentHTML += "</span>"; 102 contentHTML += "</div>"; 103 104 105 contentHTML += "<span style='font-size: 0.7em; align:center'>"; 136 contentHTML = '<div class="olLayerGeoRSSClose">[x]</div>'; 137 contentHTML += '<div class="olLayerGeoRSSTitle">'; 138 if (link) contentHTML += '<a class="link" href="'+link+'" target="_blank">'; 139 contentHTML += title; 140 if (link) contentHTML += '</a>'; 141 contentHTML += '</div>'; 142 contentHTML += '<div style="" class="olLayerGeoRSSDescription">'; 106 143 contentHTML += description; 107 contentHTML += "</span>"; 108 109 contentHTML += "</div>" 110 data['popupContentHTML'] = contentHTML; 111 112 //data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>'; 144 contentHTML += '</div>'; 145 data['popupContentHTML'] = contentHTML; 113 146 } 114 147 var feature = new OpenLayers.Feature(this, location, data); trunk/openlayers/lib/OpenLayers/Layer/Google.js
r1659 r1695 2 2 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full 3 3 * text of the license. */ 4 5 6 7 4 8 5 /** … … 10 7 * 11 8 * @requires OpenLayers/Layer/EventPane.js 9 * @requires OpenLayers/Layer/FixedZoomLevels.js 12 10 */ 13 11 OpenLayers.Layer.Google = OpenLayers.Class.create(); … … 16 14 OpenLayers.Layer.FixedZoomLevels, { 17 15 18 &nb
