getFeatures method and featureInfo templates
To avoid surprises for application developers, this change creates a new getFeatures method. So it is clear now beforehand whether features or feature info markup is returned. The result is now also grouped by layer, so application developers always have a link between a layer and the feature info it returns. To make getFeatureInfo return markup for vector layers, this change also adds a featureInfoFunction property to the vector layer, which gives developers full control over how features are rendered to feature info markup.
This commit is contained in:
@@ -440,6 +440,19 @@ ol.Map.prototype.getFeatureInfo = function(options) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get features for a pixel on the map.
|
||||
*
|
||||
* @param {ol.GetFeaturesOptions} options Options.
|
||||
*/
|
||||
ol.Map.prototype.getFeatures = function(options) {
|
||||
var layers = goog.isDefAndNotNull(options.layers) ?
|
||||
options.layers : this.getLayers().getArray();
|
||||
this.getRenderer().getFeaturesForPixel(
|
||||
options.pixel, layers, options.success, options.error);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Collection} Interactions.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user