OpenLayers OpenLayers

Changeset 7412

Show
Ignore:
Timestamp:
06/21/08 01:05:30 (5 months ago)
Author:
tschaub
Message:

Giving the vector layer a refresh method. This triggers the refresh event, which strategies may be listening for. The BBOX strategy listens for refresh and respects force.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/topp/almanac/lib/OpenLayers/Layer/Vector.js

    r7400 r7412  
    7878     *      Listeners will receive an object with a *feature* property referencing  
    7979     *      the modified feature. 
     80     *  - *refresh* Triggered when something wants a strategy to ask the protocol 
     81     *      for a new set of features. 
    8082     */ 
    8183    EVENT_TYPES: ["beforefeatureadded", "beforefeaturesadded", 
     
    8385                  "beforefeatureremoved", "featureremoved", "featuresremoved", 
    8486                  "featureserased", "featureselected", "featureunselected",  
    85                   "beforefeaturemodified", "featuremodified", "afterfeaturemodified"], 
     87                  "beforefeaturemodified", "featuremodified", "afterfeaturemodified", 
     88                  "refresh"], 
    8689 
    8790    /** 
     
    251254        } 
    252255        OpenLayers.Layer.prototype.destroy.apply(this, arguments);   
     256    }, 
     257     
     258    /** 
     259     * Method: refresh 
     260     * Ask the layer to request features again and redraw them. 
     261     * 
     262     * Parameters: 
     263     * event - {Object} Optional object with properties for any listener of 
     264     *     the refresh event. 
     265     */ 
     266    refresh: function(event) { 
     267        this.events.triggerEvent("refresh", event); 
    253268    }, 
    254269 
  • sandbox/topp/almanac/lib/OpenLayers/Strategy/BBOX.js

    r7405 r7412  
    4646    activate: function() { 
    4747        this.layer.map.events.on({ 
    48             "moveend": this.moveendListener, 
    49             "readrequested": this.triggerRead, 
     48            "moveend": this.updateListener, 
     49            scope: this 
     50        }); 
     51        this.layer.events.on({ 
     52            "refresh": this.updateListener, 
    5053            scope: this 
    5154        }); 
     
    5760     */ 
    5861    deactivate: function() { 
    59         this.layer.map.events.off({ 
    60             "moveend": this.moveendListener, 
    61             "readrequested": this.triggerRead, 
     62        this.layer.map.events.un({ 
     63            "moveend": this.updateListener, 
     64            scope: this 
     65        }); 
     66        this.layer.events.un({ 
     67            "refresh": this.updateListener, 
    6268            scope: this 
    6369        }); 
     
    6571     
    6672    /** 
    67      * Method: moveendListener 
     73     * Method: updateListener 
    6874     */ 
    69     moveendListener: function(evt) { 
     75    updateListener: function(event) { 
    7076        var mapBounds = this.layer.map.getExtent(); 
    71         if(this.invalidBounds(mapBounds)) { 
     77        if(event.force || this.invalidBounds(mapBounds)) { 
    7278            this.calculateBounds(mapBounds); 
    7379            this.triggerRead();