add "refresh" event to Layer.Vector, r=tschaub (closes #1695)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7959 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-09-05 07:05:11 +00:00
parent 6d74b489bb
commit e6d51fcf49
2 changed files with 54 additions and 1 deletions

View File

@@ -69,11 +69,14 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
* - *afterfeaturemodified* Triggered when a feature is finished being modified.
* Listeners will receive an object with a *feature* property referencing
* the modified feature.
* - *refresh* Triggered when something wants a strategy to ask the protocol
* for a new set of features.
*/
EVENT_TYPES: ["beforefeatureadded", "featureadded", "featuresadded",
"beforefeatureremoved", "featureremoved", "featuresremoved",
"beforefeatureselected", "featureselected", "featureunselected",
"beforefeaturemodified", "featuremodified", "afterfeaturemodified"],
"beforefeaturemodified", "featuremodified", "afterfeaturemodified",
"refresh"],
/**
* APIProperty: isBaseLayer
@@ -265,6 +268,21 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
/**
* Method: refresh
* Ask the layer to request features again and redraw them. Triggers
* the refresh event if the layer is in range and visible.
*
* Parameters:
* obj - {Object} Optional object with properties for any listener of
* the refresh event.
*/
refresh: function(obj) {
if(this.inRange && this.visibility) {
this.events.triggerEvent("refresh", obj);
}
},
/**
* Method: assignRenderer
* Iterates through the available renderer implementations and selects