Skip to content

Commit 7368ca3

Browse files
committed
【fix】修复获取iserver要素可能多stringID和ID属性字段的问题 review by zhaoqin
1 parent fabc1d8 commit 7368ca3

File tree

6 files changed

+1701
-997
lines changed

6 files changed

+1701
-997
lines changed

dist/openlayers/iclient9-openlayers-es6.js

Lines changed: 472 additions & 136 deletions
Large diffs are not rendered by default.

dist/openlayers/iclient9-openlayers-es6.min.js

Lines changed: 399 additions & 399 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/openlayers/iclient9-openlayers.js

Lines changed: 782 additions & 418 deletions
Large diffs are not rendered by default.

dist/openlayers/iclient9-openlayers.min.js

Lines changed: 35 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/format/GeoJSON.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ export class GeoJSON extends JSONFormat {
712712
}
713713
var attr = {};
714714
processFieldsAttributes(feature, attr);
715-
var exceptKeys = ["fieldNames", "fieldValues", "geometry"];
715+
var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
716716
for (var key in feature) {
717717
if (exceptKeys.indexOf(key) > -1) {
718718
continue;

test/common/format/GeoJSONSpec.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ describe('GeoJSON', () => {
557557

558558
it('toGeoJson_Feature_Attribute', () => {
559559
var obj = {
560+
stringID: null,
561+
ID: null,
560562
fieldValues: [
561563
"127",
562564
"利伯维尔"
@@ -576,13 +578,15 @@ describe('GeoJSON', () => {
576578
}
577579
};
578580

579-
var geoRegionEPS = new GeoJSON().toGeoJSON(obj);
580-
expect(geoRegionEPS).not.toBeNull();
581-
expect(geoRegionEPS.type).toEqual("Feature");
582-
expect(geoRegionEPS.geometry).not.toBeNull();
583-
expect(geoRegionEPS.geometry.type).toEqual("Point");
584-
expect(geoRegionEPS.geometry.coordinates).not.toBeNull();
585-
expect(geoRegionEPS.geometry.coordinates[0]).toEqual(4020.0045221720466);
586-
expect(geoRegionEPS.geometry.coordinates[1]).toEqual(-4377.027184298267);
581+
var geo = new GeoJSON().toGeoJSON(obj);
582+
expect(geo).not.toBeNull();
583+
expect(geo.type).toEqual("Feature");
584+
expect(geo.properties.hasOwnProperty("stringID")).toBeFalsy();
585+
expect(geo.properties.hasOwnProperty("ID")).toBeFalsy();
586+
expect(geo.geometry).not.toBeNull();
587+
expect(geo.geometry.type).toEqual("Point");
588+
expect(geo.geometry.coordinates).not.toBeNull();
589+
expect(geo.geometry.coordinates[0]).toEqual(4020.0045221720466);
590+
expect(geo.geometry.coordinates[1]).toEqual(-4377.027184298267);
587591
});
588592
});

0 commit comments

Comments
 (0)