OpenLayers OpenLayers

Changeset 6122

Show
Ignore:
Timestamp:
02/08/08 13:02:54 (1 year ago)
Author:
crschmidt
Message:

Merge to trunk HEAD

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/ahocevar/styleMap/openlayers/doc/authors.txt

    r5970 r6122  
    11OpenLayers contributors: 
    22 
     3Seb Benthall 
    34Howard Butler 
    45Bertil Chaupis                                                                
     
    2526James Stembridge 
    2627Erik Uzureau 
     28Ivan Willig 
    2729Bill Woodall 
    2830Steve Woodbridge 
     
    3335Some portions of OpenLayers are used under the MIT license, availabie in  
    3436doc/licenses/MIT-LICENSE.txt. 
     37 
     38Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used  
     39under the BSD license, available in doc/licenses/BSD-LICENSE.txt 
  • sandbox/ahocevar/styleMap/openlayers/examples/click-handler.html

    r5438 r6122  
    3939                    'single': true, 
    4040                    'double': false, 
    41                     'pixelTolerance': null
     41                    'pixelTolerance': 0
    4242                    'stopSingle': false, 
    4343                    'stopDouble': false 
     
    103103                        } 
    104104                    }), 
    105                     "nodrag": new OpenLayers.Control.Click({ 
     105                    "drag": new OpenLayers.Control.Click({ 
    106106                        handlerOptions: { 
    107107                            "single": true, 
    108                             "pixelTolerance": 1 
     108                            "pixelTolerance": null 
    109109                        } 
    110110                    }), 
     
    205205                    </tr> 
    206206                    <tr> 
    207                         <td>single no drag</td> 
    208                         <td><button id="nodragStatus" onclick="toggle('nodrag')">off</button></td> 
    209                         <td><textarea class="output" id="nodragOutput"></textarea></td> 
     207                        <td>single with drag</td> 
     208                        <td><button id="dragStatus" onclick="toggle('drag')">off</button></td> 
     209                        <td><textarea class="output" id="dragOutput"></textarea></td> 
    210210                    </tr> 
    211211                    <tr> 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers.js

    r6079 r6122  
    8080            "OpenLayers/BaseTypes/Size.js", 
    8181            "OpenLayers/Console.js", 
     82            "OpenLayers/Tween.js", 
    8283            "Rico/Corner.js", 
    8384            "Rico/Color.js", 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Control.js

    r5910 r6122  
    140140            this.handler = null; 
    141141        } 
     142        if(this.handlers) { 
     143            for(var key in this.handlers) { 
     144                if(this.handlers.hasOwnProperty(key) && 
     145                   typeof this.handlers[key].destroy == "function") { 
     146                    this.handlers[key].destroy(); 
     147                } 
     148            } 
     149            this.handlers = null; 
     150        } 
    142151        if (this.map) { 
    143152            this.map.removeControl(this); 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Control/DragFeature.js

    r5614 r6122  
    7878 
    7979    /** 
    80      * Property: dragHandler 
    81      * {<OpenLayers.Handler.Drag>} 
    82      */ 
    83     dragHandler: null, 
    84  
    85     /** 
    8680     * Property: dragCallbacks 
    8781     * {Object} The functions that are sent to the drag handler for callback. 
    8882     */ 
    8983    dragCallbacks: {}, 
    90  
    91     /** 
    92      * Property: featureHandler 
    93      * {<OpenLayers.Handler.Feature>} 
    94      */ 
    95     featureHandler: null, 
    9684 
    9785    /** 
     
    120108        OpenLayers.Control.prototype.initialize.apply(this, [options]); 
    121109        this.layer = layer; 
    122         this.dragCallbacks = OpenLayers.Util.extend({down: this.downFeature, 
    123                                                      move: this.moveFeature, 
    124                                                      up: this.upFeature, 
    125                                                      out: this.cancel, 
    126                                                      done: this.doneDragging 
    127                                                     }, this.dragCallbacks); 
    128         this.dragHandler = new OpenLayers.Handler.Drag(this, this.dragCallbacks); 
    129         this.featureCallbacks = OpenLayers.Util.extend({over: this.overFeature, 
    130                                                         out: this.outFeature 
    131                                                        }, this.featureCallbacks); 
    132         var handlerOptions = {geometryTypes: this.geometryTypes}; 
    133         this.featureHandler = new OpenLayers.Handler.Feature(this, this.layer, 
    134                                                         this.featureCallbacks, 
    135                                                         handlerOptions); 
     110        this.handlers = { 
     111            drag: new OpenLayers.Handler.Drag( 
     112                this, OpenLayers.Util.extend({ 
     113                    down: this.downFeature, 
     114                    move: this.moveFeature, 
     115                    up: this.upFeature, 
     116                    out: this.cancel, 
     117                    done: this.doneDragging 
     118                }, this.dragCallbacks) 
     119            ), 
     120            feature: new OpenLayers.Handler.Feature( 
     121                this, this.layer, OpenLayers.Util.extend({ 
     122                    over: this.overFeature, 
     123                    out: this.outFeature 
     124                }, this.featureCallbacks), 
     125                {geometryTypes: this.geometryTypes} 
     126            ) 
     127        }; 
    136128    }, 
    137129     
     
    142134    destroy: function() { 
    143135        this.layer = null; 
    144         this.dragHandler.destroy(); 
    145         this.featureHandler.destroy(); 
    146136        OpenLayers.Control.prototype.destroy.apply(this, []); 
    147137    }, 
     
    155145     */ 
    156146    activate: function() { 
    157         return (this.featureHandler.activate() && 
     147        return (this.handlers.feature.activate() && 
    158148                OpenLayers.Control.prototype.activate.apply(this, arguments)); 
    159149    }, 
     
    168158    deactivate: function() { 
    169159        // the return from the handlers is unimportant in this case 
    170         this.dragHandler.deactivate(); 
    171         this.featureHandler.deactivate(); 
     160        this.handlers.drag.deactivate(); 
     161        this.handlers.feature.deactivate(); 
    172162        this.feature = null; 
    173163        this.dragging = false; 
     
    185175     */ 
    186176    overFeature: function(feature) { 
    187         if(!this.dragHandler.dragging) { 
     177        if(!this.handlers.drag.dragging) { 
    188178            this.feature = feature; 
    189             this.dragHandler.activate(); 
     179            this.handlers.drag.activate(); 
    190180            this.over = true; 
    191181            // TBD replace with CSS classes 
     
    239229    upFeature: function(pixel) { 
    240230        if(!this.over) { 
    241             this.dragHandler.deactivate(); 
     231            this.handlers.drag.deactivate(); 
    242232            this.feature = null; 
    243233            // TBD replace with CSS classes 
     
    266256     */ 
    267257    outFeature: function(feature) { 
    268         if(!this.dragHandler.dragging) { 
     258        if(!this.handlers.drag.dragging) { 
    269259            this.over = false; 
    270             this.dragHandler.deactivate(); 
     260            this.handlers.drag.deactivate(); 
    271261            // TBD replace with CSS classes 
    272262            this.map.div.style.cursor = "default"; 
     
    284274     */ 
    285275    cancel: function() { 
    286         this.dragHandler.deactivate(); 
     276        this.handlers.drag.deactivate(); 
    287277        this.over = false; 
    288278    }, 
     
    296286     */ 
    297287    setMap: function(map) { 
    298         this.dragHandler.setMap(map); 
    299         this.featureHandler.setMap(map); 
     288        this.handlers.drag.setMap(map); 
     289        this.handlers.feature.setMap(map); 
    300290        OpenLayers.Control.prototype.setMap.apply(this, arguments); 
    301291    }, 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Control/ModifyFeature.js

    r5974 r6122  
    8484     
    8585    /** 
    86      * Property: keyboardHandler 
    87      * {<OpenLayers.Handler.Keyboard>
    88      */ 
    89     keyboardHandler: null, 
     86     * Property: handlers 
     87     * {Object
     88     */ 
     89    handlers: null, 
    9090     
    9191    /** 
     
    217217            keypress: this.handleKeypress 
    218218        }; 
    219         this.keyboardHandler = new OpenLayers.Handler.Keyboard( 
    220             this, keyboardOptions 
    221         )
     219        this.handlers = { 
     220            keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions) 
     221        }
    222222    }, 
    223223 
     
    230230        this.selectControl.destroy(); 
    231231        this.dragControl.destroy(); 
    232         this.keyboardHandler.destroy(); 
    233232        OpenLayers.Control.prototype.destroy.apply(this, []); 
    234233    }, 
     
    243242    activate: function() { 
    244243        return (this.selectControl.activate() && 
    245                 this.keyboardHandler.activate() && 
     244                this.handlers.keyboard.activate() && 
    246245                OpenLayers.Control.prototype.activate.apply(this, arguments)); 
    247246    }, 
     
    267266            } 
    268267            this.selectControl.deactivate(); 
    269             this.keyboardHandler.deactivate(); 
     268            this.handlers.keyboard.deactivate(); 
    270269            deactivated = true; 
    271270        } 
     
    353352                                                   [feature]); 
    354353                this.dragControl.lastPixel = pixel; 
    355                 this.dragControl.dragHandler.started = true; 
    356                 this.dragControl.dragHandler.start = pixel; 
    357                 this.dragControl.dragHandler.last = pixel; 
     354                this.dragControl.handlers.drag.started = true; 
     355                this.dragControl.handlers.drag.start = pixel; 
     356                this.dragControl.handlers.drag.last = pixel; 
    358357            } 
    359358        } 
     
    487486            if(vertex && 
    488487               OpenLayers.Util.indexOf(this.vertices, vertex) != -1 && 
    489                !this.dragControl.dragHandler.dragging && 
     488               !this.dragControl.handlers.drag.dragging && 
    490489               vertex.geometry.parent) { 
    491490                // remove the vertex 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Control/Navigation.js

    r5990 r6122  
    3737    zoomBox: null, 
    3838 
    39     /**  
    40      * Property: wheelHandler 
    41      * {<OpenLayers.Handler.MouseWheel>} 
    42      */ 
    43     wheelHandler: null, 
    44  
    4539    /** 
    4640     * Constructor: OpenLayers.Control.Navigation 
     
    5246     */ 
    5347    initialize: function(options) { 
     48        this.handlers = {}; 
    5449        OpenLayers.Control.prototype.initialize.apply(this, arguments); 
    5550    }, 
     
    6257     */ 
    6358    destroy: function() { 
    64         OpenLayers.Control.prototype.destroy.apply(this,arguments); 
    65  
    6659        this.deactivate(); 
    6760 
     
    7164        this.dragPan = null; 
    7265 
    73         if (this.wheelHandler) { 
    74             this.wheelHandler.destroy(); 
    75         } 
    76         this.wheelHandler = null; 
    77  
    78         if (this.clickHandler) { 
    79             this.clickHandler.destroy(); 
    80         } 
    81         this.clickHandler = null; 
    82          
    8366        if (this.zoomBox) { 
    8467            this.zoomBox.destroy(); 
    8568        } 
    8669        this.zoomBox = null; 
     70        OpenLayers.Control.prototype.destroy.apply(this,arguments); 
    8771    }, 
    8872     
     
    9276    activate: function() { 
    9377        this.dragPan.activate(); 
    94         this.wheelHandler.activate(); 
    95         this.clickHandler.activate(); 
     78        this.handlers.wheel.activate(); 
     79        this.handlers.click.activate(); 
    9680        this.zoomBox.activate(); 
    9781        return OpenLayers.Control.prototype.activate.apply(this,arguments); 
     
    10488        this.zoomBox.deactivate(); 
    10589        this.dragPan.deactivate(); 
    106         this.clickHandler.deactivate(); 
    107         this.wheelHandler.deactivate(); 
     90        this.handlers.click.deactivate(); 
     91        this.handlers.wheel.deactivate(); 
    10892        return OpenLayers.Control.prototype.deactivate.apply(this,arguments); 
    10993    }, 
     
    11397     */ 
    11498    draw: function() { 
    115         this.clickHandler = new OpenLayers.Handler.Click(this,  
     99        this.handlers.click = new OpenLayers.Handler.Click(this,  
    116100                                        { 'dblclick': this.defaultDblClick }, 
    117101                                        { 
     
    124108        this.dragPan.draw(); 
    125109        this.zoomBox.draw(); 
    126         this.wheelHandler = new OpenLayers.Handler.MouseWheel( 
     110        this.handlers.wheel = new OpenLayers.Handler.MouseWheel( 
    127111                                    this, {"up"  : this.wheelUp, 
    128112                                           "down": this.wheelDown} ); 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Control/OverviewMap.js

    r6010 r6122  
    9999     
    100100    /** 
    101      * Property: dragHandler 
    102      * {<OpenLayers.Handler.Drag>} A handler for dragging the extent rectangle. 
    103      */ 
    104     dragHandler: null, 
     101     * Property: handlers 
     102     * {Object} 
     103     */ 
     104    handlers: null, 
    105105 
    106106    /** 
     
    115115    initialize: function(options) { 
    116116        this.layers = []; 
     117        this.handlers = {}; 
    117118        OpenLayers.Control.prototype.initialize.apply(this, [options]); 
    118119    }, 
     
    126127            return; 
    127128        } 
    128         this.dragHandler.destroy(); 
    129         this.clickHandler.destroy(); 
     129        this.handlers.click.destroy(); 
    130130 
    131131        this.mapDiv.removeChild(this.extentRectangle); 
     
    281281     */ 
    282282    rectDrag: function(px) { 
    283         var deltaX = this.dragHandler.last.x - px.x; 
    284         var deltaY = this.dragHandler.last.y - px.y; 
     283        var deltaX = this.handlers.drag.last.x - px.x; 
     284        var deltaY = this.handlers.drag.last.y - px.y; 
    285285        if(deltaX != 0 || deltaY != 0) { 
    286286            var rectTop = this.rectPxBounds.top; 
     
    435435        // create the overview map 
    436436        var options = OpenLayers.Util.extend( 
    437                         {controls: [], maxResolution: 'auto'}, this.mapOptions); 
     437                        {controls: [], maxResolution: 'auto',  
     438                         fallThrough: false}, this.mapOptions); 
    438439        this.ovmap = new OpenLayers.Map(this.mapDiv, options); 
    439440         
     
    456457        this.hComp = (this.hComp) ? this.hComp : 2; 
    457458 
    458         this.dragHandler = new OpenLayers.Handler.Drag( 
     459        this.handlers.drag = new OpenLayers.Handler.Drag( 
    459460            this, {move: this.rectDrag, done: this.updateMapToRect}, 
    460461            {map: this.ovmap} 
    461462        ); 
    462         this.clickHandler = new OpenLayers.Handler.Click( 
     463        this.handlers.click = new OpenLayers.Handler.Click( 
    463464            this, { 
    464465                "click": this.mapDivClick 
     
    470471            } 
    471472        ); 
    472         this.clickHandler.activate(); 
     473        this.handlers.click.activate(); 
    473474         
    474475        this.rectEvents = new OpenLayers.Events(this, this.extentRectangle, 
    475476                                                null, true); 
    476477        this.rectEvents.register("mouseover", this, function(e) { 
    477             if(!this.dragHandler.active && !this.map.dragging) { 
    478                 this.dragHandler.activate(); 
     478            if(!this.handlers.drag.active && !this.map.dragging) { 
     479                this.handlers.drag.activate(); 
    479480            } 
    480481        }); 
    481482        this.rectEvents.register("mouseout", this, function(e) { 
    482             if(!this.dragHandler.dragging) { 
    483                 this.dragHandler.deactivate(); 
     483            if(!this.handlers.drag.dragging) { 
     484                this.handlers.drag.deactivate(); 
    484485            } 
    485486        }); 
     
    511512    updateMapToRect: function() { 
    512513        var lonLatBounds = this.getMapBoundsFromRectBounds(this.rectPxBounds); 
    513         this.map.setCenter(lonLatBounds.getCenterLonLat(), this.map.zoom); 
     514        this.map.panTo(lonLatBounds.getCenterLonLat()); 
    514515    }, 
    515516 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Format/WFS.js

    r5868 r6122  
    2222     */ 
    2323    wfsns: "http://www.opengis.net/wfs", 
     24     
     25    ogcns: "http://www.opengis.net/ogc", 
    2426     
    2527    /* 
     
    5860     */ 
    5961    write: function(features) { 
    60          
    61         var transaction = this.createElementNS('http://www.opengis.net/wfs', 'wfs:Transaction'); 
     62     
     63        var transaction = this.createElementNS(this.wfsns, 'wfs:Transaction'); 
    6264        transaction.setAttribute("version","1.0.0"); 
    6365        transaction.setAttribute("service","WFS"); 
     
    7577            } 
    7678        } 
    77         return transaction; 
     79         
     80        return OpenLayers.Format.XML.prototype.write.apply(this,[transaction]); 
    7881    }, 
    7982    
     
    9194        featureContainer.appendChild(geomContainer); 
    9295        for(var attr in feature.attributes) { 
    93             var attrText = document.createTextNode(feature.attributes[attr]);  
     96            var attrText = this.createTextNode(feature.attributes[attr]);  
    9497            var nodename = attr; 
    9598            if (attr.search(":") != -1) { 
     
    129132 
    130133        var propertyNode = this.createElementNS(this.wfsns, 'wfs:Property'); 
    131         var nameNode = this.createElementNS('http://www.opengis.net/wfs', 'wfs:Name'); 
     134        var nameNode = this.createElementNS(this.wfsns, 'wfs:Name'); 
    132135         
    133         var txtNode = document.createTextNode(this.geometryName); 
     136        var txtNode = this.createTextNode(this.geometryName); 
    134137        nameNode.appendChild(txtNode); 
    135138        propertyNode.appendChild(nameNode); 
    136139         
    137         var valueNode = this.createElementNS('http://www.opengis.net/wfs', 'wfs:Value'); 
     140        var valueNode = this.createElementNS(this.wfsns, 'wfs:Value'); 
    138141        valueNode.appendChild(this.buildGeometryNode(feature.geometry)); 
    139142         
     
    141144        updateNode.appendChild(propertyNode); 
    142145         
    143         var filterNode = this.createElementNS('http://www.opengis.net/ogc', 'ogc:Filter'); 
    144         var filterIdNode = this.createElementNS('http://www.opengis.net/ogc', 'ogc:FeatureId'); 
     146        var filterNode = this.createElementNS(this.ogcns, 'ogc:Filter'); 
     147        var filterIdNode = this.createElementNS(this.ogcns, 'ogc:FeatureId'); 
    145148        filterIdNode.setAttribute("fid", feature.fid); 
    146149        filterNode.appendChild(filterIdNode); 
     
    165168        deleteNode.setAttribute("typeName", this.layerName); 
    166169 
    167         var filterNode = this.createElementNS('http://www.opengis.net/ogc', 'ogc:Filter'); 
    168         var filterIdNode = this.createElementNS('http://www.opengis.net/ogc', 'ogc:FeatureId'); 
     170        var filterNode = this.createElementNS(this.ogcns, 'ogc:Filter'); 
     171        var filterIdNode = this.createElementNS(this.ogcns, 'ogc:FeatureId'); 
    169172        filterIdNode.setAttribute("fid", feature.fid); 
    170173        filterNode.appendChild(filterIdNode); 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Format/WMC/v1_1_0.js

    r5919 r6122  
    9090         
    9191        // min/max scale denominator elements go before the 4th element in v1 
    92         var minSD = this.createElementNS( 
    93             this.namespaces.sld, "sld:MinScaleDenominator" 
    94         ); 
    95         minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10))); 
    96         node.insertBefore(minSD, node.childNodes[3]); 
     92        if(layer.options.resolutions || layer.options.scales || 
     93           layer.options.minResolution || layer.options.maxScale) { 
     94            var minSD = this.createElementNS( 
     95                this.namespaces.sld, "sld:MinScaleDenominator" 
     96            ); 
     97            minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10))); 
     98            node.insertBefore(minSD, node.childNodes[3]); 
     99        } 
    97100         
    98         var maxSD = this.createElementNS( 
    99             this.namespaces.sld, "sld:MaxScaleDenominator" 
    100         ); 
    101         maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10))); 
    102         node.insertBefore(maxSD, node.childNodes[4]); 
     101        if(layer.options.resolutions || layer.options.scales || 
     102           layer.options.maxResolution || layer.options.minScale) { 
     103            var maxSD = this.createElementNS( 
     104                this.namespaces.sld, "sld:MaxScaleDenominator" 
     105            ); 
     106            maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10))); 
     107            node.insertBefore(maxSD, node.childNodes[4]); 
     108        } 
    103109         
    104110        return node; 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Handler/Click.js

    r5698 r6122  
    4646     * APIProperty: pixelTolerance 
    4747     * {Number} Maximum number of pixels between mouseup and mousedown for an 
    48      *     event to be considered a click.  Default is null.  If set to an 
     48     *     event to be considered a click.  Default is 0.  If set to an 
    4949     *     integer value, clicks with a drag greater than the value will be 
    5050     *     ignored.  This property can only be set when the handler is 
    5151     *     constructed. 
    5252     */ 
    53     pixelTolerance: null
     53    pixelTolerance: 0
    5454     
    5555    /** 
     
    183183    passesTolerance: function(evt) { 
    184184        var passes = true; 
    185         if(this.pixelTolerance && this.down) { 
     185        if(this.pixelTolerance != null && this.down) { 
    186186            var dpx = Math.sqrt( 
    187187                Math.pow(this.down.x - evt.xy.x, 2) + 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Map.js

    r5982 r6122  
    374374            //  Note that this is ok, as updateSize() does nothing if the  
    375375            //  map's size has not actually changed. 
     376            this.updateSizeDestroy = OpenLayers.Function.bind(this.updateSize,  
     377                this); 
    376378            OpenLayers.Event.observe(window, 'resize', 
    377                             OpenLayers.Function.bind(this.updateSize, this)); 
     379                            this.updateSizeDestroy); 
    378380        } 
    379381         
     
    435437     */ 
    436438    unloadDestroy: null, 
     439     
     440    /** 
     441     * Method: updateSizeDestroy 
     442     * When the map is destroyed, we need to stop listening to updateSize 
     443     *    events: this method stores the function we need to unregister in  
     444     *    non-IE browsers. 
     445     */ 
     446    updateSizeDestroy: null, 
    437447 
    438448    /** 
     
    449459        OpenLayers.Event.stopObserving(window, 'unload', this.unloadDestroy); 
    450460        this.unloadDestroy = null; 
     461 
     462        if (this.updateSizeDestroy) { 
     463            OpenLayers.Event.stopObserving(window, 'resize',  
     464                                           this.updateSizeDestroy); 
     465        } else { 
     466            this.events.unregister("resize", this, this.updateSize); 
     467        }     
    451468 
    452469        if (this.layers != null) { 
     
    12301247     * dx - {Integer} 
    12311248     * dy - {Integer} 
    1232      */ 
    1233     pan: function(dx, dy) { 
    1234  
     1249     * options - {Object} Only one at this time: "animate", which uses 
     1250     *    panTo instead of setCenter. Default is true. 
     1251     */ 
     1252    pan: function(dx, dy, options) { 
     1253         
     1254        if (!options) { 
     1255            options = {} 
     1256        }     
    12351257        // getCenter 
    12361258        var centerPx = this.getViewPortPxFromLonLat(this.getCenter()); 
     
    12421264        if (!newCenterPx.equals(centerPx)) { 
    12431265            var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx); 
    1244             this.setCenter(newCenterLonLat); 
     1266            if (options.animate) { 
     1267                this.panTo(newCenterLonLat); 
     1268            } else { 
     1269                this.setCenter(newCenterLonLat); 
     1270            }     
    12451271        } 
    12461272 
    12471273   }, 
     1274    
     1275   /**  
     1276     * APIMethod: panTo 
     1277     * Allows user to pan to a new lonlat 
     1278     * If the new lonlat is in the current extent the map will slide smoothly 
     1279     *  
     1280     * Parameters: 
     1281     * lonlat - {<OpenLayers.Lonlat>} 
     1282     */ 
     1283    panTo: function(lonlat) { 
     1284        if (this.getExtent().containsLonLat(lonlat)) { 
     1285            if (!this.panTween) { 
     1286                this.panTween = new OpenLayers.Tween(OpenLayers.Easing.Expo.easeOut); 
     1287            } 
     1288            var center = this.getCenter(); 
     1289            var from = { 
     1290                lon: center.lon, 
     1291                lat: center.lat 
     1292            }; 
     1293            var to = { 
     1294                lon: lonlat.lon, 
     1295                lat: lonlat.lat 
     1296            }; 
     1297            this.panTween.start(from, to, 50, { 
     1298                callbacks: { 
     1299                    start: OpenLayers.Function.bind(function(lonlat) { 
     1300                        this.events.triggerEvent("movestart"); 
     1301                    }, this), 
     1302                    eachStep: OpenLayers.Function.bind(function(lonlat) { 
     1303                        var lonlat = new OpenLayers.LonLat(lonlat.lon, lonlat.lat); 
     1304                        this.moveTo(lonlat, this.zoom, true); 
     1305                    }, this), 
     1306                    done: OpenLayers.Function.bind(function(lonlat) { 
     1307                        this.events.triggerEvent("moveend"); 
     1308                    }, this) 
     1309                } 
     1310            }); 
     1311        } else { 
     1312            this.setCenter(lonlat); 
     1313        } 
     1314    }, 
    12481315 
    12491316    /** 
     
    12601327     * TBD: reconsider forceZoomChange in 3.0 
    12611328     */ 
    1262     setCenter: function (lonlat, zoom, dragging, forceZoomChange) { 
    1263         this.dragging = !!dragging; 
    1264          
     1329    setCenter: function(lonlat, zoom, dragging, forceZoomChange) { 
     1330        this.moveTo(lonlat, zoom, { 
     1331            'dragging': dragging, 
     1332            'forceZoomChange': forceZoomChange, 
     1333            'caller': 'setCenter' 
     1334        }); 
     1335    }, 
     1336 
     1337    /** 
     1338     * Method: moveTo 
     1339     * 
     1340     * Parameters: 
     1341     * lonlat - {<OpenLayers.LonLat>} 
     1342     * zoom - {Integer} 
     1343     * options - {Object} 
     1344     */ 
     1345    moveTo: function(lonlat, zoom, options) { 
     1346        if (!options) {  
     1347            options = {}; 
     1348        }     
     1349        // dragging is false by default 
     1350        var dragging = options.dragging; 
     1351        // forceZoomChange is false by default 
     1352        var forceZoomChange = options.forceZoomChange; 
     1353        // noEvent is false by default 
     1354        var noEvent = options.noEvent; 
     1355 
     1356        if (this.panTween && options.caller == "setCenter") { 
     1357            this.panTween.stop(); 
     1358        }     
     1359              
    12651360        if (!this.center && !this.isValidLonLat(lonlat)) { 
    12661361            lonlat = this.maxExtent.getCenterLonLat(); 
     
    13121407        if (zoomChanged || centerChanged || !dragging) { 
    13131408 
    1314             if (!dragging) { this.events.triggerEvent("movestart"); } 
     1409            if (!dragging && !noEvent) { 
     1410                this.events.triggerEvent("movestart"); 
     1411            } 
    13151412 
    13161413            if (centerChanged) { 
     
    13781475 
    13791476        // even if nothing was done, we want to notify of this 
    1380         if (!dragging) { this.events.triggerEvent("moveend"); } 
     1477        if (!dragging && !noEvent) { 
     1478            this.events.triggerEvent("moveend"); 
     1479        } 
    13811480    }, 
    13821481 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Popup.js

    r5614 r6122  
    9292 
    9393    /**  
     94     * Property: closeDiv 
     95     * {DOMElement} the optional closer image 
     96     */ 
     97    closeDiv: null, 
     98 
     99    /**  
    94100     * Property: padding  
    95101     * {int} the internal padding of the content div. 
     
    158164            var closeSize = new OpenLayers.Size(17,17); 
    159165            var img = OpenLayers.Util.getImagesLocation() + "close.gif"; 
    160             var closeImg = OpenLayers.Util.createAlphaImageDiv(this.id + "_close",  
    161                                                                 null,  
    162                                                                 closeSize,  
    163                                                                 img); 
    164             closeImg.style.right = this.padding + "px"; 
    165             closeImg.style.top = this.padding + "px"; 
    166             this.groupDiv.appendChild(closeImg); 
     166            this.closeDiv = OpenLayers.Util.createAlphaImageDiv( 
     167                this.id + "_close", null, closeSize, img 
     168            ); 
     169            this.closeDiv.style.right = this.padding + "px"; 
     170            this.closeDiv.style.top = this.padding + "px"; 
     171            this.groupDiv.appendChild(this.closeDiv); 
    167172 
    168173            var closePopup = closeBoxCallback || function(e) { 
     
    170175                OpenLayers.Event.stop(e); 
    171176            }; 
    172             OpenLayers.Event.observe(closeImg, "click",  
     177            OpenLayers.Event.observe(this.closeDiv, "click",  
    173178                    OpenLayers.Function.bindAsEventListener(closePopup, this)); 
    174179 
  • sandbox/ahocevar/styleMap/openlayers/lib/OpenLayers/Renderer/VML.js

    r5944 r6122  
    217217                if (!(style.graphicWidth && style.graphicHeight)) { 
    218218                  fill.aspect = "atmost"; 
    219                 } 
    220                  
    221               &