From 340762ed2ca3139285ee031149507bd12d7b7bde Mon Sep 17 00:00:00 2001 From: servetg Date: Thu, 24 Sep 2015 11:14:26 +0300 Subject: [PATCH] Add bbox and some docs corrections --- .gitignore | 2 +- .idea/workspace.xml | 297 +++++++++++++----- src/formats/geojson/GeoJSON.js | 163 +++++++--- src/formats/geojson/GeoJSONCRS.js | 31 +- src/formats/geojson/GeoJSONFeature.js | 31 +- .../geojson/GeoJSONFeatureCollection.js | 30 +- src/formats/geojson/GeoJSONGeometry.js | 34 +- .../geojson/GeoJSONGeometryCollection.js | 31 +- .../geojson/GeoJSONGeometryLineString.js | 12 +- .../geojson/GeoJSONGeometryMultiLineString.js | 12 +- .../geojson/GeoJSONGeometryMultiPoint.js | 12 +- .../geojson/GeoJSONGeometryMultiPolygon.js | 15 +- src/formats/geojson/GeoJSONGeometryPoint.js | 12 +- src/formats/geojson/GeoJSONGeometryPolygon.js | 18 +- 14 files changed, 504 insertions(+), 196 deletions(-) diff --git a/.gitignore b/.gitignore index b241b4c2e..0ec4e5af0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ api-doc/ worldwindlib.js WebWorldWind.zip -node_modules/ +node_modules/ \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 68e94129f..1f8c53fa0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,9 @@ + - @@ -15,6 +15,7 @@ + @@ -35,11 +36,83 @@ - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -55,19 +128,20 @@ @@ -109,7 +183,6 @@ - @@ -187,8 +260,23 @@ + @@ -198,8 +286,19 @@ + + + + + + + + + + + @@ -210,6 +309,18 @@ + + + + + + + + @@ -247,6 +358,9 @@ + + + @@ -257,29 +371,37 @@ - + - - - - + + + + + - - + + + - - - + + - + + + + @@ -288,50 +410,59 @@ - + - - + + - + - - - - - + + - + - - - - - + + - + + + + + + + + + + + + + + + + - - + + - + - + - - + + @@ -340,115 +471,123 @@ - - + + - + + + + + + + + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - - + + - + - - + + - + - - + + - + @@ -458,10 +597,10 @@ - + - - + + diff --git a/src/formats/geojson/GeoJSON.js b/src/formats/geojson/GeoJSON.js index 35bbf5fee..40b95233f 100644 --- a/src/formats/geojson/GeoJSON.js +++ b/src/formats/geojson/GeoJSON.js @@ -59,13 +59,15 @@ define(['../../error/ArgumentError', * GeoJSON and create shapes for it. * @alias GeoJSON * @constructor - * @classdesc Parses a GeoJSON and creates shapes representing its contents. Points and MultiPoints in the GeoJSON are - * represented by [Placemarks]{@link Placemark}, Lines and MultiLines are represented by [SurfacePolylines]{@link SurfacePolyline}, - * and Polygons and MultiPolygons are represented by [SurfacePolygons]{@link SurfacePolygon}. + * @classdesc Parses a GeoJSON and creates shapes representing its contents. Points and MultiPoints in + * the GeoJSON are represented by [Placemarks]{@link Placemark}, Lines and MultiLines are represented by + * [SurfacePolylines]{@link SurfacePolyline}, and Polygons and MultiPolygons are represented + * by [SurfacePolygons]{@link SurfacePolygon}. *

* An attribute callback may also be specified to examine each geometry and configure the shape created for it. * This function enables the application to assign independent attributes to each - * shape. An argument to this function provides any attributes specified in a properties member of GeoJSON feature. + * shape. An argument to this function provides any attributes specified in a properties member of GeoJSON + * feature. * @param {String} url The location of the GeoJSON. * @throws {ArgumentError} If the specified URL is null or undefined. */ @@ -221,10 +223,10 @@ define(['../../error/ArgumentError', * For {@link Placemark} shapes it is also specified as the placemark label. * It is specified as the displayName for all other shapes. * - * @param {{GeoJSONGeometry}} geometry An object containing the geometry associated with this GeoJSON. + * @param {GeoJSONGeometry} geometry An object containing the geometry associated with this GeoJSON. * @param {Object} properties An object containing the attribute-value pairs found in GeoJSON feature properties * member. - * @returns {{}} An object with properties as described above. + * @returns {Object} An object with properties as described above. */ GeoJSON.prototype.defaultShapeConfigurationCallback = function (geometry, properties) { var configuration = {}; @@ -245,7 +247,7 @@ define(['../../error/ArgumentError', return configuration; }; - // Internal use only. Intentionally not documented. + // Get GeoJSON string using XMLHttpRequest. Internal use only. GeoJSON.prototype.requestUrl = function (url) { var xhr = new XMLHttpRequest(); @@ -278,7 +280,7 @@ define(['../../error/ArgumentError', xhr.send(null); }; - // Internal use only. Intentionally not documented. + // Parse GeoJSON string using built in method JSON.parse(). Internal use only. GeoJSON.prototype.parse = function (geoJSONString) { try { this._geoJSONObject = JSON.parse(geoJSONString); @@ -329,7 +331,9 @@ define(['../../error/ArgumentError', this.geoJSONObject[GeoJSONConstants.FIELD_GEOMETRY], this.geoJSONObject[GeoJSONConstants.FIELD_PROPERTIES], this.geoJSONObject[GeoJSONConstants.FIELD_CRS], - this.geoJSONObject[GeoJSONConstants.FIELD_ID]); + this.geoJSONObject[GeoJSONConstants.FIELD_ID], + this.geoJSONObject[GeoJSONConstants.FIELD_BBOX] + ); this.addRenderablesForFeature( layer, feature, @@ -338,7 +342,8 @@ define(['../../error/ArgumentError', case GeoJSONConstants.TYPE_FEATURE_COLLECTION: var featureCollection = new GeoJSONFeatureCollection( this.geoJSONObject[GeoJSONConstants.FIELD_FEATURES], - this.geoJSONObject[GeoJSONConstants.FIELD_CRS] + this.geoJSONObject[GeoJSONConstants.FIELD_CRS], + this.geoJSONObject[GeoJSONConstants.FIELD_BBOX] ); this.addRenderablesForFeatureCollection( layer, @@ -347,8 +352,8 @@ define(['../../error/ArgumentError', case GeoJSONConstants.TYPE_GEOMETRY_COLLECTION: var geometryCollection = new GeoJSONGeometryCollection( this.geoJSONObject[GeoJSONConstants.FIELD_GEOMETRIES], - this.geoJSONObject[GeoJSONConstants.FIELD_TYPE], - this.geoJSONObject[GeoJSONConstants.FIELD_CRS]); + this.geoJSONObject[GeoJSONConstants.FIELD_CRS], + this.geoJSONObject[GeoJSONConstants.FIELD_BBOX]); this.addRenderablesForGeometryCollection( layer, geometryCollection, @@ -400,43 +405,68 @@ define(['../../error/ArgumentError', var pointGeometry = new GeoJSONGeometryPoint( geometry[GeoJSONConstants.FIELD_COORDINATES], geometry[GeoJSONConstants.FIELD_TYPE], - geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs); - this.addRenderablesForPoint(layer, pointGeometry, properties ? properties : null); + geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs, + geometry[GeoJSONConstants.FIELD_BBOX]); + this.addRenderablesForPoint( + layer, + pointGeometry, + properties ? properties : null); break; case GeoJSONConstants.TYPE_MULTI_POINT: var multiPointGeometry = new GeoJSONGeometryMultiPoint( geometry[GeoJSONConstants.FIELD_COORDINATES], geometry[GeoJSONConstants.FIELD_TYPE], - geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs); - this.addRenderablesForMultiPoint(layer, multiPointGeometry, properties ? properties : null); + geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs, + geometry[GeoJSONConstants.FIELD_BBOX]); + this.addRenderablesForMultiPoint( + layer, + multiPointGeometry, + properties ? properties : null); break; case GeoJSONConstants.TYPE_LINE_STRING: var lineStringGeometry = new GeoJSONGeometryLineString( geometry[GeoJSONConstants.FIELD_COORDINATES], geometry[GeoJSONConstants.FIELD_TYPE], - geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs); - this.addRenderablesForLineString(layer, lineStringGeometry, properties ? properties : null); + geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs, + geometry[GeoJSONConstants.FIELD_BBOX]); + this.addRenderablesForLineString( + layer, + lineStringGeometry, + properties ? properties : null); break; case GeoJSONConstants.TYPE_MULTI_LINE_STRING: var multiLineStringGeometry = new GeoJSONGeometryMultiLineString( geometry[GeoJSONConstants.FIELD_COORDINATES], geometry[GeoJSONConstants.FIELD_TYPE], - geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs); - this.addRenderablesForMultiLineString(layer, multiLineStringGeometry, properties ? properties : null); + geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs, + geometry[GeoJSONConstants.FIELD_BBOX]); + this.addRenderablesForMultiLineString( + layer, + multiLineStringGeometry, + properties ? properties : null); break; case GeoJSONConstants.TYPE_POLYGON: var polygonGeometry = new GeoJSONGeometryPolygon( geometry[GeoJSONConstants.FIELD_COORDINATES], geometry[GeoJSONConstants.FIELD_TYPE], - geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs); - this.addRenderablesForPolygon(layer, polygonGeometry, properties ? properties : null); + geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs, + geometry[GeoJSONConstants.FIELD_BBOX] + ); + this.addRenderablesForPolygon( + layer, + polygonGeometry, + properties ? properties : null); break; case GeoJSONConstants.TYPE_MULTI_POLYGON: var multiPolygonGeometry = new GeoJSONGeometryMultiPolygon( geometry[GeoJSONConstants.FIELD_COORDINATES], geometry[GeoJSONConstants.FIELD_TYPE], - geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs); - this.addRenderablesForMultiPolygon(layer, multiPolygonGeometry, properties ? properties : null); + geometry[GeoJSONConstants.FIELD_CRS] ? geometry[GeoJSONConstants.FIELD_CRS] : crs, + geometry[GeoJSONConstants.FIELD_BBOX]); + this.addRenderablesForMultiPolygon( + layer, + multiPolygonGeometry, + properties ? properties : null); break; default: break; @@ -476,7 +506,10 @@ define(['../../error/ArgumentError', latitude = geometry.coordinates[1], altitude = geometry.coordinates[2] ? geometry.coordinates[2] : 0, position = new Position(latitude, longitude, altitude), - placemark = new Placemark(position, false, configuration && configuration.attributes ? configuration.attributes : null); + placemark = new Placemark( + position, + false, + configuration && configuration.attributes ? configuration.attributes : null); placemark.altitudeMode = WorldWind.RELATIVE_TO_GROUND; if (configuration && configuration.name){ @@ -505,12 +538,14 @@ define(['../../error/ArgumentError', GeoJSON.prototype.addRenderablesForMultiPoint = function (layer, geometry, properties) { if (!layer) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPoint", "missingLayer")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPoint", + "missingLayer")); } if (!geometry) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPoint", "missingGeometry")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPoint", + "missingGeometry")); } var configuration = this.shapeConfigurationCallback(geometry, properties); @@ -523,7 +558,10 @@ define(['../../error/ArgumentError', latitude = geometry.coordinates[pointIndex][1], altitude = geometry.coordinates[pointIndex][2] ? geometry.coordinates[pointIndex][2] : 0, position = new Position(latitude, longitude, altitude), - placemark = new Placemark(position, false, configuration && configuration.attributes ? configuration.attributes : null); + placemark = new Placemark( + position, + false, + configuration && configuration.attributes ? configuration.attributes : null); placemark.altitudeMode = WorldWind.RELATIVE_TO_GROUND; if (configuration && configuration.name){ placemark.label = configuration.name; @@ -552,12 +590,14 @@ define(['../../error/ArgumentError', GeoJSON.prototype.addRenderablesForLineString = function (layer, geometry, properties) { if (!layer) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForLineString", "missingLayer")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForLineString", + "missingLayer")); } if (!geometry) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForLineString", "missingGeometry")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForLineString", + "missingGeometry")); } var configuration = this.shapeConfigurationCallback(geometry, properties); @@ -576,7 +616,9 @@ define(['../../error/ArgumentError', } var shape; - shape = new SurfacePolyline(positions, configuration && configuration.attributes ? configuration.attributes : null); + shape = new SurfacePolyline( + positions, + configuration && configuration.attributes ? configuration.attributes : null); layer.addRenderable(shape); } else { @@ -600,12 +642,14 @@ define(['../../error/ArgumentError', GeoJSON.prototype.addRenderablesForMultiLineString = function (layer, geometry, properties) { if (!layer) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiLineString", "missingLayer")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiLineString", + "missingLayer")); } if (!geometry) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiLineString", "missingGeometry")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiLineString", + "missingGeometry")); } var configuration = this.shapeConfigurationCallback(geometry, properties); @@ -616,7 +660,8 @@ define(['../../error/ArgumentError', for (var linesIndex = 0, lines = geometry.coordinates; linesIndex < lines.length; linesIndex++) { var positions = []; - for (var positionIndex = 0, points = lines[linesIndex]; positionIndex < points.length; positionIndex++) { + for (var positionIndex = 0, points = lines[linesIndex]; positionIndex < points.length; + positionIndex++) { var longitude = points[positionIndex][0], latitude = points[positionIndex][1], //altitude = points[positionIndex][2] ? points[positionIndex][2] : 0, @@ -626,7 +671,9 @@ define(['../../error/ArgumentError', } var shape; - shape = new SurfacePolyline(positions, configuration && configuration.attributes ? configuration.attributes : null); + shape = new SurfacePolyline( + positions, + configuration && configuration.attributes ? configuration.attributes : null); layer.addRenderable(shape); } } @@ -664,10 +711,12 @@ define(['../../error/ArgumentError', if (geometry.crs === null || (geometry.crs.properties.hasOwnProperty(GeoJSONConstants.FIELD_NAME) && geometry.crs.properties[GeoJSONConstants.FIELD_NAME] === GeoJSONConstants.WGS84_CRS)) { - for (var boundariesIndex = 0, boundaries = geometry.coordinates; boundariesIndex < boundaries.length; boundariesIndex++) { + for (var boundariesIndex = 0, boundaries = geometry.coordinates; + boundariesIndex < boundaries.length; boundariesIndex++) { var positions = []; - for (var positionIndex = 0, points = boundaries[boundariesIndex]; positionIndex < points.length; positionIndex++) { + for (var positionIndex = 0, points = boundaries[boundariesIndex]; + positionIndex < points.length; positionIndex++) { var longitude = points[positionIndex][0], latitude = points[positionIndex][1], //altitude = points[positionIndex][2] ? points[positionIndex][2] : 0, @@ -677,7 +726,9 @@ define(['../../error/ArgumentError', } var shape; - shape = new SurfacePolygon(positions, configuration && configuration.attributes ? configuration.attributes : null); + shape = new SurfacePolygon( + positions, + configuration && configuration.attributes ? configuration.attributes : null); layer.addRenderable(shape); } } @@ -702,12 +753,14 @@ define(['../../error/ArgumentError', GeoJSON.prototype.addRenderablesForMultiPolygon = function (layer, geometry, properties) { if (!layer) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPolygon", "missingLayer")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPolygon", + "missingLayer")); } if (!geometry) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPolygon", "missingGeometry")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForMultiPolygon", + "missingGeometry")); } var configuration = this.shapeConfigurationCallback(geometry, properties); @@ -715,12 +768,14 @@ define(['../../error/ArgumentError', if (geometry.crs === null || (geometry.crs.properties.hasOwnProperty(GeoJSONConstants.FIELD_NAME) && geometry.crs.properties[GeoJSONConstants.FIELD_NAME] === GeoJSONConstants.WGS84_CRS)) { - for (var polygonsIndex = 0, polygons = geometry.coordinates; polygonsIndex < polygons.length; polygonsIndex++) { + for (var polygonsIndex = 0, polygons = geometry.coordinates; + polygonsIndex < polygons.length; polygonsIndex++) { var boundaries = [], position; for (var boundariesIndex = 0; boundariesIndex < polygons[polygonsIndex].length; boundariesIndex++) { var positions = []; - for (var positionIndex = 0, points = polygons[polygonsIndex][boundariesIndex]; positionIndex < points.length; positionIndex++) { + for (var positionIndex = 0, points = polygons[polygonsIndex][boundariesIndex]; + positionIndex < points.length; positionIndex++) { var longitude = points[positionIndex][0], latitude = points[positionIndex][1], //altitude = points[positionIndex][2] ? points[positionIndex][2] : 0,; @@ -730,7 +785,9 @@ define(['../../error/ArgumentError', boundaries.push(positions); } var shape; - shape = new SurfacePolygon(boundaries, configuration && configuration.attributes ? configuration.attributes : null); + shape = new SurfacePolygon( + boundaries, + configuration && configuration.attributes ? configuration.attributes : null); layer.addRenderable(shape); } } @@ -752,16 +809,19 @@ define(['../../error/ArgumentError', GeoJSON.prototype.addRenderablesForGeometryCollection = function (layer, geometryCollection, properties) { if (!layer) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForGeometryCollection", "missingLayer")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForGeometryCollection", + "missingLayer")); } if (!geometryCollection) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForGeometryCollection", "missingGeometryCollection")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForGeometryCollection", + "missingGeometryCollection")); } - for (var geometryIndex = 0, geometries = geometryCollection.geometries; geometryIndex < geometries.length; geometryIndex++) { + for (var geometryIndex = 0, geometries = geometryCollection.geometries; + geometryIndex < geometries.length; geometryIndex++) { if(geometries[geometryIndex].hasOwnProperty(GeoJSONConstants.FIELD_TYPE)){ this.addRenderablesForGeometry(layer, geometries[geometryIndex], null, properties); } @@ -825,12 +885,14 @@ define(['../../error/ArgumentError', GeoJSON.prototype.addRenderablesForFeatureCollection = function (layer, featureCollection) { if (!layer) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForFeatureCollection", "missingLayer")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForFeatureCollection", + "missingLayer")); } if (!featureCollection) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForFeatureCollection", "missingFeatureCollection")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSON", "addRenderablesForFeatureCollection", + "missingFeatureCollection")); } if (featureCollection.features.length > 0) { @@ -840,13 +902,14 @@ define(['../../error/ArgumentError', featureCollection.features[featureIndex][GeoJSONConstants.FIELD_GEOMETRY], featureCollection.features[featureIndex][GeoJSONConstants.FIELD_PROPERTIES], featureCollection.features[featureIndex][GeoJSONConstants.FIELD_CRS], - featureCollection.features[featureIndex][GeoJSONConstants.FIELD_ID]); + featureCollection.features[featureIndex][GeoJSONConstants.FIELD_ID], + featureCollection.features[featureIndex][GeoJSONConstants.FIELD_BBOX]); this.addRenderablesForFeature(layer, feature, featureCollection.crs); } } }; - // Intentionally not documented. + // Set type of GeoJSON object. Internal use ony. GeoJSON.prototype.setGeoJSONType = function (geoJSONObject) { switch (geoJSONObject[GeoJSONConstants.FIELD_TYPE]) { case GeoJSONConstants.TYPE_POINT: diff --git a/src/formats/geojson/GeoJSONCRS.js b/src/formats/geojson/GeoJSONCRS.js index 25c155154..38542d523 100644 --- a/src/formats/geojson/GeoJSONCRS.js +++ b/src/formats/geojson/GeoJSONCRS.js @@ -16,22 +16,35 @@ define(['../../error/ArgumentError', /** * Constructs a GeoJSON CRS object. Applications typically do not call this constructor. It is called by - * {@link GeoJSONGeometry} ,{@link GeoJSONFeature} or {@link GeoJSONGeometry}. + * {@link GeoJSONGeometry}, {@link GeoJSONGeometryCollection}, {@link GeoJSONFeature} or + * {@link GeoJSONFeatureCollection}. * @alias GeoJSONCRS * @constructor * @classdesc Contains the data associated with a GeoJSON Coordinate Reference System object. + * The coordinate reference system (CRS) of a GeoJSON object is determined by its "crs" member (referred to as + * the CRS object below). + * If an object has no crs member, then its parent or grandparent object's crs member may be acquired. + * If no crs member can be so acquired, the default CRS shall apply to the GeoJSON object. + * The default CRS is a geographic coordinate reference system, using the WGS84 datum, and with longitude and + * latitude units of decimal degrees. + *

+ * There are two types of CRS objects: + *

    + *
  • Named CRS
  • + *
  • Linked CRS
  • + *
+ * In this implementation we consider only named CRS. In this case, the value of its "type" member must be + * the string "name". The value of its "properties" member must be an object containing a "name" member. + * The value of that "name" member must be a string identifying a coordinate reference system. + * OGC CRS URNs such as "urn:ogc:def:crs:OGC:1.3:CRS84" shall be preferred over legacy identifiers + * such as "EPSG:4326". + *

+ * At the moment is implemented only "urn:ogc:def:crs:OGC:1.3:CRS84". * @param {String} type A string, indicating the type of CRS object. * @param {Object} properties An object containing the properties of CRS object. * @throws {ArgumentError} If the specified type or properties are null or undefined. */ var GeoJSONCRS = function (type, properties) { - /* - The coordinate reference system (CRS) of a GeoJSON object is determined by its "crs" member (referred to as the CRS object below). - If an object has no crs member, then its parent or grandparent object's crs member may be acquired. - If no crs member can be so acquired, the default CRS shall apply to the GeoJSON object. - The default CRS is a geographic coordinate reference system, using the WGS84 datum, and with longitude and latitude units of decimal degrees. - */ - if (!type) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONCRS", "constructor", @@ -66,7 +79,7 @@ define(['../../error/ArgumentError', /** * The GeoJSON CRS object properties as specified to this GeoJSON CRS's constructor. * @memberof GeoJSONCRS.prototype - * @type {String} + * @type {Object} * @readonly */ properties: { diff --git a/src/formats/geojson/GeoJSONFeature.js b/src/formats/geojson/GeoJSONFeature.js index d9e10a74a..cb397ac7f 100644 --- a/src/formats/geojson/GeoJSONFeature.js +++ b/src/formats/geojson/GeoJSONFeature.js @@ -21,17 +21,22 @@ define(['../../error/ArgumentError', * {@link GeoJSON} as GeoJSON is read. * @alias GeoJSONFeature * @constructor - * @classdesc Contains the data associated with a GeoJSON Feature Object. A feature object must have a member with the name "geometry". - * The value of the geometry member is a geometry object or a JSON null value.A feature object must have a member with the name "properties". + * @classdesc Contains the data associated with a GeoJSON Feature Object. + * A feature object must have a member with the name "geometry". + * The value of the geometry member is a geometry object or a JSON null value. + * A feature object must have a member with the name "properties". * The value of the properties member is an object (any JSON object or a JSON null value). - * If a feature has a commonly used identifier, that identifier should be included as a member of the feature object with the name "id". + * If a feature has a commonly used identifier, that identifier should be included as a member of the + * feature object with the name "id". + * To include information on the coordinate range for features, a GeoJSON object may have a member named "bbox". * @param {Object} geometry An object containing the value of GeoJSON geometry member. * @param {Object} properties An object containing the value of GeoJSON properties member. * @param {Object} crs An object containing the value of GeoJSON FeatureCollection or Feature crs member. * @param {Object} id An object containing the value of GeoJSON Feature id member. + * @param {Object} bbox An object containing the value of GeoJSON Feature bbox member. * @throws {ArgumentError} If the specified mandatory geometries or properties are null or undefined. */ - var GeoJSONFeature = function (geometry, properties, crs, id) { + var GeoJSONFeature = function (geometry, properties, crs, id, bbox) { if (!geometry) { throw new ArgumentError( @@ -58,10 +63,15 @@ define(['../../error/ArgumentError', this._properties = properties; // Documented in defineProperties below. - this._crs = crs ? new GeoJSONCRS(crs[GeoJSONConstants.FIELD_TYPE], crs[GeoJSONConstants.FIELD_PROPERTIES]) : null; + this._crs = crs ? new GeoJSONCRS( + crs[GeoJSONConstants.FIELD_TYPE], + crs[GeoJSONConstants.FIELD_PROPERTIES]) : null; // Documented in defineProperties below. this._id = id; + + // Documented in defineProperties below. + this._bbox = bbox; }; Object.defineProperties(GeoJSONFeature.prototype, { @@ -108,6 +118,17 @@ define(['../../error/ArgumentError', get: function () { return this._id; } + }, + /** + * The GeoJSON Feature bbox member as specified to this GeoJSONFeature's constructor. + * @memberof GeoJSONFeature.prototype + * @type {Object} + * @readonly + */ + bbox: { + get: function () { + return this._bbox; + } } }); diff --git a/src/formats/geojson/GeoJSONFeatureCollection.js b/src/formats/geojson/GeoJSONFeatureCollection.js index d5f7800a6..56110f9d0 100644 --- a/src/formats/geojson/GeoJSONFeatureCollection.js +++ b/src/formats/geojson/GeoJSONFeatureCollection.js @@ -17,18 +17,22 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON FeatureCollection object. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON is read. + * Constructs a GeoJSON FeatureCollection object. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON is read. * @alias GeoJSONFeatureCollection * @constructor * @classdesc Contains the data associated with a GeoJSON Feature Collection Object. * An object of type "FeatureCollection" must have a member with the name "features". - * The value corresponding to "features" is an array. Each element in the array is a feature object as defined in {@link GeoJSONFeature}. + * The value corresponding to "features" is an array. Each element in the array is a feature object as + * defined in {@link GeoJSONFeature}. + * To include information on the coordinate range for feature collections, a GeoJSON object may have a member + * named "bbox". * @param {Array} features An array containing the data associated with the GeoJSON FeatureCollection features. * @param {Object} crs An object containing the value of GeoJSON FeatureCollection crs member. + * @param {Object} bbox An object containing the value of GeoJSON FeatureCollection bbox member. * @throws {ArgumentError} If the specified mandatory features parameter is null or undefined. */ - var GeoJSONFeatureCollection = function (features, crs) { + var GeoJSONFeatureCollection = function (features, crs, bbox) { if (!features) { throw new ArgumentError( @@ -45,7 +49,12 @@ define(['../../error/ArgumentError', this._features = features; // Documented in defineProperties below. - this._crs = crs ? new GeoJSONCRS(crs[GeoJSONConstants.FIELD_TYPE], crs[GeoJSONConstants.FIELD_PROPERTIES]) : null; + this._crs = crs ? new GeoJSONCRS( + crs[GeoJSONConstants.FIELD_TYPE], + crs[GeoJSONConstants.FIELD_PROPERTIES]) : null; + + // Documented in defineProperties below. + this._bbox = bbox; }; Object.defineProperties(GeoJSONFeatureCollection.prototype, { @@ -70,6 +79,17 @@ define(['../../error/ArgumentError', get: function () { return this._crs; } + }, + /** + * The GeoJSON Collection bbox member as specified to this GeoJSONFeatureCollection's constructor. + * @memberof GeoJSONFeatureCollection.prototype + * @type {Object} + * @readonly + */ + bbox: { + get: function () { + return this._bbox; + } } }); diff --git a/src/formats/geojson/GeoJSONGeometry.js b/src/formats/geojson/GeoJSONGeometry.js index 1dea53ec4..094497569 100644 --- a/src/formats/geojson/GeoJSONGeometry.js +++ b/src/formats/geojson/GeoJSONGeometry.js @@ -19,14 +19,16 @@ define(['./GeoJSONConstants', * @constructor * @classdesc A geometry is a GeoJSON object where the type member's value is one of the following strings: * "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", or "GeometryCollection". - * A GeoJSON geometry object of any type other than "GeometryCollection" must have a member with the name "coordinates". - * The value of the coordinates member is always an array. The structure for the elements in this array is determined by the type of geometry. - * @param {Array} coordinates he array containing geometry coordinates. + * A GeoJSON geometry object of any type other than "GeometryCollection" must have a member with the name + * "coordinates". The value of the coordinates member is always an array. + * The structure for the elements in this array is determined by the type of geometry. + * @param {Array} coordinates An array containing geometry coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing the value of GeoJSON crs member. + * @param {Object} bbox An array containing information on the coordinate range for geometries. * @throws {ArgumentError} If the specified mandatory coordinates or type are null or undefined. */ - var GeoJSONGeometry = function (coordinates, type, crs) { + var GeoJSONGeometry = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -48,6 +50,9 @@ define(['./GeoJSONConstants', // Documented in defineProperties below. this._crs = crs ? new GeoJSONCRS(crs[GeoJSONConstants.FIELD_TYPE], crs[GeoJSONConstants.FIELD_PROPERTIES]) : null; + + // Documented in defineProperties below. + this._bbox = bbox ? bbox : null; }; Object.defineProperties(GeoJSONGeometry.prototype, { @@ -63,7 +68,18 @@ define(['./GeoJSONConstants', } }, /** - * The GeoJSON crs object. + * The GeoJSON geometry type as specified to this GeoJSONGeometry's constructor. + * @memberof GeoJSONGeometry.prototype + * @type {String} + * @readonly + */ + type: { + get: function () { + return this._type; + } + }, + /** + * The GeoJSON crs object as specified to this GeoJSONGeometry's constructor. * @memberof GeoJSONGeometry.prototype * @type {Object} * @readonly @@ -74,14 +90,14 @@ define(['./GeoJSONConstants', } }, /** - * The GeoJSON geometry type as specified to this GeoJSONGeometry's constructor. + * The GeoJSON bbox object as specified to this GeoJSONGeometry's constructor. * @memberof GeoJSONGeometry.prototype - * @type {String} + * @type {Object} * @readonly */ - type: { + bbox: { get: function () { - return this._type; + return this._bbox; } } }); diff --git a/src/formats/geojson/GeoJSONGeometryCollection.js b/src/formats/geojson/GeoJSONGeometryCollection.js index de88269bd..a1378359c 100644 --- a/src/formats/geojson/GeoJSONGeometryCollection.js +++ b/src/formats/geojson/GeoJSONGeometryCollection.js @@ -7,26 +7,31 @@ */ define(['../../error/ArgumentError', './GeoJSONConstants', + './GeoJSONCRS', '../../util/Logger' ], function (ArgumentError, GeoJSONConstants, + GeoJSONCRS, Logger) { "use strict"; /** - * Constructs a GeoJSON geometry for a GeometryCollection. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a GeometryCollection. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryCollection * @constructor * @classdesc Contains the data associated with a GeoJSON GeometryCollection geometry. * A geometry collection must have a member with the name "geometries". * The value corresponding to "geometries" is an array. Each element in this array is a GeoJSON geometry object. + * To include information on the coordinate range for features, a GeoJSON object may have a member named "bbox". * @param {Array} geometries The array containing GeoJSONGeometry objects. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified mandatory geometries is null or undefined or if the geometries parameter is not an array of GeoJSONGeometry. + * @param {Object} bbox An object containing the value of GeoJSON GeometryCollection bbox member. + * @throws {ArgumentError} If the specified mandatory geometries is null or undefined or if the geometries + * parameter is not an array of GeoJSONGeometry. */ - var GeoJSONGeometryCollection = function (geometries, crs) { + var GeoJSONGeometryCollection = function (geometries, crs, bbox) { if (!geometries) { throw new ArgumentError( Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryCollection", "constructor", @@ -43,7 +48,12 @@ define(['../../error/ArgumentError', this._geometries = geometries; // Documented in defineProperties below. - this._crs = crs ? crs : null; + this._crs = crs ? new GeoJSONCRS( + crs[GeoJSONConstants.FIELD_TYPE], + crs[GeoJSONConstants.FIELD_PROPERTIES]) : null; + + // Documented in defineProperties below. + this._bbox = bbox; }; Object.defineProperties(GeoJSONGeometryCollection.prototype, { @@ -68,6 +78,17 @@ define(['../../error/ArgumentError', get: function () { return this._crs; } + }, + /** + * The GeoJSON GeometryCollection bbox member as specified to this GeoJSONGeometryCollection's constructor. + * @memberof GeoJSONGeometryCollection.prototype + * @type {Object} + * @readonly + */ + bbox: { + get: function () { + return this._bbox; + } } }); diff --git a/src/formats/geojson/GeoJSONGeometryLineString.js b/src/formats/geojson/GeoJSONGeometryLineString.js index ab4aac319..743940d86 100644 --- a/src/formats/geojson/GeoJSONGeometryLineString.js +++ b/src/formats/geojson/GeoJSONGeometryLineString.js @@ -15,8 +15,8 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON geometry for a LineString. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a LineString. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryLineString * @constructor * @classdesc Contains the data associated with a GeoJSON LineString geometry. @@ -24,9 +24,11 @@ define(['../../error/ArgumentError', * @param {Array} coordinates The array containing LineString coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates parameter is not an array of two or more positions. + * @param {Object} bbox An object containing GeoJSON bbox information. + * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates + * parameter is not an array of two or more positions. */ - var GeoJSONGeometryLineString = function (coordinates, type, crs) { + var GeoJSONGeometryLineString = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -52,7 +54,7 @@ define(['../../error/ArgumentError', "missingType")); } - GeoJSONGeometry.call(this, coordinates, type, crs); + GeoJSONGeometry.call(this, coordinates, type, crs, bbox); }; GeoJSONGeometryLineString.prototype = Object.create(GeoJSONGeometry.prototype); diff --git a/src/formats/geojson/GeoJSONGeometryMultiLineString.js b/src/formats/geojson/GeoJSONGeometryMultiLineString.js index d9c90f960..43766b66f 100644 --- a/src/formats/geojson/GeoJSONGeometryMultiLineString.js +++ b/src/formats/geojson/GeoJSONGeometryMultiLineString.js @@ -15,8 +15,8 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON geometry for a MultiLineString. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a MultiLineString. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryMultiLineString * @constructor * @classdesc Contains the data associated with a GeoJSON MultiLineString geometry. @@ -24,9 +24,11 @@ define(['../../error/ArgumentError', * @param {Array} coordinates The array containing MultiLineString coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates parameter is not an array of LineString coordinates array. + * @param {Object} bbox An object containing GeoJSON bbox information. + * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates + * parameter is not an array of LineString coordinates array. */ - var GeoJSONGeometryMultiLineString = function (coordinates, type, crs) { + var GeoJSONGeometryMultiLineString = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -53,7 +55,7 @@ define(['../../error/ArgumentError', "missingType")); } - GeoJSONGeometry.call(this, coordinates, type, crs); + GeoJSONGeometry.call(this, coordinates, type, crs, bbox); }; GeoJSONGeometryMultiLineString.prototype = Object.create(GeoJSONGeometry.prototype); diff --git a/src/formats/geojson/GeoJSONGeometryMultiPoint.js b/src/formats/geojson/GeoJSONGeometryMultiPoint.js index 2d010e09e..280cf5247 100644 --- a/src/formats/geojson/GeoJSONGeometryMultiPoint.js +++ b/src/formats/geojson/GeoJSONGeometryMultiPoint.js @@ -15,8 +15,8 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON geometry for a MultiPoint. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a MultiPoint. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryMultiPoint * @constructor * @classdesc Contains the data associated with a GeoJSON MultiPoint geometry. @@ -24,9 +24,11 @@ define(['../../error/ArgumentError', * @param {Array} coordinates The array containing MultiPoint coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates parameter is not an array of positions. + * @param {Object} bbox An object containing GeoJSON bbox information. + * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates + * parameter is not an array of positions. */ - var GeoJSONGeometryMultiPoint = function (coordinates, type, crs) { + var GeoJSONGeometryMultiPoint = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -52,7 +54,7 @@ define(['../../error/ArgumentError', "missingType")); } - GeoJSONGeometry.call(this, coordinates, type, crs); + GeoJSONGeometry.call(this, coordinates, type, crs, bbox); }; GeoJSONGeometryMultiPoint.prototype = Object.create(GeoJSONGeometry.prototype); diff --git a/src/formats/geojson/GeoJSONGeometryMultiPolygon.js b/src/formats/geojson/GeoJSONGeometryMultiPolygon.js index 9eaccd628..f8534d4bb 100644 --- a/src/formats/geojson/GeoJSONGeometryMultiPolygon.js +++ b/src/formats/geojson/GeoJSONGeometryMultiPolygon.js @@ -15,8 +15,8 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON geometry for a MultiPolygon. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a MultiPolygon. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryMultiPolygon * @constructor * @classdesc Contains the data associated with a GeoJSON MultiPolygon geometry. @@ -24,9 +24,11 @@ define(['../../error/ArgumentError', * @param {Array} coordinates The array containing MultiPolygon coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates parameter is not an array of Polygon coordinate arrays. + * @param {Object} bbox An object containing GeoJSON bbox information. + * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates + * parameter is not an array of Polygon coordinate arrays. */ - var GeoJSONGeometryMultiPolygon = function (coordinates, type, crs) { + var GeoJSONGeometryMultiPolygon = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -39,7 +41,8 @@ define(['../../error/ArgumentError', Object.prototype.toString.call(coordinates[0][0][0]) !== '[object Array]' || Object.prototype.toString.call(coordinates[0][0][0][0]) !== '[object Number]') { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryPolygon", "constructor", "invalidCoordinatesType")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryPolygon", "constructor", + "invalidCoordinatesType")); } if (!type) { @@ -48,7 +51,7 @@ define(['../../error/ArgumentError', "missingType")); } - GeoJSONGeometry.call(this, coordinates, type, crs); + GeoJSONGeometry.call(this, coordinates, type, crs, bbox); }; GeoJSONGeometryMultiPolygon.prototype = Object.create(GeoJSONGeometry.prototype); diff --git a/src/formats/geojson/GeoJSONGeometryPoint.js b/src/formats/geojson/GeoJSONGeometryPoint.js index ac6aa4243..87d2ca9c9 100644 --- a/src/formats/geojson/GeoJSONGeometryPoint.js +++ b/src/formats/geojson/GeoJSONGeometryPoint.js @@ -17,8 +17,8 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON geometry for a Point. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a Point. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryPoint * @constructor * @classdesc Contains the data associated with a GeoJSON Point geometry. @@ -26,9 +26,11 @@ define(['../../error/ArgumentError', * @param {Array} coordinates The array containing Point coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates parameter is not a single position. + * @param {Object} bbox An object containing GeoJSON bbox information. + * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates + * parameter is not a single position. */ - var GeoJSONGeometryPoint = function (coordinates, type, crs) { + var GeoJSONGeometryPoint = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -54,7 +56,7 @@ define(['../../error/ArgumentError', "missingType")); } - GeoJSONGeometry.call(this, coordinates, type, crs); + GeoJSONGeometry.call(this, coordinates, type, crs, bbox); }; GeoJSONGeometryPoint.prototype = Object.create(GeoJSONGeometry.prototype); diff --git a/src/formats/geojson/GeoJSONGeometryPolygon.js b/src/formats/geojson/GeoJSONGeometryPolygon.js index 36fdb4546..8a037e044 100644 --- a/src/formats/geojson/GeoJSONGeometryPolygon.js +++ b/src/formats/geojson/GeoJSONGeometryPolygon.js @@ -15,8 +15,8 @@ define(['../../error/ArgumentError', "use strict"; /** - * Constructs a GeoJSON geometry for a Polygon. Applications typically do not call this constructor. It is called by - * {@link GeoJSON} as GeoJSON geometries are read. + * Constructs a GeoJSON geometry for a Polygon. Applications typically do not call this constructor. + * It is called by {@link GeoJSON} as GeoJSON geometries are read. * @alias GeoJSONGeometryPolygon * @constructor * @classdesc Contains the data associated with a GeoJSON Polygon geometry. @@ -24,9 +24,11 @@ define(['../../error/ArgumentError', * @param {Array} coordinates The array containing Polygon coordinates. * @param {String} type A string containing type of geometry. * @param {Object} crs An object containing GeoJSON CRS information. - * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the coordinates parameter is not an array of LinearRing coordinate arrays. + * @param {Object} bbox An object containing GeoJSON bbox information. + * @throws {ArgumentError} If the specified coordinates or type are null or undefined or if the + * coordinates parameter is not an array of LinearRing coordinate arrays. */ - var GeoJSONGeometryPolygon = function (coordinates, type, crs) { + var GeoJSONGeometryPolygon = function (coordinates, type, crs, bbox) { if (!coordinates) { throw new ArgumentError( @@ -44,12 +46,14 @@ define(['../../error/ArgumentError', Object.prototype.toString.call(coordinates[0][0]) !== '[object Array]' || Object.prototype.toString.call(coordinates[0][0][0]) !== '[object Number]') { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryPolygon", "constructor", "invalidCoordinatesType")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryPolygon", "constructor", + "invalidCoordinatesType")); } if (coordinates[0][0] !== coordinates[0][coordinates.length - 1]) { throw new ArgumentError( - Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryPolygon", "constructor", "invalidLinearRing")); + Logger.logMessage(Logger.LEVEL_SEVERE, "GeoJSONGeometryPolygon", "constructor", + "invalidLinearRing")); } if (!type) { @@ -58,7 +62,7 @@ define(['../../error/ArgumentError', "missingType")); } - GeoJSONGeometry.call(this, coordinates, type, crs); + GeoJSONGeometry.call(this, coordinates, type, crs, bbox); }; GeoJSONGeometryPolygon.prototype = Object.create(GeoJSONGeometry.prototype);