With review from elem and additional tests, add filter by geometry type

to select feature control, with tests. (Closes #951)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4243 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-09-12 15:05:18 +00:00
parent e1fa24df5c
commit 024779d898
3 changed files with 69 additions and 16 deletions

View File

@@ -42,6 +42,13 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
*/
onUnselect: function() {},
/**
* APIProperty: geometryTypes
* {Array(String)} To restrict selecting to a limited set of geometry types,
* send a list of strings corresponding to the geometry class names.
*/
geometryTypes: null,
/**
* Property: layer
* {<OpenLayers.Layer.Vector>}
@@ -75,13 +82,16 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
*/
initialize: function(layer, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]);
this.layer = layer;
this.callbacks = OpenLayers.Util.extend({
click: this.clickFeature,
over: this.overFeature,
out: this.outFeature
}, this.callbacks);
this.layer = layer;
this.handler = new OpenLayers.Handler.Feature(this, layer, this.callbacks);
var handlerOptions = {geometryTypes: this.geometryTypes};
this.handler = new OpenLayers.Handler.Feature(this, layer,
this.callbacks,
handlerOptions);
},
/**