OpenLayers OpenLayers

Changeset 1695

Show
Ignore:
Timestamp:
10/13/06 16:41:21 (2 years ago)
Author:
crschmidt
Message:

The OpenLayers server threw a disk, and clobbered another, resulting in a loss
of data up to our last backup. In the previous subversion repository, this was
r1694->r1777. I'm sorry to all those of you who might have checked out that
code, as this will surely cause problems for you. We're currently working to
figure out what went wrong, and how to prevent it in the future.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/build/docs.sh

    r1665 r1695  
    22 
    33rm ../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
     4CLASSES="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
    55echo "<html> 
    66  <head> 
  • trunk/openlayers/build/library.cfg

    r1594 r1695  
    33OpenLayers.js 
    44OpenLayers/BaseTypes.js 
     5OpenLayers/Util.js 
    56Rico/Corner.js 
    67 
  • trunk/openlayers/doc/Layer.HTTPRequest.txt

    r1424 r1695  
    77 
    88* 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. 
    1010  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  
    2121  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 
    2222  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.  
    2324   
    2425* Parameters 
     
    3233  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. 
    3334  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   
    3436 
    3537  
  • trunk/openlayers/doc/authors.txt

    r1665 r1695  
    1212Tim Schaub 
    1313Jeff Dege 
     14Sean Gilles 
    1415 
    1516OpenLayers is graciously supported by MetaCarta, Inc. 
  • trunk/openlayers/examples/baseLayers.html

    r1592 r1695  
    1414    <!-- Localhost key --> 
    1515    <!-- <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>--> 
     16    <script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script> 
    1617    <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> 
    1719    <script src="../lib/OpenLayers.js"></script> 
    1820    <script type="text/javascript"> 
     
    3537            var google = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_MAP }); 
    3638            var ve = new OpenLayers.Layer.VirtualEarth( "VE");  
     39            var yahoo = new OpenLayers.Layer.Yahoo( "Yahoo");  
     40            var mm = new OpenLayers.Layer.MultiMap( "MultiMap");  
    3741             
    3842 
    39             map.addLayers([wms, google, ve]); 
     43            map.addLayers([wms, google, ve, yahoo, mm]); 
    4044 
    4145            markers = new OpenLayers.Layer.Markers("markers"); 
     
    4448            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 
    4549            map.addControl( new OpenLayers.Control.LayerSwitcher() ); 
     50            map.addControl( new OpenLayers.Control.MousePosition() ); 
    4651 
    4752        } 
  • trunk/openlayers/examples/controls.html

    r1665 r1695  
    2020            map.addControl(new OpenLayers.Control.Permalink($('permalink'))); 
    2121            map.addControl(new OpenLayers.Control.MousePosition()); 
     22            map.addControl(new OpenLayers.Control.OverviewMap()); 
    2223            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",  
    2324                "http://labs.metacarta.com/wms/vmap0", 
  • trunk/openlayers/examples/google.html

    r1592 r1695  
    1919        var lon = 5; 
    2020        var lat = 40; 
    21         var zoom = 18
     21        var zoom = 17
    2222        var map, layer; 
    2323 
     
    3030 
    3131            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); 
    3346            markers = new OpenLayers.Layer.Markers("markers"); 
    3447            map.addLayer(markers); 
    3548 
    36             map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), zoom); 
     49            map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5); 
    3750            map.addControl( new OpenLayers.Control.LayerSwitcher() ); 
    3851            map.addControl( new OpenLayers.Control.PanZoomBar() ); 
  • trunk/openlayers/examples/layer-opacity.html

    r1490 r1695  
    4141        var minOpacity = 0.1; 
    4242        function changeOpacity(byOpacity) { 
    43             var newOpacity = (parseFloat($F('opacity')) + byOpacity).toFixed(1); 
     43            var newOpacity = (parseFloat($('opacity').value) + byOpacity).toFixed(1); 
    4444            newOpacity = Math.min(maxOpacity, 
    4545                                  Math.max(minOpacity, newOpacity)); 
  • trunk/openlayers/examples/notile.html

    r1424 r1695  
    1616            var ol_wms = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS",  
    1717                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} ); 
    18             ol_wms.isBaseLayer = true
     18            ol_wms.addOptions({isBaseLayer: true})
    1919            map.addLayers([ol_wms]); 
    2020            map.addControl(new OpenLayers.Control.LayerSwitcher()); 
  • trunk/openlayers/examples/tiger.html

    r1424 r1695  
    2020                {layers: "modis,global_mosaic"}); 
    2121            jpl_wms.setVisibility(false); 
    22             ka_wms.isBaseLayer = false
     22            ka_wms.addOptions({isBaseLayer: false})
    2323            map.addLayers([jpl_wms,ka_wms]);  
    2424            map.addControl(new OpenLayers.Control.LayerSwitcher()); 
  • trunk/openlayers/examples/ve.html

    r1592 r1695  
    2828            { minZoomLevel: 4, maxZoomLevel: 6, 'type': VEMapStyle.Aerial});  
    2929            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); 
    3038             
    3139            markers = new OpenLayers.Layer.Markers("markers"); 
  • trunk/openlayers/lib/OpenLayers.js

    r1665 r1695  
    9191        "OpenLayers/Control/MouseToolbar.js", 
    9292        "OpenLayers/Control/MousePosition.js", 
     93        "OpenLayers/Control/OverviewMap.js", 
    9394        "OpenLayers/Control/KeyboardDefaults.js", 
    9495        "OpenLayers/Control/PanZoom.js", 
  • trunk/openlayers/lib/OpenLayers/Control.js

    r1588 r1695  
    6464            this.div = OpenLayers.Util.createDiv(); 
    6565            this.div.id = this.id; 
     66            this.div.className = 'olControl'; 
    6667        } 
    6768        if (px != null) { 
  • trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js

    r1651 r1695  
    180180                var right = Math.max(start.lon, end.lon); 
    181181                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); 
    187183            } else { 
    188184                var end = this.map.getLonLatFromViewPortPx( evt.xy ); 
  • trunk/openlayers/lib/OpenLayers/Layer.js

    r1662 r1695  
    192192     */ 
    193193    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); 
    195199    }, 
    196200 
     
    207211        this.map = map; 
    208212         
     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         
    209219        this.initResolutions(); 
    210220         
    211         this.inRange = this.calculateInRange(); 
    212          
     221        if (!this.isBaseLayer) { 
     222            this.inRange = this.calculateInRange(); 
     223        }     
    213224    }, 
    214225   
     
    407418        //        dimensions) 
    408419        // 
    409         this.projection = confProps.projection; 
    410         this.units = confProps.units; 
    411420 
    412421        this.resolutions = confProps.resolutions; 
     
    423432        this.minScale = this.scales[0]; 
    424433        this.maxScale = this.scales[this.scales.length - 1]; 
    425          
    426         this.minExtent = confProps.minExtent; 
    427         this.maxExtent = confProps.maxExtent;         
    428434         
    429435        this.numZoomLevels = confProps.numZoomLevels; 
  • trunk/openlayers/lib/OpenLayers/Layer/EventPane.js

    r1651 r1695  
    2626    pane: null, 
    2727 
     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 
    2837    /** 
    2938     * @constructor 
     
    3544        OpenLayers.Layer.prototype.initialize.apply(this, arguments); 
    3645        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 
    4058     
    4159    /** Set the map property for the layer. This is done through an accessor 
     
    6179            this.map.layerContainerDiv.appendChild(this.pane); 
    6280        } 
    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   
    64126   
    65127    /**  
     
    71133    }, 
    72134   
    73     setZIndex: function (zIdx) { 
     135    /** 
     136     * @param {int} zIndex 
     137     */ 
     138    setZIndex: function (zIndex) { 
    74139        OpenLayers.Layer.prototype.setZIndex.apply(this, arguments); 
    75140        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; 
    76308    }, 
    77309 
  • trunk/openlayers/lib/OpenLayers/Layer/FixedZoomLevels.js

    r1599 r1695  
    6868    }, 
    6969     
     70    /** 
     71     *  
     72     */ 
    7073    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        }         
    73110    }, 
    74111     
     
    78115     */ 
    79116    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        } 
    90132     }, 
    91133 
     
    128170    getZoomForResolution: function(resolution) { 
    129171       
    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 
    135229 
    136230    /** @final @type String */ 
  • trunk/openlayers/lib/OpenLayers/Layer/GeoRSS.js

    r1649 r1695  
    5252            doc = OpenLayers.parseXMLString(ajaxRequest.responseText); 
    5353        } 
    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 
    5681        for (var i = 0; i < itemlist.length; i++) { 
    5782            var data = {}; 
     
    7398             
    7499            /* Provide defaults for title and description */ 
    75             var title = "No title"; 
     100            var title = "Untitled"; 
    76101            try { 
    77102              title = OpenLayers.Util.getNodes(itemlist[i],  
    78103                        "title")[0].firstChild.nodeValue; 
    79104            } 
    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; 
    83109            try { 
    84               description = OpenLayers.Util.getNodes(itemlist[i],  
    85                               "description")[0].firstChild.nodeValue
     110                descr_nodes = itemlist[i].getElementsByTagNameNS("*", 
     111                                                "description")
    86112            } 
    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."; } 
    88131 
    89132            try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { }  
    90133            data.icon = OpenLayers.Marker.defaultIcon(); 
    91             data.popupSize = new OpenLayers.Size(250, 100); 
     134            data.popupSize = new OpenLayers.Size(250, 120); 
    92135            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">'; 
    106143                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;                 
    113146            } 
    114147            var feature = new OpenLayers.Feature(this, location, data); 
  • trunk/openlayers/lib/OpenLayers/Layer/Google.js

    r1659 r1695  
    22 * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full 
    33 * text of the license. */ 
    4  
    5  
    6  
    74 
    85/** 
     
    107 *  
    118 * @requires OpenLayers/Layer/EventPane.js 
     9 * @requires OpenLayers/Layer/FixedZoomLevels.js 
    1210 */ 
    1311OpenLayers.Layer.Google = OpenLayers.Class.create(); 
     
    1614                            OpenLayers.Layer.FixedZoomLevels, { 
    1715     
    18   &nb