Rename {get|set}FeatureId to {get|set}Id
This commit is contained in:
@@ -32,7 +32,7 @@ var vector = new ol.layer.Vector({
|
|||||||
}),
|
}),
|
||||||
transformFeatureInfo: function(features) {
|
transformFeatureInfo: function(features) {
|
||||||
return features.length > 0 ?
|
return features.length > 0 ?
|
||||||
features[0].getFeatureId() + ': ' + features[0].get('name') : ' ';
|
features[0].getId() + ': ' + features[0].get('name') : ' ';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ map.on(['click', 'mousemove'], function(evt) {
|
|||||||
success: function(featuresByLayer) {
|
success: function(featuresByLayer) {
|
||||||
var features = featuresByLayer[0];
|
var features = featuresByLayer[0];
|
||||||
document.getElementById('info').innerHTML = features.length > 0 ?
|
document.getElementById('info').innerHTML = features.length > 0 ?
|
||||||
features[0].getFeatureId() + ': ' + features[0].get('name') :
|
features[0].getId() + ': ' + features[0].get('name') :
|
||||||
' ';
|
' ';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ ol.expr.lib[ol.expr.functions.EXTENT] = function(minX, minY, maxX, maxY,
|
|||||||
*/
|
*/
|
||||||
ol.expr.lib[ol.expr.functions.FID] = function(var_args) {
|
ol.expr.lib[ol.expr.functions.FID] = function(var_args) {
|
||||||
var matches = false;
|
var matches = false;
|
||||||
var id = this.getFeatureId();
|
var id = this.getId();
|
||||||
if (goog.isDef(id)) {
|
if (goog.isDef(id)) {
|
||||||
for (var i = 0, ii = arguments.length; i < ii; ++i) {
|
for (var i = 0, ii = arguments.length; i < ii; ++i) {
|
||||||
if (arguments[i] === id) {
|
if (arguments[i] === id) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
@exportSymbol ol.Feature
|
@exportSymbol ol.Feature
|
||||||
@exportProperty ol.Feature.prototype.getAttributes
|
@exportProperty ol.Feature.prototype.getAttributes
|
||||||
@exportProperty ol.Feature.prototype.getFeatureId
|
@exportProperty ol.Feature.prototype.getId
|
||||||
@exportProperty ol.Feature.prototype.getGeometry
|
@exportProperty ol.Feature.prototype.getGeometry
|
||||||
@exportProperty ol.Feature.prototype.set
|
@exportProperty ol.Feature.prototype.set
|
||||||
@exportProperty ol.Feature.prototype.setGeometry
|
@exportProperty ol.Feature.prototype.setGeometry
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ ol.Feature.prototype.getAttributes = function() {
|
|||||||
*
|
*
|
||||||
* @return {string|undefined} The feature's identifier.
|
* @return {string|undefined} The feature's identifier.
|
||||||
*/
|
*/
|
||||||
ol.Feature.prototype.getFeatureId = function() {
|
ol.Feature.prototype.getId = function() {
|
||||||
return this.featureId_;
|
return this.featureId_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ ol.Feature.prototype.set = function(key, value) {
|
|||||||
*
|
*
|
||||||
* @param {string|undefined} featureId The feature's identifier.
|
* @param {string|undefined} featureId The feature's identifier.
|
||||||
*/
|
*/
|
||||||
ol.Feature.prototype.setFeatureId = function(featureId) {
|
ol.Feature.prototype.setId = function(featureId) {
|
||||||
this.featureId_ = featureId;
|
this.featureId_ = featureId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ ol.interaction.Select.prototype.select =
|
|||||||
} else if (!(featureId in oldFeatureMap)) {
|
} else if (!(featureId in oldFeatureMap)) {
|
||||||
clone = new ol.Feature(feature.getAttributes());
|
clone = new ol.Feature(feature.getAttributes());
|
||||||
clone.setGeometry(feature.getGeometry().clone());
|
clone.setGeometry(feature.getGeometry().clone());
|
||||||
clone.setFeatureId(feature.getFeatureId());
|
clone.setId(feature.getId());
|
||||||
clone.setSymbolizers(feature.getSymbolizers());
|
clone.setSymbolizers(feature.getSymbolizers());
|
||||||
clone.renderIntent = ol.layer.VectorLayerRenderIntent.SELECTED;
|
clone.renderIntent = ol.layer.VectorLayerRenderIntent.SELECTED;
|
||||||
featureMap[featureId] = clone;
|
featureMap[featureId] = clone;
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ ol.parser.GeoJSON.prototype.parseFeature_ = function(json, opt_options) {
|
|||||||
options = opt_options || {};
|
options = opt_options || {};
|
||||||
var feature = new ol.Feature(json.properties);
|
var feature = new ol.Feature(json.properties);
|
||||||
if (goog.isDef(json.id)) {
|
if (goog.isDef(json.id)) {
|
||||||
feature.setFeatureId(json.id);
|
feature.setId(json.id);
|
||||||
}
|
}
|
||||||
if (geomJson) {
|
if (geomJson) {
|
||||||
var type = geomJson.type;
|
var type = geomJson.type;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ ol.parser.KML = function(opt_options) {
|
|||||||
}
|
}
|
||||||
var feature = new ol.Feature(container.properties);
|
var feature = new ol.Feature(container.properties);
|
||||||
if (!goog.isNull(id)) {
|
if (!goog.isNull(id)) {
|
||||||
feature.setFeatureId(id);
|
feature.setId(id);
|
||||||
}
|
}
|
||||||
var geom = track.points[i];
|
var geom = track.points[i];
|
||||||
if (geom) {
|
if (geom) {
|
||||||
@@ -156,7 +156,7 @@ ol.parser.KML = function(opt_options) {
|
|||||||
}
|
}
|
||||||
feature = new ol.Feature(container.properties);
|
feature = new ol.Feature(container.properties);
|
||||||
if (!goog.isNull(id)) {
|
if (!goog.isNull(id)) {
|
||||||
feature.setFeatureId(id);
|
feature.setId(id);
|
||||||
}
|
}
|
||||||
if (container.geometry) {
|
if (container.geometry) {
|
||||||
sharedVertices = undefined;
|
sharedVertices = undefined;
|
||||||
@@ -720,7 +720,7 @@ ol.parser.KML = function(opt_options) {
|
|||||||
},
|
},
|
||||||
'_feature': function(feature) {
|
'_feature': function(feature) {
|
||||||
var node = this.createElementNS('Placemark');
|
var node = this.createElementNS('Placemark');
|
||||||
var fid = feature.getFeatureId();
|
var fid = feature.getId();
|
||||||
if (goog.isDef(fid)) {
|
if (goog.isDef(fid)) {
|
||||||
node.setAttribute('id', fid);
|
node.setAttribute('id', fid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ ol.parser.ogc.GML = function(opt_options) {
|
|||||||
var fid = node.getAttribute('fid') ||
|
var fid = node.getAttribute('fid') ||
|
||||||
this.getAttributeNS(node, this.defaultNamespaceURI, 'id');
|
this.getAttributeNS(node, this.defaultNamespaceURI, 'id');
|
||||||
if (!goog.isNull(fid)) {
|
if (!goog.isNull(fid)) {
|
||||||
feature.setFeatureId(fid);
|
feature.setId(fid);
|
||||||
}
|
}
|
||||||
obj.features.push(feature);
|
obj.features.push(feature);
|
||||||
},
|
},
|
||||||
@@ -419,7 +419,7 @@ ol.parser.ogc.GML = function(opt_options) {
|
|||||||
'_typeName': function(feature) {
|
'_typeName': function(feature) {
|
||||||
var node = this.createElementNS('feature:' + this.featureType,
|
var node = this.createElementNS('feature:' + this.featureType,
|
||||||
this.featureNS);
|
this.featureNS);
|
||||||
var fid = feature.getFeatureId();
|
var fid = feature.getId();
|
||||||
if (goog.isDef(fid)) {
|
if (goog.isDef(fid)) {
|
||||||
this.setAttributeNS(node, this.defaultNamespaceURI, 'fid', fid);
|
this.setAttributeNS(node, this.defaultNamespaceURI, 'fid', fid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ ol.parser.TopoJSON.prototype.readFeatureFromGeometry_ = function(object, arcs,
|
|||||||
var feature = new ol.Feature();
|
var feature = new ol.Feature();
|
||||||
feature.setGeometry(geometry);
|
feature.setGeometry(geometry);
|
||||||
if (goog.isDef(object.id)) {
|
if (goog.isDef(object.id)) {
|
||||||
feature.setFeatureId(String(object.id));
|
feature.setId(String(object.id));
|
||||||
}
|
}
|
||||||
return feature;
|
return feature;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -712,16 +712,16 @@ describe('ol.expr.lib', function() {
|
|||||||
describe('fid()', function() {
|
describe('fid()', function() {
|
||||||
|
|
||||||
var one = new ol.Feature();
|
var one = new ol.Feature();
|
||||||
one.setFeatureId('one');
|
one.setId('one');
|
||||||
|
|
||||||
var two = new ol.Feature();
|
var two = new ol.Feature();
|
||||||
two.setFeatureId('two');
|
two.setId('two');
|
||||||
|
|
||||||
var three = new ol.Feature();
|
var three = new ol.Feature();
|
||||||
three.setFeatureId('three');
|
three.setId('three');
|
||||||
|
|
||||||
var four = new ol.Feature();
|
var four = new ol.Feature();
|
||||||
four.setFeatureId('four');
|
four.setId('four');
|
||||||
|
|
||||||
var odd = parse('fid("one", "three")');
|
var odd = parse('fid("one", "three")');
|
||||||
var even = parse('fid("two", "four")');
|
var even = parse('fid("two", "four")');
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ describe('ol.Feature', function() {
|
|||||||
|
|
||||||
it('can store the feature\'s commonly used id', function() {
|
it('can store the feature\'s commonly used id', function() {
|
||||||
var feature = new ol.Feature();
|
var feature = new ol.Feature();
|
||||||
feature.setFeatureId('foo');
|
feature.setId('foo');
|
||||||
expect(feature.getFeatureId()).to.be('foo');
|
expect(feature.getId()).to.be('foo');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('will set the default geometry', function() {
|
it('will set the default geometry', function() {
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ describe('ol.parser.GeoJSON', function() {
|
|||||||
var first = result[0];
|
var first = result[0];
|
||||||
expect(first).to.be.a(ol.Feature);
|
expect(first).to.be.a(ol.Feature);
|
||||||
expect(first.get('name')).to.be('Afghanistan');
|
expect(first.get('name')).to.be('Afghanistan');
|
||||||
expect(first.getFeatureId()).to.be('AFG');
|
expect(first.getId()).to.be('AFG');
|
||||||
var firstGeom = first.getGeometry();
|
var firstGeom = first.getGeometry();
|
||||||
expect(firstGeom).to.be.a(ol.geom.Polygon);
|
expect(firstGeom).to.be.a(ol.geom.Polygon);
|
||||||
expect(ol.extent.equals(firstGeom.getBounds(),
|
expect(ol.extent.equals(firstGeom.getBounds(),
|
||||||
@@ -208,7 +208,7 @@ describe('ol.parser.GeoJSON', function() {
|
|||||||
var last = result[178];
|
var last = result[178];
|
||||||
expect(last).to.be.a(ol.Feature);
|
expect(last).to.be.a(ol.Feature);
|
||||||
expect(last.get('name')).to.be('Zimbabwe');
|
expect(last.get('name')).to.be('Zimbabwe');
|
||||||
expect(last.getFeatureId()).to.be('ZWE');
|
expect(last.getId()).to.be('ZWE');
|
||||||
var lastGeom = last.getGeometry();
|
var lastGeom = last.getGeometry();
|
||||||
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
||||||
expect(ol.extent.equals(lastGeom.getBounds(),
|
expect(ol.extent.equals(lastGeom.getBounds(),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ describe('ol.parser.KML', function() {
|
|||||||
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
expect(goog.dom.xml.loadXml(output)).to.xmleql(xml);
|
||||||
expect(obj.features.length).to.eql(1);
|
expect(obj.features.length).to.eql(1);
|
||||||
var geom = obj.features[0].getGeometry();
|
var geom = obj.features[0].getGeometry();
|
||||||
expect(obj.features[0].getFeatureId()).to.eql('KML.Polygon');
|
expect(obj.features[0].getId()).to.eql('KML.Polygon');
|
||||||
expect(geom instanceof ol.geom.Polygon).to.be.ok();
|
expect(geom instanceof ol.geom.Polygon).to.be.ok();
|
||||||
expect(geom.dimension).to.eql(3);
|
expect(geom.dimension).to.eql(3);
|
||||||
done();
|
done();
|
||||||
@@ -90,7 +90,7 @@ describe('ol.parser.KML', function() {
|
|||||||
'itself \n at the height of the underlying terrain.';
|
'itself \n at the height of the underlying terrain.';
|
||||||
expect(obj.features[0].get('description')).to.eql(description);
|
expect(obj.features[0].get('description')).to.eql(description);
|
||||||
expect(obj.features[0].get('foo')).to.eql('bar');
|
expect(obj.features[0].get('foo')).to.eql('bar');
|
||||||
expect(obj.features[0].getFeatureId()).to.eql('foobarbaz');
|
expect(obj.features[0].getId()).to.eql('foobarbaz');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ describe('ol.parser.gml_v2', function() {
|
|||||||
expect(feature.getGeometry() instanceof
|
expect(feature.getGeometry() instanceof
|
||||||
ol.geom.MultiPolygon).to.be.ok();
|
ol.geom.MultiPolygon).to.be.ok();
|
||||||
var attributes = feature.getAttributes();
|
var attributes = feature.getAttributes();
|
||||||
expect(feature.getFeatureId()).to.eql('states.1');
|
expect(feature.getId()).to.eql('states.1');
|
||||||
expect(attributes['STATE_NAME']).to.eql('Illinois');
|
expect(attributes['STATE_NAME']).to.eql('Illinois');
|
||||||
expect(attributes['STATE_FIPS']).to.eql('17');
|
expect(attributes['STATE_FIPS']).to.eql('17');
|
||||||
expect(attributes['SUB_REGION']).to.eql('E N Cen');
|
expect(attributes['SUB_REGION']).to.eql('E N Cen');
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ describe('ol.parser.gml_v3', function() {
|
|||||||
expect(feature.getGeometry() instanceof
|
expect(feature.getGeometry() instanceof
|
||||||
ol.geom.MultiPolygon).to.be.ok();
|
ol.geom.MultiPolygon).to.be.ok();
|
||||||
var attributes = feature.getAttributes();
|
var attributes = feature.getAttributes();
|
||||||
expect(feature.getFeatureId()).to.eql('states.1');
|
expect(feature.getId()).to.eql('states.1');
|
||||||
expect(attributes['STATE_NAME']).to.eql('Illinois');
|
expect(attributes['STATE_NAME']).to.eql('Illinois');
|
||||||
expect(attributes['STATE_FIPS']).to.eql('17');
|
expect(attributes['STATE_FIPS']).to.eql('17');
|
||||||
expect(attributes['SUB_REGION']).to.eql('E N Cen');
|
expect(attributes['SUB_REGION']).to.eql('E N Cen');
|
||||||
@@ -326,7 +326,7 @@ describe('ol.parser.gml_v3', function() {
|
|||||||
expect(feature.getGeometry() instanceof
|
expect(feature.getGeometry() instanceof
|
||||||
ol.geom.MultiPolygon).to.be.ok();
|
ol.geom.MultiPolygon).to.be.ok();
|
||||||
var attributes = feature.getAttributes();
|
var attributes = feature.getAttributes();
|
||||||
expect(feature.getFeatureId()).to.eql('states.1');
|
expect(feature.getId()).to.eql('states.1');
|
||||||
expect(attributes['STATE_NAME']).to.eql('Illinois');
|
expect(attributes['STATE_NAME']).to.eql('Illinois');
|
||||||
expect(attributes['STATE_FIPS']).to.eql('17');
|
expect(attributes['STATE_FIPS']).to.eql('17');
|
||||||
expect(attributes['SUB_REGION']).to.eql('E N Cen');
|
expect(attributes['SUB_REGION']).to.eql('E N Cen');
|
||||||
|
|||||||
Reference in New Issue
Block a user