Merge pull request #733 from ahocevar/fid
Store the feature's commonly used id. r=@fredj,@bartvde
This commit is contained in:
@@ -16,6 +16,12 @@ describe('ol.Feature', function() {
|
||||
expect(feature.get('foo')).to.be('bar');
|
||||
});
|
||||
|
||||
it('can store the feature\'s commonly used id', function() {
|
||||
var feature = new ol.Feature();
|
||||
feature.setFeatureId('foo');
|
||||
expect(feature.getFeatureId()).to.be('foo');
|
||||
});
|
||||
|
||||
it('will set the default geometry', function() {
|
||||
var feature = new ol.Feature({
|
||||
loc: new ol.geom.Point([10, 20]),
|
||||
|
||||
@@ -198,6 +198,7 @@ describe('ol.parser.GeoJSON', function() {
|
||||
var first = result[0];
|
||||
expect(first).to.be.a(ol.Feature);
|
||||
expect(first.get('name')).to.be('Afghanistan');
|
||||
expect(first.getFeatureId()).to.be('AFG');
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(firstGeom.getBounds(),
|
||||
@@ -207,6 +208,7 @@ describe('ol.parser.GeoJSON', function() {
|
||||
var last = result[178];
|
||||
expect(last).to.be.a(ol.Feature);
|
||||
expect(last.get('name')).to.be('Zimbabwe');
|
||||
expect(last.getFeatureId()).to.be('ZWE');
|
||||
var lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(ol.geom.Polygon);
|
||||
expect(ol.extent.equals(lastGeom.getBounds(),
|
||||
|
||||
@@ -86,6 +86,7 @@ describe('ol.parser.kml', function() {
|
||||
'itself \n at the height of the underlying terrain.';
|
||||
expect(obj.features[0].get('description')).to.eql(description);
|
||||
expect(obj.features[0].get('foo')).to.eql('bar');
|
||||
expect(obj.features[0].getFeatureId()).to.eql('foobarbaz');
|
||||
});
|
||||
});
|
||||
it('Extended data read correctly [2]', function() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/kml/2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd">
|
||||
<Placemark>
|
||||
<Placemark id="foobarbaz">
|
||||
<name>Extended data placemark</name>
|
||||
<description>Attached to the ground. Intelligently places itself
|
||||
at the height of the underlying terrain.</description>
|
||||
|
||||
Reference in New Issue
Block a user