OpenLayers OpenLayers

Changeset 5798

Show
Ignore:
Timestamp:
01/17/08 11:46:25 (1 year ago)
Author:
enjahova
Message:

merged trunk from 5718 to 5797

Files:

Legend:

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

    r5518 r5798  
    1111Pierre Giraud 
    1212Andreas Hocevar 
     13Ian Johnson 
    1314Eric Lemoine 
    1415Philip Lindsay 
  • sandbox/enjahova/openlayers/examples/vector-features.html

    r5362 r5798  
    3838            var style_green = { 
    3939                strokeColor: "#00FF00", 
    40                 strokeOpacity: 1, 
    4140                strokeWidth: 3, 
    4241                pointRadius: 6, 
  • sandbox/enjahova/openlayers/lib/OpenLayers.js

    r5797 r5798  
    118118            "OpenLayers/Handler.js", 
    119119            "OpenLayers/Handler/Click.js", 
     120            "OpenLayers/Handler/Hover.js", 
    120121            "OpenLayers/Handler/Point.js", 
    121122            "OpenLayers/Handler/Path.js", 
     
    168169            "OpenLayers/Renderer/VML.js", 
    169170            "OpenLayers/Layer/Vector.js", 
     171            "OpenLayers/Layer/PointTrack.js", 
    170172            "OpenLayers/Layer/GML.js", 
    171173            "OpenLayers/Style.js", 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Control/ZoomBox.js

    r5719 r5798  
    2222 
    2323    /** 
     24     * Property: out 
     25     * {Boolean} Should the control be used for zooming out? 
     26     */ 
     27    out: false, 
     28 
     29    /** 
    2430     * Method: draw 
    2531     */     
     
    3743    zoomBox: function (position) { 
    3844        if (position instanceof OpenLayers.Bounds) { 
    39             var minXY = this.map.getLonLatFromPixel( 
     45            if (!this.out) { 
     46                var minXY = this.map.getLonLatFromPixel( 
    4047                            new OpenLayers.Pixel(position.left, position.bottom)); 
    41             var maxXY = this.map.getLonLatFromPixel( 
     48                var maxXY = this.map.getLonLatFromPixel( 
    4249                            new OpenLayers.Pixel(position.right, position.top)); 
    43             var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, 
     50                var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, 
    4451                                               maxXY.lon, maxXY.lat); 
     52            } else { 
     53                var pixWidth = Math.abs(position.right-position.left); 
     54                var pixHeight = Math.abs(position.top-position.bottom); 
     55                var zoomFactor = Math.min((this.map.size.h / pixHeight), 
     56                    (this.map.size.w / pixWidth)); 
     57                var extent = map.getExtent(); 
     58                var center = this.map.getLonLatFromPixel( 
     59                    position.getCenterPixel()); 
     60                var xmin = center.lon - (extent.getWidth()/2)*zoomFactor; 
     61                var xmax = center.lon + (extent.getWidth()/2)*zoomFactor; 
     62                var ymin = center.lat - (extent.getHeight()/2)*zoomFactor; 
     63                var ymax = center.lat + (extent.getHeight()/2)*zoomFactor; 
     64                var bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax); 
     65            } 
    4566            this.map.zoomToExtent(bounds); 
    4667        } else { // it's a pixel 
    47             this.map.setCenter(this.map.getLonLatFromPixel(position), 
     68            if (!this.out) { 
     69                this.map.setCenter(this.map.getLonLatFromPixel(position), 
    4870                               this.map.getZoom() + 1); 
     71            } else { 
     72                this.map.setCenter(this.map.getLonLatFromPixel(position), 
     73                               this.map.getZoom() - 1); 
     74            } 
    4975        } 
    5076    }, 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Layer.js

    r5719 r5798  
    625625        } 
    626626 
     627        // Do not use the scales/resolutions at the map level if 
     628        // minScale/minResolution and maxScale/maxResolution are 
     629        // specified at the layer level 
     630        if (this.options.minScale != null && 
     631            this.options.maxScale != null && 
     632            this.options.scales == null) { 
     633            confProps.scales = null; 
     634        } 
     635        if (this.options.minResolution != null && 
     636            this.options.maxResolution != null && 
     637            this.options.resolutions == null) { 
     638            confProps.resolutions = null; 
     639        } 
     640 
    627641        // If numZoomLevels hasn't been set and the maxZoomLevel *has*,  
    628642        //  then use maxZoomLevel to calculate numZoomLevels 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Layer/GML.js

    r5723 r5798  
    113113        this.loadGML(); 
    114114    }, 
    115  
    116115     
    117116    /** 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Layer/SphericalMercator.js

    r5719 r5798  
    129129     
    130130    /** 
    131      * Method: projectForward  
     131     * Method: projectInverse 
    132132     * Given an object with x and y properties in Spherical Mercator, modify 
    133133     * the x,y properties on the object to be the unprojected coordinates. 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Layer/TileCache.js

    r5719 r5798  
    104104        var bbox = this.maxExtent; 
    105105        var size = this.tileSize; 
    106         var tileX = Math.floor((bounds.left - bbox.left) / (res * size.w)); 
    107         var tileY = Math.floor((bounds.bottom - bbox.bottom) / (res * size.h)); 
     106        var tileX = Math.round((bounds.left - bbox.left) / (res * size.w)); 
     107        var tileY = Math.round((bounds.bottom - bbox.bottom) / (res * size.h)); 
    108108        var tileZ = this.map.zoom; 
    109109        /** 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Renderer/Elements.js

    r5719 r5798  
    135135            //now actually draw the node, and style it 
    136136            node = this.drawGeometryNode(node, geometry); 
    137             this.root.appendChild(node); 
     137             
     138            // append the node to root (but only if it's new) 
     139            if (node.parentNode != this.root) {  
     140                this.root.appendChild(node);  
     141            } 
    138142            this.postDraw(node); 
    139143        } else { 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Renderer/VML.js

    r5719 r5798  
    241241                node.appendChild(stroke); 
    242242            } 
    243             stroke.setAttribute("opacity", style.strokeOpacity); 
     243            if (style.strokeOpacity) { 
     244                stroke.setAttribute("opacity", style.strokeOpacity); 
     245            } 
    244246            stroke.setAttribute("endcap", !style.strokeLinecap || style.strokeLinecap == 'butt' ? 'flat' : style.strokeLinecap); 
    245247        } 
  • sandbox/enjahova/openlayers/lib/OpenLayers/Tile/WFS.js

    r5719 r5798  
    6868        if(this.request) { 
    6969            this.request.transport.abort(); 
     70            //this.request.destroy(); 
     71            this.request = null; 
    7072        } 
    7173    }, 
     
    109111    */ 
    110112    loadFeaturesForRegion:function(success, failure) { 
     113        if(this.request) { 
     114            this.request.transport.abort(); 
     115            //this.request.destroy(); 
     116        } 
    111117        this.request = OpenLayers.loadURL(this.url, null, this, success); 
    112118    }, 
     
    142148            this.events.triggerEvent("loadend");  
    143149        } 
     150 
     151        //request produced with success, we can delete the request object. 
     152        //this.request.destroy(); 
     153        this.request = null; 
    144154    }, 
    145155 
  • sandbox/enjahova/openlayers/tests/Tile/test_WFS.html

    r5719 r5798  
    2828 
    2929    function test_Tile_WFS_requestSuccess(t) { 
    30         t.plan(1); 
     30        t.plan(2); 
     31 
     32        var tile = { 
     33            'request': {} 
     34        }; 
     35             
     36        OpenLayers.Tile.WFS.prototype.requestSuccess.apply(tile, []); 
     37         
     38        t.ok(tile.request == null, "request property on tile set to null"); 
     39 
    3140        var layer = {}; // bogus layer 
    3241        var position = new OpenLayers.Pixel(10,20); 
     
    4251    } 
    4352     
     53    function test_Tile_WFS_loadFeaturesForRegion(t) { 
     54        t.plan(9); 
     55         
     56        var tile = { 
     57            'url': {} 
     58        }; 
     59 
     60        var g_Success = {};      
     61 
     62        var tLoadURL = OpenLayers.loadURL; 
     63        OpenLayers.loadURL = function(url, params, caller, onComplete) { 
     64            t.ok(url == tile.url, "tile's url correctly passed as 1st param to loadURL"); 
     65            t.ok(params == null, "null passed as 2nd param to loadURL"); 
     66            t.ok(caller == tile, "tile passed as 3rd param to loadURL"); 
     67            t.ok(onComplete == g_Success, "success param from loadFeaturesForRegion() passed as 4th param to loadURL"); 
     68        }; 
     69         
     70      //no running request -- 4 tests 
     71        OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); 
     72 
     73      //running request (cancelled) -- 4 tests + 1 test (for request abort) 
     74        tile.request = { 
     75            'transport': { 
     76                'abort': function() { 
     77                    t.ok(true, "request aborted"); 
     78                } 
     79            } 
     80        }; 
     81        OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); 
     82                 
     83        OpenLayers.loadURL = tLoadURL; 
     84    } 
     85     
    4486    function test_Tile_WFS_destroy(t) { 
    45         t.plan(8); 
     87        t.plan(9); 
    4688 
    4789        var layer = {}; // bogus layer 
     
    74116        t.ok(tile.position == null, "tile.position set to null"); 
    75117        t.ok(_gAbort, "request transport is aborted"); 
     118        t.ok(tile.request == null, "tile.request set to null"); 
    76119         
    77120        t.ok(tile.events == null, "tile.events set to null"); 
  • sandbox/enjahova/openlayers/tests/list-tests.html

    r5797 r5798  
    5858    <li>Layer/test_Markers.html</li> 
    5959    <li>Layer/test_MultiMap.html</li> 
     60    <li>Layer/test_PointTrack.html</li> 
    6061    <li>Layer/test_SphericalMercator.html</li> 
    6162    <li>Layer/test_Text.html</li> 
     
    9293    <li>test_Handler.html</li> 
    9394    <li>Handler/test_Click.html</li> 
     95    <li>Handler/test_Hover.html</li> 
    9496    <li>Handler/test_Drag.html</li> 
    9597    <li>Handler/test_Feature.html</li>