OpenLayers OpenLayers

Changeset 7920

Show
Ignore:
Timestamp:
09/02/08 03:30:34 (3 months ago)
Author:
elemoine
Message:

svn merge -r 7875:HEAD http://svn.openlayers.org/trunk/openlayers .

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/camptocamp/unhcr/examples/popupMatrix.html

    r7241 r7920  
    880880 
    881881        <!-- preloading these images so the autosize will work correctly --> 
    882         <img src="small.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 
    883882        <img src="wideshort.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 
    884883        <img src="widelong.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 
    885884        <img src="thinlong.jpg" style="position:absolute; top:-5000px; left: -5000px"></img> 
     885 
     886       <p> All of the images in this file a pre-cached, meaning they are  
     887           loaded immediately when you load the page (they are just placed  
     888           far offscreen, that's why you don't see them).  
     889       </p> 
     890       <br>     
     891       <p> The only image that is *not* preloaded is small.jpg, the brazilian 
     892           flag. We do this in order to test out to make sure that our auto-sizing 
     893             code does in fact activate itself as the images load. To verify  
     894             this, clear your cache and reload this example page. Click on  
     895             any of the markers in the 'AutoSize' row. If the popup autosizes 
     896             to correctly contain the entire flag: golden. If the popup is  
     897             tiny and you can only see a corner of it, then this code is broken. 
     898        </p> 
    886899 
    887900      <br/>       
  • sandbox/camptocamp/unhcr/examples/wfs-reprojection.html

    r7875 r7920  
    99 
    1010        var map, layer, styleMap; 
    11         OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; 
     11        OpenLayers.ProxyHost = "/proxy/?url="; 
    1212        function init(){ 
    1313 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/BaseTypes/Element.js

    r7785 r7920  
    216216    getStyle: function(element, style) { 
    217217        element = OpenLayers.Util.getElement(element); 
    218         var value = element.style[OpenLayers.String.camelize(style)]; 
    219         if (!value) { 
    220             if (document.defaultView &&  
    221                 document.defaultView.getComputedStyle) { 
    222                  
    223                 var css = document.defaultView.getComputedStyle(element, null); 
    224                 value = css ? css.getPropertyValue(style) : null; 
    225             } else if (element.currentStyle) { 
    226                 value = element.currentStyle[OpenLayers.String.camelize(style)]; 
     218 
     219        var value = null; 
     220        if (element && element.style) { 
     221            value = element.style[OpenLayers.String.camelize(style)]; 
     222            if (!value) { 
     223                if (document.defaultView &&  
     224                    document.defaultView.getComputedStyle) { 
     225                     
     226                    var css = document.defaultView.getComputedStyle(element, null); 
     227                    value = css ? css.getPropertyValue(style) : null; 
     228                } else if (element.currentStyle) { 
     229                    value = element.currentStyle[OpenLayers.String.camelize(style)]; 
     230                } 
    227231            } 
    228         } 
    229      
    230         var positions = ['left', 'top', 'right', 'bottom']; 
    231         if (window.opera && 
    232             (OpenLayers.Util.indexOf(positions,style) != -1) && 
    233             (OpenLayers.Element.getStyle(element, 'position') == 'static')) {  
    234             value = 'auto'; 
     232         
     233            var positions = ['left', 'top', 'right', 'bottom']; 
     234            if (window.opera && 
     235                (OpenLayers.Util.indexOf(positions,style) != -1) && 
     236                (OpenLayers.Element.getStyle(element, 'position') == 'static')) {  
     237                value = 'auto'; 
     238            } 
    235239        } 
    236240     
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Control/Permalink.js

    r7785 r7920  
    1616 */ 
    1717OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, { 
     18     
     19    /** 
     20     * APIProperty: argParserClass 
     21     * {Class} The ArgParser control class (not instance) to use with this 
     22     *     control. 
     23     */ 
     24    argParserClass: OpenLayers.Control.ArgParser, 
    1825 
    1926    /**  
     
    8289        for(var i=0, len=this.map.controls.length; i<len; i++) { 
    8390            var control = this.map.controls[i]; 
    84             if (control.CLASS_NAME == "OpenLayers.Control.ArgParser") { 
     91            if (control.CLASS_NAME == this.argParserClass.CLASS_NAME) { 
    8592                 
    8693                // If a permalink is added to the map, and an ArgParser already 
     
    95102        } 
    96103        if (i == this.map.controls.length) { 
    97             this.map.addControl(new OpenLayers.Control.ArgParser
     104            this.map.addControl(new this.argParserClass
    98105                { 'displayProjection': this.displayProjection }));        
    99106        } 
     
    111118           
    112119        if (!this.element) { 
     120            this.div.className = this.displayClass; 
    113121            this.element = document.createElement("a"); 
    114122            this.element.innerHTML = OpenLayers.i18n("permalink"); 
     
    122130            scope: this 
    123131        }); 
     132         
     133        // Make it so there is at least a link even though the map may not have 
     134        // moved yet. 
     135        this.updateLink(); 
     136         
    124137        return this.div; 
    125138    }, 
     
    129142     */ 
    130143    updateLink: function() { 
    131         var center = this.map.getCenter(); 
    132          
    133         // Map not initialized yet. Break out of this function. 
    134         if (!center) {  
    135             return;  
    136         } 
    137  
    138         var params = OpenLayers.Util.getParameters(this.base); 
    139          
    140         params.zoom = this.map.getZoom();  
    141         var lat = center.lat; 
    142         var lon = center.lon; 
    143          
    144         if (this.displayProjection) { 
    145             var mapPosition = OpenLayers.Projection.transform( 
    146               { x: lon, y: lat },  
    147               this.map.getProjectionObject(),  
    148               this.displayProjection ); 
    149             lon = mapPosition.x;   
    150             lat = mapPosition.y;   
    151         }        
    152         params.lat = Math.round(lat*100000)/100000; 
    153         params.lon = Math.round(lon*100000)/100000; 
    154          
    155         params.layers = ''; 
    156         for (var i=0, len=this.map.layers.length; i<len; i++) { 
    157             var layer = this.map.layers[i]; 
    158  
    159             if (layer.isBaseLayer) { 
    160                 params.layers += (layer == this.map.baseLayer) ? "B" : "0"; 
    161             } else { 
    162                 params.layers += (layer.getVisibility()) ? "T" : "F";            
    163             } 
    164         } 
    165  
    166144        var href = this.base; 
    167145        if (href.indexOf('?') != -1) { 
     
    169147        } 
    170148 
    171         href += '?' + OpenLayers.Util.getParameterString(params); 
     149        href += '?' + OpenLayers.Util.getParameterString(this.createParams()); 
    172150        this.element.href = href; 
    173151    },  
     152     
     153    /** 
     154     * APIMethod: createParams 
     155     * Creates the parameters that need to be encoded into the permalink url. 
     156     *  
     157     * Parameters: 
     158     * center - {<OpenLayers.LonLat>} center to encode in the permalink. 
     159     *     Defaults to the current map center. 
     160     * zoom - {Integer} zoom level to encode in the permalink. Defaults to the 
     161     *     current map zoom level. 
     162     * layers - {Array(<OpenLayers.Layer>)} layers to encode in the permalink. 
     163     *     Defaults to the current map layers. 
     164     *  
     165     * Returns: 
     166     * {Object} Hash of parameters that will be url-encoded into the 
     167     * permalink. 
     168     */ 
     169    createParams: function(center, zoom, layers) { 
     170        center = center || this.map.getCenter(); 
     171        zoom = zoom || this.map.getZoom(); 
     172        layers = layers || this.map.layers;   
     173           
     174        var params = OpenLayers.Util.getParameters(this.base); 
     175         
     176        // If there's still no center, map is not initialized yet.  
     177        // Break out of this function, and simply return the params from the 
     178        // base link. 
     179        if (center) {  
     180     
     181            params.zoom = this.map.getZoom();  
     182            var lat = center.lat; 
     183            var lon = center.lon; 
     184             
     185            if (this.displayProjection) { 
     186                var mapPosition = OpenLayers.Projection.transform( 
     187                  { x: lon, y: lat },  
     188                  this.map.getProjectionObject(),  
     189                  this.displayProjection ); 
     190                lon = mapPosition.x;   
     191                lat = mapPosition.y;   
     192            }        
     193            params.lat = Math.round(lat*100000)/100000; 
     194            params.lon = Math.round(lon*100000)/100000; 
     195             
     196            params.layers = ''; 
     197            for (var i=0, len=this.map.layers.length; i<len; i++) { 
     198                var layer = this.map.layers[i]; 
     199     
     200                if (layer.isBaseLayer) { 
     201                    params.layers += (layer == this.map.baseLayer) ? "B" : "0"; 
     202                } else { 
     203                    params.layers += (layer.getVisibility()) ? "T" : "F";            
     204                } 
     205            } 
     206        } 
     207 
     208        return params; 
     209    },  
    174210 
    175211    CLASS_NAME: "OpenLayers.Control.Permalink" 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/Collection.js

    r7785 r7920  
    326326                component.transform(source, dest); 
    327327            } 
    328         }    
     328            this.bounds = null; 
     329        } 
    329330        return this; 
    330331    }, 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/LinearRing.js

    r7785 r7920  
    173173                component.transform(source, dest); 
    174174            } 
     175            this.bounds = null; 
    175176        } 
    176177        return this; 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Geometry/Point.js

    r7785 r7920  
    207207            OpenLayers.Projection.transform( 
    208208                this, source, dest);  
     209            this.bounds = null; 
    209210        }        
    210211        return this; 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Map.js

    r7878 r7920  
    19411941     * Parameters: 
    19421942     * bounds - {<OpenLayers.Bounds>} 
    1943      */ 
    1944     zoomToExtent: function(bounds) { 
     1943     * closest - {Boolean} Find the zoom level that most closely fits the  
     1944     *     specified bounds. Note that this may result in a zoom that does  
     1945     *     not exactly contain the entire extent. 
     1946     *     Default is false. 
     1947     *  
     1948     */ 
     1949    zoomToExtent: function(bounds, closest) { 
    19451950        var center = bounds.getCenterLonLat(); 
    19461951        if (this.baseLayer.wrapDateLine) { 
     
    19661971            center = bounds.getCenterLonLat().wrapDateLine(maxExtent); 
    19671972        } 
    1968         this.setCenter(center, this.getZoomForExtent(bounds)); 
     1973        this.setCenter(center, this.getZoomForExtent(bounds, closest)); 
    19691974    }, 
    19701975 
     
    19962001     * Parameters: 
    19972002     * scale - {float} 
    1998      */ 
    1999     zoomToScale: function(scale) { 
     2003     * closest - {Boolean} Find the zoom level that most closely fits the  
     2004     *     specified scale. Note that this may result in a zoom that does  
     2005     *     not exactly contain the entire extent. 
     2006     *     Default is false. 
     2007     *  
     2008     */ 
     2009    zoomToScale: function(scale, closest) { 
    20002010        var res = OpenLayers.Util.getResolutionFromScale(scale,  
    20012011                                                         this.baseLayer.units); 
     
    20092019                                           center.lon + w_deg / 2, 
    20102020                                           center.lat + h_deg / 2); 
    2011         this.zoomToExtent(extent); 
     2021        this.zoomToExtent(extent, closest); 
    20122022    }, 
    20132023     
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Popup.js

    r7785 r7920  
    4949 
    5050    /**  
     51     * Property: contentSize  
     52     * {<OpenLayers.Size>} the width and height of the content. 
     53     */ 
     54    contentSize: null,     
     55 
     56    /**  
    5157     * Property: size  
    5258     * {<OpenLayers.Size>} the width and height of the popup. 
     
    5662    /**  
    5763     * Property: contentHTML  
    58      * {String} The HTML that this popup displays
    59      */ 
    60     contentHTML: ""
     64     * {String} An HTML string for this popup to display
     65     */ 
     66    contentHTML: null
    6167     
    6268    /**  
     
    184190    * lonlat - {<OpenLayers.LonLat>}  The position on the map the popup will 
    185191    *                                 be shown. 
    186     * size - {<OpenLayers.Size>}      The size of the popup
    187     * contentHTML - {String}          The HTML content to display inside the  
     192    * contentSize - {<OpenLayers.Size>} The size of the content
     193    * contentHTML - {String}          An HTML string to display inside the   
    188194    *                                 popup. 
    189195    * closeBox - {Boolean}            Whether to display a close box inside 
     
    191197    * closeBoxCallback - {Function}   Function to be called on closeBox click. 
    192198    */ 
    193     initialize:function(id, lonlat, size, contentHTML, closeBox, closeBoxCallback) { 
     199    initialize:function(id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback) { 
    194200        if (id == null) { 
    195201            id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_"); 
     
    198204        this.id = id; 
    199205        this.lonlat = lonlat; 
    200         this.size = (size != null) ? size  
     206 
     207        this.contentSize = (contentSize != null) ? contentSize  
    201208                                  : new OpenLayers.Size( 
    202209                                                   OpenLayers.Popup.WIDTH, 
     
    219226 
    220227        var id = this.div.id + "_contentDiv"; 
    221         this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(),  
     228        this.contentDiv = OpenLayers.Util.createDiv(id, null, this.contentSize.clone(),  
    222229                                                    null, "relative"); 
    223230        this.contentDiv.className = this.contentDisplayClass; 
     
    311318 
    312319        this.moveTo(px); 
    313         if (!this.autoSize) { 
    314             this.setSize(this.size); 
     320        if (!this.autoSize && !this.size) { 
     321            this.setSize(this.contentSize); 
    315322        } 
    316323        this.setBackgroundColor(); 
     
    400407     * 
    401408     * Parameters: 
    402      * size - {<OpenLayers.Size>} the new size of the popup's contents div 
    403      *     (in pixels). 
    404      */ 
    405     setSize:function(size) {  
    406         this.size = size;  
    407  
    408         var contentSize = this.size.clone(); 
     409     * contentSize - {<OpenLayers.Size>} the new size for the popup's  
     410     *     contents div (in pixels). 
     411     */ 
     412    setSize:function(contentSize) {  
     413        this.size = contentSize.clone();  
    409414         
    410415        // if our contentDiv has a css 'padding' set on it by a stylesheet, we  
     
    434439        // me want to shoot someone, but so it goes. 
    435440        if (OpenLayers.Util.getBrowserName() == "msie") { 
    436             contentSize.w += contentDivPadding.left + contentDivPadding.right; 
    437             contentSize.h += contentDivPadding.bottom + contentDivPadding.top; 
     441            this.contentSize.w +=  
     442                contentDivPadding.left + contentDivPadding.right; 
     443            this.contentSize.h +=  
     444                contentDivPadding.bottom + contentDivPadding.top; 
    438445        } 
    439446 
     
    449456 
    450457    /** 
     458     * APIMethod: updateSize 
     459     * Auto size the popup so that it precisely fits its contents (as  
     460     *     determined by this.contentDiv.innerHTML). Popup size will, of 
     461     *     course, be limited by the available space on the current map 
     462     */ 
     463    updateSize: function() { 
     464         
     465        // determine actual render dimensions of the contents by putting its 
     466        // contents into a fake contentDiv (for the CSS) and then measuring it 
     467        var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" +  
     468            this.contentDiv.innerHTML +  
     469            "<div>"; 
     470        var realSize = OpenLayers.Util.getRenderedDimensions( 
     471            preparedHTML, null, { displayClass: this.displayClass } 
     472        ); 
     473 
     474        // is the "real" size of the div is safe to display in our map? 
     475        var safeSize = this.getSafeContentSize(realSize); 
     476 
     477        var newSize = null; 
     478        if (safeSize.equals(realSize)) { 
     479            //real size of content is small enough to fit on the map,  
     480            // so we use real size. 
     481            newSize = realSize; 
     482 
     483        } else { 
     484 
     485            //make a new OL.Size object with the clipped dimensions  
     486            // set or null if not clipped. 
     487            var fixedSize = new OpenLayers.Size(); 
     488            fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null; 
     489            fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null; 
     490         
     491            if (fixedSize.w && fixedSize.h) { 
     492                //content is too big in both directions, so we will use  
     493                // max popup size (safeSize), knowing well that it will  
     494                // overflow both ways.                 
     495                newSize = safeSize; 
     496            } else { 
     497                //content is clipped in only one direction, so we need to  
     498                // run getRenderedDimensions() again with a fixed dimension 
     499                var clippedSize = OpenLayers.Util.getRenderedDimensions( 
     500                    preparedHTML, fixedSize,  
     501                    { displayClass: this.contentDisplayClass } 
     502                ); 
     503                 
     504                //if the clipped size is still the same as the safeSize,  
     505                // that means that our content must be fixed in the  
     506                // offending direction. If overflow is 'auto', this means  
     507                // we are going to have a scrollbar for sure, so we must  
     508                // adjust for that. 
     509                // 
     510                var currentOverflow = OpenLayers.Element.getStyle( 
     511                    this.contentDiv, "overflow" 
     512                ); 
     513                if ( (currentOverflow != "hidden") &&  
     514                     (clippedSize.equals(safeSize)) ) { 
     515                    var scrollBar = OpenLayers.Util.getScrollbarWidth(); 
     516                    if (fixedSize.w) { 
     517                        clippedSize.h += scrollBar; 
     518                    } else { 
     519                        clippedSize.w += scrollBar; 
     520                    } 
     521                } 
     522                 
     523                newSize = this.getSafeContentSize(clippedSize); 
     524            } 
     525        }                         
     526        this.setSize(newSize);      
     527    },     
     528 
     529    /** 
    451530     * Method: setBackgroundColor 
    452531     * Sets the background color of the popup. 
     
    512591    setContentHTML:function(contentHTML) { 
    513592 
    514         var preparedHTML; 
    515593        if (contentHTML != null) { 
    516594            this.contentHTML = contentHTML; 
    517595        } 
    518596        
    519         if (this.autoSize) { 
    520             //fake the contentDiv for the CSS context 
    521             preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" + this.contentHTML + "<div>"; 
    522   
    523             // determine actual render dimensions of the contents 
    524             var realSize =  
    525                 OpenLayers.Util.getRenderedDimensions(preparedHTML, null,  
    526                     { displayClass: this.displayClass }); 
    527  
    528             // is the "real" size of the div is safe to display in our map? 
    529             var safeSize = this.getSafeContentSize(realSize); 
    530  
    531             var newSize = null; 
    532               
    533             if (safeSize.equals(realSize)) { 
    534                 //real size of content is small enough to fit on the map,  
    535                 // so we use real size. 
    536                 newSize = realSize; 
    537  
    538             } else { 
    539  
    540                 //make a new OL.Size object with the clipped dimensions  
    541                 // set or null if not clipped. 
    542                 var fixedSize = new OpenLayers.Size(); 
    543                 fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null; 
    544                 fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null; 
     597        if ((this.contentDiv != null) &&  
     598            (this.contentHTML != null) && 
     599            (this.contentHTML != this.contentDiv.innerHTML)) { 
     600        
     601            this.contentDiv.innerHTML = this.contentHTML; 
     602        
     603            if (this.autoSize) { 
     604                 
     605                //if popup has images, listen for when they finish 
     606                // loading and resize accordingly 
     607                this.registerImageListeners(); 
     608 
     609                //auto size the popup to its current contents 
     610                this.updateSize(); 
     611            } 
     612        }     
     613 
     614    }, 
     615     
     616    /** 
     617     * Method: registerImageListeners 
     618     * Called when an image contained by the popup loaded. this function 
     619     *     updates the popup size, then unregisters the image load listener. 
     620     */    
     621    registerImageListeners: function() {  
     622 
     623        // As the images load, this function will call updateSize() to  
     624        // resize the popup to fit the content div (which presumably is now 
     625        // bigger than when the image was not loaded). 
     626        //  
     627        // If the 'panMapIfOutOfView' property is set, we will pan the newly 
     628        // resized popup back into view. 
     629        //  
     630        // Note that this function, when called, will have 'popup' and  
     631        // 'img' properties in the context. 
     632        // 
     633        var onImgLoad = function() { 
    545634             
    546                 if (fixedSize.w && fixedSize.h) { 
    547                     //content is too big in both directions, so we will use  
    548                     // max popup size (safeSize), knowing well that it will  
    549                     // overflow both ways.                 
    550                     newSize = safeSize; 
    551                 } else { 
    552                     //content is clipped in only one direction, so we need to  
    553                     // run getRenderedDimensions() again with a fixed dimension 
    554                     var clippedSize = OpenLayers.Util.getRenderedDimensions( 
    555                         preparedHTML, fixedSize,  
    556                         { displayClass: this.contentDisplayClass } 
    557                     ); 
    558                      
    559                     //if the clipped size is still the same as the safeSize,  
    560                     // that means that our content must be fixed in the  
    561                     // offending direction. If overflow is 'auto', this means  
    562                     // we are going to have a scrollbar for sure, so we must  
    563                     // adjust for that. 
    564                     // 
    565                     var currentOverflow = OpenLayers.Element.getStyle( 
    566                         this.contentDiv, "overflow" 
    567                     ); 
    568                     if ( (currentOverflow != "hidden") &&  
    569                          (clippedSize.equals(safeSize)) ) { 
    570                         var scrollBar = OpenLayers.Util.getScrollbarWidth(); 
    571                         if (fixedSize.w) { 
    572                             clippedSize.h += scrollBar; 
    573                         } else { 
    574                             clippedSize.w += scrollBar; 
    575                         } 
    576                     } 
    577                      
    578                     newSize = this.getSafeContentSize(clippedSize); 
    579                 } 
    580             }                         
    581             this.setSize(newSize);      
    582         }         
    583  
    584         if (this.contentDiv != null) { 
    585             this.contentDiv.innerHTML = this.contentHTML; 
    586         }     
    587     }, 
    588      
     635            this.popup.updateSize(); 
     636      
     637            if ( this.popup.visible() && this.popup.panMapIfOutOfView ) { 
     638                this.popup.panIntoView(); 
     639            } 
     640 
     641            OpenLayers.Event.stopObserving( 
     642                this.img, "load", this.img._onImageLoad 
     643            ); 
     644     
     645        }; 
     646 
     647        //cycle through the images and if their size is 0x0, that means that  
     648        // they haven't been loaded yet, so we attach the listener, which  
     649        // will fire when the images finish loading and will resize the  
     650        // popup accordingly to its new size. 
     651        var images = this.contentDiv.getElementsByTagName("img"); 
     652        for (var i = 0, len = images.length; i < len; i++) { 
     653            var img = images[i]; 
     654            if (img.width == 0 || img.height == 0) { 
     655 
     656                var context = { 
     657                    'popup': this, 
     658                    'img': img 
     659                }; 
     660 
     661                //expando this function to the image itself before registering 
     662                // it. This way we can easily and properly unregister it. 
     663                img._onImgLoad = OpenLayers.Function.bind(onImgLoad, context); 
     664 
     665                OpenLayers.Event.observe(img, 'load', img._onImgLoad); 
     666            }     
     667        }  
     668    }, 
    589669 
    590670    /** 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/Anchored.js

    r7052 r7920  
    3636    * id - {String} 
    3737    * lonlat - {<OpenLayers.LonLat>} 
    38     * size - {<OpenLayers.Size>} 
     38    * contentSize - {<OpenLayers.Size>} 
    3939    * contentHTML - {String} 
    4040    * anchor - {Object} Object which must expose a 'size' <OpenLayers.Size>  
     
    4343    * closeBoxCallback - {Function} Function to be called on closeBox click. 
    4444    */ 
    45     initialize:function(id, lonlat, size, contentHTML, anchor, closeBox, 
     45    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 
    4646                        closeBoxCallback) { 
    47         var newArguments = new Array(id, lonlat, size, contentHTML, closeBox, 
    48                                      closeBoxCallback); 
     47        var newArguments = [ 
     48            id, lonlat, contentSize, contentHTML, closeBox, closeBoxCallback 
     49        ]; 
    4950        OpenLayers.Popup.prototype.initialize.apply(this, newArguments); 
    5051 
     
    109110     *  
    110111     * Parameters: 
    111      * size - {<OpenLayers.Size>} 
     112     * contentSize - {<OpenLayers.Size>} the new size for the popup's  
     113     *     contents div (in pixels). 
    112114     */ 
    113     setSize:function(size) {  
     115    setSize:function(contentSize) {  
    114116        OpenLayers.Popup.prototype.setSize.apply(this, arguments); 
    115117 
     
    165167    calculateNewPx:function(px) { 
    166168        var newPx = px.offset(this.anchor.offset); 
     169         
     170        //use contentSize if size is not already set 
     171        var size = this.size || this.contentSize; 
    167172 
    168173        var top = (this.relativePosition.charAt(0) == 't'); 
    169         newPx.y += (top) ? -this.size.h : this.anchor.size.h; 
     174        newPx.y += (top) ? -size.h : this.anchor.size.h; 
    170175         
    171176        var left = (this.relativePosition.charAt(1) == 'l'); 
    172         newPx.x += (left) ? -this.size.w : this.anchor.size.w; 
     177        newPx.x += (left) ? -size.w : this.anchor.size.w; 
    173178 
    174179        return newPx;    
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/AnchoredBubble.js

    r6718 r7920  
    2929     * id - {String} 
    3030     * lonlat - {<OpenLayers.LonLat>} 
    31      * size - {<OpenLayers.Size>} 
     31     * contentSize - {<OpenLayers.Size>} 
    3232     * contentHTML - {String} 
    3333     * anchor - {Object} Object to which we'll anchor the popup. Must expose  
     
    3737     * closeBoxCallback - {Function} Function to be called on closeBox click. 
    3838     */ 
    39     initialize:function(id, lonlat, size, contentHTML, anchor, closeBox, 
     39    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, 
    4040                        closeBoxCallback) { 
    4141         
     
    8282     *  
    8383     * Parameters: 
    84      * size - {<OpenLayers.Size>} 
     84     * contentSize - {<OpenLayers.Size>} the new size for the popup's  
     85     *     contents div (in pixels). 
    8586     */ 
    86     setSize:function(size) {  
     87    setSize:function(contentSize) {  
    8788        OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 
    8889 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/Framed.js

    r6800 r7920  
    8686     * id - {String} 
    8787     * lonlat - {<OpenLayers.LonLat>} 
    88      * size - {<OpenLayers.Size>} 
     88     * contentSize - {<OpenLayers.Size>} 
    8989     * contentHTML - {String} 
    9090     * anchor - {Object} Object to which we'll anchor the popup. Must expose  
     
    9494     * closeBoxCallback - {Function} Function to be called on closeBox click. 
    9595     */ 
    96     initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,  
     96    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,  
    9797                        closeBoxCallback) { 
    9898 
     
    189189     *  
    190190     * Parameters: 
    191      * size - {<OpenLayers.Size>} 
    192      */ 
    193     setSize:function(size) {  
     191     * contentSize - {<OpenLayers.Size>} the new size for the popup's  
     192     *     contents div (in pixels). 
     193     */ 
     194    setSize:function(contentSize) {  
    194195        OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 
    195196 
     
    297298        } 
    298299         
    299         if (this.relativePosition) { 
     300        if (this.size && this.relativePosition) { 
    300301            var position = this.positionBlocks[this.relativePosition]; 
    301302            for (var i = 0; i < position.blocks.length; i++) { 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Popup/FramedCloud.js

    r7785 r7920  
    204204     * id - {String} 
    205205     * lonlat - {<OpenLayers.LonLat>} 
    206      * size - {<OpenLayers.Size>} 
     206     * contentSize - {<OpenLayers.Size>} 
    207207     * contentHTML - {String} 
    208208     * anchor - {Object} Object to which we'll anchor the popup. Must expose  
     
    212212     * closeBoxCallback - {Function} Function to be called on closeBox click. 
    213213     */ 
    214     initialize:function(id, lonlat, size, contentHTML, anchor, closeBox,  
     214    initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox,  
    215215                        closeBoxCallback) { 
    216216 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Canvas.js

    r7875 r7920  
    44 
    55/** 
     6 * @requires OpenLayers/Renderer.js 
     7 */ 
     8 
     9/** 
    610 * Class: OpenLayers.Renderer.Canvas  
    711 * A renderer based on the 2D 'canvas' drawing element.element 
    8  * 
     12 *  
     13 * Inherits: 
     14 *  - <OpenLayers.Renderer> 
    915 */ 
    1016OpenLayers.Renderer.Canvas = OpenLayers.Class(OpenLayers.Renderer, { 
     
    3743  
    3844    /** 
    39      * Constructor: OpenLayers.Renderer  
     45     * Constructor: OpenLayers.Renderer.Canvas 
    4046     * 
    4147     * Parameters: 
     
    398404            delete this.features[features[i].id]; 
    399405        } 
    400         if (!this.locked) { 
    401             this.redraw(); 
    402         } 
     406        this.redraw(); 
    403407    }, 
    404408 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/Elements.js

    r7785 r7920  
    464464        }; 
    465465 
    466         // 
    467         if (style.backgroundGraphic) { 
    468             this.redrawBackgroundNode(geometry.id, geometry, style, featureId); 
    469         } 
    470          
    471466        if (style.display != "none") { 
    472             this.redrawNode(geometry.id, geometry, style, featureId);  
     467            if (style.backgroundGraphic) { 
     468                this.redrawBackgroundNode(geometry.id, geometry, style, featureId); 
     469            } 
     470            this.redrawNode(geometry.id, geometry, style, featureId); 
    473471        } else { 
    474472            var node = OpenLayers.Util.getElement(geometry.id); 
    475473            if (node) {