Renaming featureInfoFunction to transformFeatureInfo
This commit is contained in:
@@ -16,7 +16,7 @@ var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
projection: ol.proj.get('EPSG:4326')
|
||||
}),
|
||||
featureInfoFunction: function(features) {
|
||||
transformFeatureInfo: function(features) {
|
||||
var info = [];
|
||||
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||
info.push(features[i].get('name') + ': ' + features[i].get('type'));
|
||||
|
||||
@@ -26,7 +26,7 @@ var vector = new ol.layer.Vector({
|
||||
source: new ol.source.Vector({
|
||||
projection: epsg4326
|
||||
}),
|
||||
featureInfoFunction: function(features) {
|
||||
transformFeatureInfo: function(features) {
|
||||
var info = [];
|
||||
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||
info.push(features[i].get('name'));
|
||||
|
||||
@@ -29,7 +29,7 @@ var vector = new ol.layer.Vector({
|
||||
]
|
||||
})
|
||||
]}),
|
||||
featureInfoFunction: function(features) {
|
||||
transformFeatureInfo: function(features) {
|
||||
return features.length > 0 ?
|
||||
features[0].getFeatureId() + ': ' + features[0].get('name') : ' ';
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
/**
|
||||
* @typedef {Object} ol.layer.VectorLayerOptions
|
||||
* @property {function(Array.<ol.Feature>):string|
|
||||
* undefined} featureInfoFunction Function to render an array of features
|
||||
* undefined} transformFeatureInfo Function to render an array of features
|
||||
* into feature info markup. If not provided, a comma separated list the
|
||||
* unique ids of the resulting features will be returned.
|
||||
* @property {number|undefined} opacity Opacity. 0-1. Default is 1.
|
||||
|
||||
@@ -183,8 +183,8 @@ ol.layer.Vector = function(options) {
|
||||
* @type {function(Array.<ol.Feature>):string}
|
||||
* @private
|
||||
*/
|
||||
this.featureInfoFunction_ = goog.isDef(options.featureInfoFunction) ?
|
||||
options.featureInfoFunction : ol.layer.Vector.uidFeatureInfoFunction;
|
||||
this.transformFeatureInfo_ = goog.isDef(options.transformFeatureInfo) ?
|
||||
options.transformFeatureInfo : ol.layer.Vector.uidTransformFeatureInfo;
|
||||
|
||||
/**
|
||||
* TODO: this means we need to know dimension at construction
|
||||
@@ -389,8 +389,8 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
|
||||
/**
|
||||
* @return {function(Array.<ol.Feature>):string} Feature info function.
|
||||
*/
|
||||
ol.layer.Vector.prototype.getFeatureInfoFunction = function() {
|
||||
return this.featureInfoFunction_;
|
||||
ol.layer.Vector.prototype.getTransformFeatureInfo = function() {
|
||||
return this.transformFeatureInfo_;
|
||||
};
|
||||
|
||||
|
||||
@@ -398,7 +398,7 @@ ol.layer.Vector.prototype.getFeatureInfoFunction = function() {
|
||||
* @param {Array.<ol.Feature>} features Features.
|
||||
* @return {string} Feature info.
|
||||
*/
|
||||
ol.layer.Vector.uidFeatureInfoFunction = function(features) {
|
||||
ol.layer.Vector.uidTransformFeatureInfo = function(features) {
|
||||
var featureIds = goog.array.map(features,
|
||||
function(feature) { return goog.getUid(feature); });
|
||||
return featureIds.join(', ');
|
||||
|
||||
@@ -200,7 +200,7 @@ ol.renderer.canvas.VectorLayer.prototype.getTransform = function() {
|
||||
ol.renderer.canvas.VectorLayer.prototype.getFeatureInfoForPixel =
|
||||
function(pixel, success) {
|
||||
var callback = function(features, layer) {
|
||||
success(layer.getFeatureInfoFunction()(features), layer);
|
||||
success(layer.getTransformFeatureInfo()(features), layer);
|
||||
};
|
||||
this.getFeaturesForPixel(pixel, callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user