From ad65989d280d89ee36cb32dd3c3af5328d236437 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 27 Jan 2015 11:18:11 +0100 Subject: [PATCH 1/5] Move bbox property to GeoJSONObject See http://geojson.org/geojson-spec.html#geojson-objects: "A GeoJSON object may have a "bbox" member [...]" --- externs/geojson.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/externs/geojson.js b/externs/geojson.js index db7e1b62e3..2400a1dd1d 100644 --- a/externs/geojson.js +++ b/externs/geojson.js @@ -13,6 +13,12 @@ var GeoJSONObject = function() {}; +/** + * @type {!Array.|undefined} + */ +GeoJSONObject.prototype.bbox; + + /** * @type {string} */ @@ -110,12 +116,6 @@ GeoJSONGeometryCollection.prototype.geometries; var GeoJSONFeature = function() {}; -/** - * @type {!Array.|undefined} - */ -GeoJSONFeature.prototype.bbox; - - /** * @type {GeoJSONGeometry} */ @@ -148,12 +148,6 @@ var GeoJSONFeatureCollection = function() {}; GeoJSONFeatureCollection.prototype.features; -/** - * @type {!Array.|undefined} - */ -GeoJSONFeatureCollection.prototype.bbox; - - /** * @constructor From 3fbe9265dac39da12b3ea92ad06ec3d8a41176f6 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 27 Jan 2015 11:23:55 +0100 Subject: [PATCH 2/5] Remove GeoJSONObject extends from GeoJSONCRS Otherwise CRS object may have a `boox` or a `crs` property --- externs/geojson.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/externs/geojson.js b/externs/geojson.js index 2400a1dd1d..e96d5409dc 100644 --- a/externs/geojson.js +++ b/externs/geojson.js @@ -34,11 +34,17 @@ GeoJSONObject.prototype.crs; /** * @constructor - * @extends {GeoJSONObject} */ var GeoJSONCRS = function() {}; +/** + * CRS type. One of `link` or `name`. + * @type {string} + */ +GeoJSONCRS.prototype.type; + + /** * TODO: remove GeoJSONCRSCode when http://jira.codehaus.org/browse/GEOS-5996 * is fixed and widely deployed. From d219a8ef229227c2a1593aa43f02b6cfaa055a3f Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 27 Jan 2015 11:30:11 +0100 Subject: [PATCH 3/5] Remove GeoJSONObject extends from GeoJSONLink Otherwise CRS object may have a `boox` or a `crs` property --- externs/geojson.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/externs/geojson.js b/externs/geojson.js index e96d5409dc..0b7c2c74ac 100644 --- a/externs/geojson.js +++ b/externs/geojson.js @@ -157,7 +157,6 @@ GeoJSONFeatureCollection.prototype.features; /** * @constructor - * @extends {GeoJSONObject} */ var GeoJSONLink = function() {}; @@ -166,3 +165,8 @@ var GeoJSONLink = function() {}; * @type {string} */ GeoJSONLink.prototype.href; + +/** + * @type {string} + */ +GeoJSONLink.prototype.type; From f1c0072bd09b32b915a91ba5943618c65b20577d Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 27 Jan 2015 11:48:47 +0100 Subject: [PATCH 4/5] More precise olx.source.GeoJSONOptions#object type --- externs/olx.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 2e8b833ede..38eed88170 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -3564,7 +3564,7 @@ olx.source.FormatVectorOptions.prototype.projection; * @typedef {{attributions: (Array.|undefined), * defaultProjection: ol.proj.ProjectionLike, * logo: (string|olx.LogoOptions|undefined), - * object: (GeoJSONObject|undefined), + * object: (GeoJSONFeature|GeoJSONFeatureCollection|undefined), * projection: ol.proj.ProjectionLike, * text: (string|undefined), * url: (string|undefined), @@ -3599,8 +3599,8 @@ olx.source.GeoJSONOptions.prototype.logo; /** - * Object. - * @type {GeoJSONObject|undefined} + * GeoJSON feature or feature collection. + * @type {GeoJSONFeature|GeoJSONFeatureCollection|undefined} * @api */ olx.source.GeoJSONOptions.prototype.object; From d640accdc89a72d4c1f0f81672b04441d09faec3 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 27 Jan 2015 11:54:43 +0100 Subject: [PATCH 5/5] More precise ol.format.GeoJSON.readGeometry_ param type --- src/ol/format/geojsonformat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/format/geojsonformat.js b/src/ol/format/geojsonformat.js index 66fe0b0aff..c29a15b7f2 100644 --- a/src/ol/format/geojsonformat.js +++ b/src/ol/format/geojsonformat.js @@ -64,7 +64,7 @@ ol.format.GeoJSON.EXTENSIONS_ = ['.geojson']; /** - * @param {GeoJSONObject} object Object. + * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object. * @param {olx.format.ReadOptions=} opt_options Read options. * @private * @return {ol.geom.Geometry} Geometry. @@ -92,7 +92,7 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function( goog.asserts.assert(object.type == 'GeometryCollection'); var geometries = goog.array.map(object.geometries, /** - * @param {GeoJSONObject} geometry Geometry. + * @param {GeoJSONGeometry} geometry Geometry. * @return {ol.geom.Geometry} geometry Geometry. */ function(geometry) {