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