OpenLayers OpenLayers

Changeset 7349

Show
Ignore:
Timestamp:
06/11/08 09:48:50 (7 months ago)
Author:
elemoine
Message:

sync with vector-behavior

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/camptocamp/unhcr/build/full.cfg

    r6569 r7349  
    1414Firebug/firebug.js 
    1515Firebug/firebugx.js 
     16OpenLayers/Lang/cs-CZ.js 
    1617OpenLayers/Lang/de.js 
    1718OpenLayers/Lang/en-CA.js 
    1819OpenLayers/Lang/fr.js 
    19 OpenLayers/Lang/cs-CZ.js 
     20OpenLayers/Lang/it.js 
     21OpenLayers/Lang/pt-BR.js 
     22OpenLayers/Lang/sv-SE.js 
  • sandbox/camptocamp/unhcr/build/library.cfg

    r6569 r7349  
    4747OpenLayers/Renderer/VML.js 
    4848OpenLayers/Renderer.js 
     49OpenLayers/Lang/cs-CZ.js 
    4950OpenLayers/Lang/de.js 
    5051OpenLayers/Lang/en-CA.js 
    5152OpenLayers/Lang/fr.js 
    52 OpenLayers/Lang/cs-CZ.js 
     53OpenLayers/Lang/it.js 
     54OpenLayers/Lang/pt-BR.js 
     55OpenLayers/Lang/sv-SE.js 
    5356 
    54  
  • sandbox/camptocamp/unhcr/build/license.txt

    r7029 r7349  
    7373 * 
    7474 */ 
     75 
     76/** 
     77 * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/> 
     78 * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com) 
     79 * 
     80 * Licensed under the Apache License, Version 2.0 (the "License"); 
     81 * you may not use this file except in compliance with the License. 
     82 * You may obtain a copy of the License at 
     83 * http://www.apache.org/licenses/LICENSE-2.0 
     84 */ 
  • sandbox/camptocamp/unhcr/build/lite.cfg

    r6569 r7349  
    2222Firebug/firebug.js 
    2323Firebug/firebugx.js 
     24OpenLayers/Lang/cs-CZ.js 
    2425OpenLayers/Lang/de.js 
    2526OpenLayers/Lang/en-CA.js 
    2627OpenLayers/Lang/fr.js 
    27 OpenLayers/Lang/cs-CZ.js 
     28OpenLayers/Lang/it.js 
     29OpenLayers/Lang/pt-BR.js 
     30OpenLayers/Lang/sv-SE.js 
    2831 
  • sandbox/camptocamp/unhcr/examples/spherical-mercator.html

    r7237 r7349  
    55    <style type="text/css"> 
    66        .olControlAttribution { bottom: 0px!important } 
     7        #map { 
     8            height: 512px; 
     9        } 
    710    </style> 
    811 
  • sandbox/camptocamp/unhcr/lib/OpenLayers.js

    r7304 r7349  
    8585            "Rico/Corner.js", 
    8686            "Rico/Color.js", 
     87            "OpenLayers/Ajax.js", 
    8788            "OpenLayers/Request.js", 
    8889            "OpenLayers/Request/XMLHttpRequest.js", 
    89             "OpenLayers/Ajax.js", 
    9090            "OpenLayers/Events.js", 
    9191            "OpenLayers/Projection.js", 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Ajax.js

    r7052 r7349  
    33 * full text of the license. */ 
    44 
     5/** 
     6 * @requires OpenLayers/Request/XMLHttpRequest.js 
     7 */ 
    58 
    69OpenLayers.ProxyHost = ""; 
     
    3134 
    3235 
    33 /**  
    34 * @param {} request 
    35 */ 
     36/** 
     37 * Function: OpenLayers.nullHandler 
     38 * @param {} request 
     39 */ 
    3640OpenLayers.nullHandler = function(request) { 
    3741    alert(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText})); 
     
    4044/**  
    4145 * Function: loadURL 
    42  * Background load a document. 
     46 * Background load a document.  For more flexibility in using XMLHttpRequest, 
     47 *     see the <OpenLayers.Request> methods. 
    4348 * 
    4449 * Parameters: 
     
    5055 * onComplete - {Function} Optional callback for success.  The callback 
    5156 *     will be called with this set to caller and will receive the request 
    52  *     object as an argument. 
     57 *     object as an argument.  Note that if you do not specify an onComplete 
     58 *     function, <OpenLayers.nullHandler> will be called (which pops up an 
     59 *     alert dialog). 
    5360 * onFailure - {Function} Optional callback for failure.  In the event of 
    5461 *     a failure, the callback will be called with this set to caller and will 
    55  *     receive the request object as an argument. 
     62 *     receive the request object as an argument.  Note that if you do not 
     63 *     specify an onComplete function, <OpenLayers.nullHandler> will be called 
     64 *     (which pops up an alert dialog). 
    5665 * 
    5766 * Returns: 
    58  * {XMLHttpRequest}  The request object.  To abort loading, call 
    59  *     request.abort(). 
     67 * {<OpenLayers.Request.XMLHttpRequest>}  The request object. To abort loading, 
     68 *     call request.abort(). 
    6069 */ 
    6170OpenLayers.loadURL = function(uri, params, caller, 
    6271                                  onComplete, onFailure) { 
    63  
    64     var success = (onComplete) ? OpenLayers.Function.bind(onComplete, caller) 
    65                                 : OpenLayers.nullHandler; 
    66  
    67     var failure = (onFailure) ? OpenLayers.Function.bind(onFailure, caller) 
    68                            : OpenLayers.nullHandler; 
    69  
    70     // from prototype.js 
    71     var request = new OpenLayers.Ajax.Request( 
    72         uri,  
    73         { 
    74             method: 'get',  
    75             parameters: params, 
    76             onComplete: success,  
    77             onFailure: failure 
    78         } 
    79     ); 
    80     return request.transport; 
     72     
     73    if(typeof params == 'string') { 
     74        params = OpenLayers.Util.getParameters(params); 
     75    } 
     76    var success = (onComplete) ? onComplete : OpenLayers.nullHandler; 
     77    var failure = (onFailure) ? onFailure : OpenLayers.nullHandler; 
     78     
     79    return OpenLayers.Request.GET({ 
     80        url: uri, params: params, 
     81        success: success, failure: failure, scope: caller 
     82    }); 
    8183}; 
    8284 
     
    264266/** 
    265267 * Class: OpenLayers.Ajax.Request 
     268 * *Deprecated*.  Use <OpenLayers.Request> method instead. 
    266269 * 
    267270 * Inherit: 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Control/PanZoomBar.js

    r6833 r7349  
    187187                                      imgLocation + "zoombar.png",  
    188188                                      "absolute", null, "crop"); 
    189             div.style.height = sz.h
     189            div.style.height = sz.h + "px"
    190190        } else { 
    191191            div = OpenLayers.Util.createDiv( 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Format/KML.js

    r6748 r7349  
    1010 * @requires OpenLayers/Geometry/Polygon.js 
    1111 * @requires OpenLayers/Geometry/Collection.js 
     12 * @requires OpenLayers/Request/XMLHttpRequest.js 
    1213 */ 
    1314 
     
    250251     */ 
    251252    fetchLink: function(href) { 
    252         var request = new OpenLayers.Ajax.Request(href,  
    253                       {method: 'get', asynchronous: false }); 
    254  
    255         if (request && request.transport) { 
    256             return request.transport.responseText; 
     253        var request = OpenLayers.Request.GET({url: href, async: false}); 
     254        if (request) { 
     255            return request.responseText; 
    257256        } 
    258257    }, 
     
    551550                    var inlineStyle= this.parseStyle(inlineStyleNode); 
    552551                    if (inlineStyle) { 
    553                         feature.style = OpenLayers.Util.extend({},  
    554                                             feature.style); 
    555                         OpenLayers.Util.extend(feature.style, inlineStyle); 
     552                        feature.style = OpenLayers.Util.extend( 
     553                            feature.style, inlineStyle 
     554                        ); 
    556555                    } 
    557556                } 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Format/SLD/v1.js

    r7156 r7349  
    235235                    symbolizer.externalGraphic = graphic.href; 
    236236                } 
     237                if(graphic.rotation != undefined) { 
     238                    symbolizer.rotation = graphic.rotation; 
     239                } 
    237240            }, 
    238241            "ExternalGraphic": function(node, graphic) { 
     
    291294        "stroke-linecap": "strokeLinecap", 
    292295        "fill": "fillColor", 
    293         "fill-opacity": "fillOpacity" 
     296        "fill-opacity": "fillOpacity", 
     297        "font-family": "fontFamily", 
     298        "font-size": "fontSize" 
    294299    }, 
    295300     
     
    597602                    value: obj.symbolizer[obj.key] 
    598603                }); 
     604            }, 
     605            "TextSymbolizer": function(symbolizer) { 
     606                var node = this.createElementNSPlus("TextSymbolizer"); 
     607                // add in optional Label 
     608                if(symbolizer.label != null) { 
     609                    this.writeNode(node, "Label", symbolizer.label); 
     610                } 
     611                // add in optional Font 
     612                if(symbolizer.fontFamily != null || 
     613                   symbolizer.fontSize != null) { 
     614                    this.writeNode(node, "Font", symbolizer); 
     615                } 
     616                // add in optional Fill 
     617                if(symbolizer.fillColor != null || 
     618                   symbolizer.fillOpacity != null) { 
     619                    this.writeNode(node, "Fill", symbolizer); 
     620                } 
     621                return node; 
     622            }, 
     623            "Font": function(symbolizer) { 
     624                var node = this.createElementNSPlus("Font"); 
     625                // add in CssParameters 
     626                if(symbolizer.fontFamily) { 
     627                    this.writeNode( 
     628                        node, "CssParameter", 
     629                        {symbolizer: symbolizer, key: "fontFamily"} 
     630                    ); 
     631                } 
     632                if(symbolizer.fontSize) { 
     633                    this.writeNode( 
     634                        node, "CssParameter", 
     635                        {symbolizer: symbolizer, key: "fontSize"} 
     636                    ); 
     637                } 
     638                return node; 
     639            }, 
     640            "Label": function(label) { 
     641                // only the simplest of ogc:expression handled 
     642                // {label: "some text and a ${propertyName}"} 
     643                var node = this.createElementNSPlus("Label"); 
     644                var tokens = label.split("${"); 
     645                node.appendChild(this.createTextNode(tokens[0])); 
     646                var item, last; 
     647                for(var i=1; i<tokens.length; i++) { 
     648                    item = tokens[i]; 
     649                    last = item.indexOf("}");  
     650                    if(last > 0) { 
     651                        this.writeNode( 
     652                            node, "ogc:PropertyName", 
     653                            {property: item.substring(0, last)} 
     654                        ); 
     655                        node.appendChild( 
     656                            this.createTextNode(item.substring(++last)) 
     657                        ); 
     658                    } else { 
     659                        // no ending }, so this is a literal ${ 
     660                        node.appendChild( 
     661                            this.createTextNode("${" + item) 
     662                        ); 
     663                    } 
     664                } 
     665                return node; 
    599666            }, 
    600667            "PolygonSymbolizer": function(symbolizer) { 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/GML.js

    r6573 r7349  
    55/** 
    66 * @requires OpenLayers/Layer/Vector.js 
    7  * @requires OpenLayers/Ajax.js 
     7 * @requires OpenLayers/Request/XMLHttpRequest.js 
    88 */ 
    99 
     
    101101    loadGML: function() { 
    102102        if (!this.loaded) { 
    103             var results = OpenLayers.loadURL(this.url, null, this, this.requestSuccess, this.requestFailure); 
     103            OpenLayers.Request.GET({ 
     104                url: this.url, 
     105                success: this.requestSuccess, 
     106                failure: this.requestFailure, 
     107                scope: this 
     108            }); 
    104109            this.loaded = true; 
    105110        }     
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/GeoRSS.js

    r7052 r7349  
    66/** 
    77 * @requires OpenLayers/Layer/Markers.js 
    8  * @requires OpenLayers/Ajax.js 
     8 * @requires OpenLayers/Request/XMLHttpRequest.js 
    99 */ 
    1010 
     
    101101        if (!this.loaded) { 
    102102            this.events.triggerEvent("loadstart"); 
    103             OpenLayers.loadURL(this.location, null, this, this.parseData); 
     103            OpenLayers.Request.GET({ 
     104                url: this.location, 
     105                success: this.parseData, 
     106                scope: this 
     107            }); 
    104108            this.loaded = true; 
    105109        }     
     
    128132     * 
    129133     * Parameters: 
    130      * ajaxRequest - {XMLHttpRequest}  
     134     * ajaxRequest - {<OpenLayers.Request.XMLHttpRequest>}  
    131135     */ 
    132136    parseData: function(ajaxRequest) { 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/KaMap.js

    r6748 r7349  
    6565        newArguments.push(name, url, params, options); 
    6666        OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 
    67         this.params = (params ? params : {}); 
    68         if (params) { 
    69             OpenLayers.Util.applyDefaults( 
    70                            this.params,  
    71                            this.DEFAULT_PARAMS 
    72                            ); 
    73         } 
     67        this.params = OpenLayers.Util.applyDefaults( 
     68            this.params, this.DEFAULT_PARAMS 
     69        ); 
    7470    }, 
    7571 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/MapGuide.js

    r6748 r7349  
    44 
    55/** 
    6  * @requires OpenLayers/Ajax.js 
     6 * @requires OpenLayers/Request/XMLHttpRequest.js 
    77 * @requires OpenLayers/Layer/Grid.js 
    88 */ 
     
    203203            getVisParams.format = 'text/xml'; 
    204204            getVisParams = OpenLayers.Util.extend(getVisParams, params); 
    205                  
    206             new OpenLayers.Ajax.Request(this.url,  
    207                   { parameters: getVisParams, 
    208                     method: 'get', 
    209                     asynchronous: false   //must be synchronous call to return control here 
    210                   }); 
     205             
     206            OpenLayers.Request.GET({ 
     207                url: this.url, params: getVisParams, async: false 
     208            }); 
    211209          } 
    212210           
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/MapServer.js

    r6418 r7349  
    4343        OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 
    4444 
    45         if (arguments.length > 0) { 
    46             OpenLayers.Util.applyDefaults( 
    47                            this.params, 
    48                            this.DEFAULT_PARAMS 
    49                            ); 
    50         } 
     45        this.params = OpenLayers.Util.applyDefaults( 
     46            this.params, this.DEFAULT_PARAMS 
     47        ); 
    5148 
    5249        // unless explicitly set in options, if the layer is transparent,  
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/Text.js

    r7052 r7349  
    66/** 
    77 * @requires OpenLayers/Layer/Markers.js 
    8  * @requires OpenLayers/Ajax.js 
     8 * @requires OpenLayers/Request/XMLHttpRequest.js 
    99 */ 
    1010 
     
    110110 
    111111                this.events.triggerEvent("loadstart"); 
    112                 OpenLayers.loadURL(this.location, null,  
    113                                    this, this.parseData, onFail); 
     112                OpenLayers.Request.GET({ 
     113                    url: this.location, 
     114                    success: this.parseData, 
     115                    failure: onFail, 
     116                    scope: this 
     117                }); 
    114118                this.loaded = true; 
    115119            } 
     
    138142     * 
    139143     * Parameters: 
    140      * ajaxRequest - {XMLHttpRequest}  
     144     * ajaxRequest - {<OpenLayers.Request.XMLHttpRequest>}  
    141145     */ 
    142146    parseData: function(ajaxRequest) { 
     
    171175             
    172176            // FIXME: At the moment, we only use this if we have an  
    173             // externalGraphic, because icon has no setOffset API Method.   
    174             if (feature.style.graphicXOffset !== null 
    175                 && feature.style.graphicYOffset !== null) { 
     177            // externalGraphic, because icon has no setOffset API Method. 
     178            /** 
     179             * FIXME FIRST!! 
     180             * The Text format does all sorts of parseFloating 
     181             * The result of a parseFloat for a bogus string is NaN.  That 
     182             * means the three possible values here are undefined, NaN, or a 
     183             * number.  The previous check was an identity check for null.  This 
     184             * means it was failing for all undefined or NaN.  A slightly better 
     185             * check is for undefined.  An even better check is to see if the 
     186             * value is a number (see #1441). 
     187             */ 
     188            if (feature.style.graphicXOffset !== undefined 
     189                && feature.style.graphicYOffset !== undefined) { 
    176190                iconOffset = new OpenLayers.Pixel( 
    177191                    feature.style.graphicXOffset,  
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/VirtualEarth.js

    r6313 r7349  
    9696        var veDiv = OpenLayers.Util.createDiv(this.name); 
    9797        var sz = this.map.getSize(); 
    98         veDiv.style.width = sz.w
    99         veDiv.style.height = sz.h
     98        veDiv.style.width = sz.w + "px"
     99        veDiv.style.height = sz.h + "px"
    100100        this.div.appendChild(veDiv); 
    101101 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/WFS.js

    r6495 r7349  
    139139        }     
    140140         
    141         this.params = params; 
    142         OpenLayers.Util.applyDefaults( 
    143                        this.params,  
    144                        OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) 
    145                        ); 
     141        this.params = OpenLayers.Util.applyDefaults( 
     142            params,  
     143            OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS) 
     144        ); 
    146145        this.url = url; 
    147146    },     
     
    457456 
    458457        var data = this.writer.write(this.features); 
    459          
    460         var url = this.url; 
    461  
    462         var success = OpenLayers.Function.bind(this.commitSuccess, this); 
    463  
    464         var failure = OpenLayers.Function.bind(this.commitFailure, this); 
    465          
    466         // from prototype.js 
    467         new OpenLayers.Ajax.Request(url,  
    468                          {   method: 'post',  
    469                              postBody: data, 
    470                              onComplete: success,  
    471                              onFailure: failure 
    472                           } 
    473                          ); 
     458 
     459        OpenLayers.Request.POST({ 
     460            url: this.url, 
     461            data: data, 
     462            success: this.commitSuccess, 
     463            failure: this.commitFailure, 
     464            scope: this 
     465        }); 
    474466    }, 
    475467 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Layer/WorldWind.js

    r6418 r7349  
    5555        newArguments.push(name, url, params, options); 
    5656        OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); 
    57         this.params = (params ? params : {}); 
    58         if (params) { 
    59             OpenLayers.Util.applyDefaults( 
    60                            this.params,  
    61                            this.DEFAULT_PARAMS 
    62                            ); 
    63         } 
     57        this.params = OpenLayers.Util.applyDefaults( 
     58            this.params, this.DEFAULT_PARAMS 
     59        ); 
    6460    }, 
    6561    /** 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Map.js

    r7241 r7349  
    13361336     */ 
    13371337    pan: function(dx, dy, options) { 
    1338         // this should be pushed to applyDefaults and extend 
    1339         if (!options) { 
    1340             options = {}; 
    1341         } 
    1342         OpenLayers.Util.applyDefaults(options, { 
     1338        options = OpenLayers.Util.applyDefaults(options, { 
    13431339            animate: true, 
    13441340            dragging: false 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/SVG.js

    r6581 r7349  
    223223                node.setAttributeNS(null, "r", style.pointRadius); 
    224224            } 
     225 
     226            if (style.rotation) { 
     227                var rotation = OpenLayers.String.format( 
     228                    "rotate(${0} ${1} ${2})", [style.rotation, x, y]); 
     229                node.setAttributeNS(null, "transform", rotation); 
     230            } 
    225231        } 
    226232         
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Renderer/VML.js

    r6764 r7349  
    9999        OpenLayers.Renderer.prototype.setSize.apply(this, arguments); 
    100100 
    101         this.rendererRoot.style.width = this.size.w
    102         this.rendererRoot.style.height = this.size.h
    103  
    104         this.root.style.width = this.size.w
    105         this.root.style.height = this.size.h
     101        this.rendererRoot.style.width = this.size.w + "px"
     102        this.rendererRoot.style.height = this.size.h + "px"
     103 
     104        this.root.style.width = this.size.w + "px"
     105        this.root.style.height = this.size.h + "px"
    106106    }, 
    107107 
     
    170170                node.style.left = ((geometry.x/resolution)+xOffset).toFixed(); 
    171171                node.style.top = ((geometry.y/resolution)-(yOffset+height)).toFixed(); 
    172                 node.style.width = width; 
    173                 node.style.height = height;     
     172                node.style.width = width + "px"; 
     173                node.style.height = height + "px"; 
     174                node.style.flip = "y"; 
    174175                 
    175176                // modify style/options for fill and stroke styling below 
     
    210211                fill.setAttribute("src", style.externalGraphic); 
    211212                fill.setAttribute("type", "frame"); 
    212                 node.style.flip = "y"; 
    213213                 
    214214                if (!(style.graphicWidth && style.graphicHeight)) { 
    215215                  fill.aspect = "atmost"; 
    216216                }                 
     217                          
     218                // additional rendering for rotated graphics 
     219                if (style.rotation) { 
     220                    this.graphicRotate(node, xOffset, yOffset); 
     221                    // make the fill fully transparent, because we now have 
     222                    // the graphic as imagedata element. We cannot just remove 
     223                    // the fill, because this is part of the hack described 
     224                    // in graphicRotate 
     225                    fill.setAttribute("opacity", 0); 
     226                } 
    217227            } 
    218228            if (fill.parentNode != node) { 
     
    248258        } 
    249259        return node; 
     260    }, 
     261 
     262    /** 
     263     * Method: graphicRotate 
     264     * If a point is to be styled with externalGraphic and rotation, VML fills 
     265     * cannot be used to display the graphic, because rotation of graphic 
     266     * fills is not supported by the VML implementation of Internet Explorer. 
     267     * This method creates a olv:imagedata element inside the VML node, 
     268     * DXImageTransform.Matrix and BasicImage filters for rotation and 
     269     * opacity, and a 3-step hack to remove rendering artefacts from the 
     270     * graphic and preserve the ability of graphics to trigger events. 
     271     * Finally, OpenLayers methods are used to determine the correct 
     272     * insertion point of the rotated image, because DXImageTransform.Matrix 
     273     * does the rotation without the ability to specify a rotation center 
     274     * point. 
     275     *  
     276     * Parameters: 
     277     * node    - {DOMElement} 
     278     * xOffset - {Number} rotation center relative to image, x coordinate 
     279     * yOffset - {Number} rotation center relative to image, y coordinate 
     280     */ 
     281    graphicRotate: function(node, xOffset, yOffset) { 
     282        var style = style || node._style; 
     283        var options = node._options; 
     284         
     285        var aspectRatio, size; 
     286        if (!(style.graphicWidth && style.graphicHeight)) { 
     287            // load the image to determine its size 
     288            var img = new Image(); 
     289            img.onreadystatechange = OpenLayers.Function.bind(function() { 
     290                if(img.readyState == "complete" || 
     291                        img.readyState == "interactive") { 
     292                    aspectRatio = img.width / img.height; 
     293                    size = Math.max(style.pointRadius * 2,  
     294                        style.graphicWidth || 0, 
     295                        style.graphicHeight || 0); 
     296                    xOffset = xOffset * aspectRatio; 
     297                    style.graphicWidth = size * aspectRatio; 
     298                    style.graphicHeight = size; 
     299                    this.graphicRotate(node, xOffset, yOffset) 
     300                } 
     301            }, this); 
     302            img.src = style.externalGraphic; 
     303             
     304            // will be called again by the onreadystate handler 
     305            return; 
     306        } else { 
     307            size = Math.max(style.graphicWidth, style.graphicHeight); 
     308            aspectRatio = style.graphicWidth / style.graphicHeight; 
     309        } 
     310         
     311        var width = Math.round(style.graphicWidth || size * aspectRatio); 
     312        var height = Math.round(style.graphicHeight || size); 
     313        node.style.width = width + "px"; 
     314        node.style.height = height + "px"; 
     315         
     316        // Three steps are required to remove artefacts for images with 
     317        // transparent backgrounds (resulting from using DXImageTransform 
     318        // filters on svg objects), while preserving awareness for browser 
     319        // events on images: 
     320        // - Use the fill as usual (like for unrotated images) to handle 
     321        //   events 
     322        // - specify an imagedata element with the same src as the fill 
     323        // - style the imagedata element with an AlphaImageLoader filter 
     324        //   with empty src 
     325        var image = document.getElementById(node.id + "_image"); 
     326        if (!image) { 
     327            image = this.createNode("olv:imagedata", node.id + "_image"); 
     328            node.appendChild(image); 
     329        } 
     330        image.style.width = width + "px"; 
     331        image.style.height = height + "px"; 
     332        image.src = style.externalGraphic; 
     333        image.style.filter = 
     334            "progid:DXImageTransform.Microsoft.AlphaImageLoader(" +  
     335            "src='', sizingMethod='scale')"; 
     336 
     337        var rotation = style.rotation * Math.PI / 180; 
     338        var sintheta = Math.sin(rotation); 
     339        var costheta = Math.cos(rotation); 
     340 
     341        // do the rotation on the image 
     342        var filter = 
     343            "progid:DXImageTransform.Microsoft.Matrix(M11=" + costheta + 
     344            ",M12=" + (-sintheta) + ",M21=" + sintheta + ",M22=" + costheta + 
     345            ",SizingMethod='auto expand')\n" 
     346 
     347        // set the opacity (needed for the imagedata) 
     348        var opacity = style.graphicOpacity || style.fillOpacity; 
     349        if (opacity && opacity != 1) { 
     350            filter +=  
     351                "progid:DXImageTransform.Microsoft.BasicImage(opacity=" +  
     352                opacity+")\n"; 
     353        } 
     354        node.style.filter = filter; 
     355 
     356        // do the rotation again on a box, so we know the insertion point 
     357        var centerPoint = new OpenLayers.Geometry.Point(-xOffset, -yOffset); 
     358        var imgBox = new OpenLayers.Bounds(0, 0, width, height).toGeometry(); 
     359        imgBox.rotate(style.rotation, centerPoint); 
     360        var imgBounds = imgBox.getBounds(); 
     361 
     362        node.style.left = Math.round( 
     363            parseInt(node.style.left) + imgBounds.left) + "px"; 
     364        node.style.top = Math.round( 
     365            parseInt(node.style.top) - imgBounds.bottom) + "px"; 
    250366    }, 
    251367 
     
    296412             
    297413            // Set the internal coordinate system to draw the path 
    298             node.style.left = scaledBox.left
    299             node.style.top = scaledBox.top
    300             node.style.width = scaledBox.getWidth()
    301             node.style.height = scaledBox.getHeight()
     414            node.style.left = scaledBox.left + "px"
     415            node.style.top = scaledBox.top + "px"
     416            node.style.width = scaledBox.getWidth() + "px"
     417            node.style.height = scaledBox.getHeight() + "px"
    302418     
    303419            node.coordorigin = scaledBox.left + " " + scaledBox.top; 
     
    415531            var resolution = this.getResolution(); 
    416532         
    417             node.style.left = (geometry.x /resolution).toFixed() - radius
    418             node.style.top = (geometry.y /resolution).toFixed() - radius
     533            node.style.left = ((geometry.x /resolution).toFixed() - radius) + "px"
     534            node.style.top = ((geometry.y /resolution).toFixed() - radius) + "px"
    419535     
    420536            var diameter = radius * 2; 
    421537             
    422             node.style.width = diameter
    423             node.style.height = diameter
     538            node.style.width = diameter + "px"
     539            node.style.height = diameter + "px"
    424540        } 
    425541    }, 
     
    523639        var resolution = this.getResolution(); 
    524640     
    525         node.style.left = geometry.x/resolution
    526         node.style.top = geometry.y/resolution
    527         node.style.width = geometry.width/resolution
    528         node.style.height = geometry.height/resolution
     641        node.style.left = geometry.x/resolution + "px"
     642        node.style.top = geometry.y/resolution + "px"
     643        node.style.width = geometry.width/resolution + "px"
     644        node.style.height = geometry.height/resolution + "px"
    529645    }, 
    530646 
  • sandbox/camptocamp/unhcr/lib/OpenLayers/Request.js

    r7177 r7349  
    2626        data: null, 
    2727        callback: function() {}, 
     28        success: null, 
     29        failure: null, 
    2830        scope: null 
    2931    }, 
     
    3739     * config - {Object} Object containing properties for configuring the 
    3840     *     request.  Al