From 4eb6603af72f8efd351bc6fcce121cb4ba659b95 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 15:51:16 -0600 Subject: [PATCH 01/16] Move ReadOptions to ol/format/Feature --- externs/olx.js | 39 ------------------------------ externs/xol.js | 14 ----------- src/ol/format/EsriJSON.js | 8 +++--- src/ol/format/Feature.js | 32 ++++++++++++++++++------ src/ol/format/GMLBase.js | 2 +- src/ol/format/GPX.js | 10 ++++---- src/ol/format/GeoJSON.js | 10 ++++---- src/ol/format/IGC.js | 4 +-- src/ol/format/JSONFeature.js | 6 ++--- src/ol/format/KML.js | 6 ++--- src/ol/format/MVT.js | 2 +- src/ol/format/OSMXML.js | 4 +-- src/ol/format/Polyline.js | 6 ++--- src/ol/format/TextFeature.js | 6 ++--- src/ol/format/TopoJSON.js | 4 +-- src/ol/format/WFS.js | 2 +- src/ol/format/WKT.js | 6 ++--- src/ol/format/WMSGetFeatureInfo.js | 2 +- src/ol/format/XMLFeature.js | 12 ++++----- src/ol/interaction/DragAndDrop.js | 2 +- 20 files changed, 70 insertions(+), 107 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 5fb451c4d9..314e997797 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,45 +5,6 @@ let olx; -/** - * @typedef {{dataProjection: ol.ProjectionLike, - * extent: (ol.Extent|undefined), - * featureProjection: ol.ProjectionLike, - * rightHanded: (boolean|undefined)}} - */ -olx.format.ReadOptions; - - -/** - * Projection of the data we are reading. If not provided, the projection will - * be derived from the data (where possible) or the `defaultDataProjection` of - * the format is assigned (where set). If the projection can not be derived from - * the data and if no `defaultDataProjection` is set for a format, the features - * will not be reprojected. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.ReadOptions.prototype.dataProjection; - - -/** - * Tile extent of the tile being read. This is only used and required for - * {@link ol.format.MVT}. - * @type {ol.Extent} - * @api - */ -olx.format.ReadOptions.prototype.extent; - - -/** - * Projection of the feature geometries created by the format reader. If not - * provided, features will be returned in the `dataProjection`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.ReadOptions.prototype.featureProjection; - - /** * @typedef {{dataProjection: ol.ProjectionLike, * featureProjection: ol.ProjectionLike, diff --git a/externs/xol.js b/externs/xol.js index 3869f024f6..f4e5670752 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,18 +1,4 @@ -/** - * @typedef {Object} format_ReadOptions - * @property {ol.ProjectionLike} dataProjection Projection of the data we are reading. If not provided, the projection will - * be derived from the data (where possible) or the `defaultDataProjection` of - * the format is assigned (where set). If the projection can not be derived from - * the data and if no `defaultDataProjection` is set for a format, the features - * will not be reprojected. - * @property {ol.Extent} extent Tile extent of the tile being read. This is only used and required for - * {@link ol.format.MVT}. - * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries created by the format reader. If not - * provided, features will be returned in the `dataProjection`. - */ - - /** * @typedef {Object} format_WriteOptions * @property {ol.ProjectionLike} dataProjection Projection of the data we are writing. If not provided, the diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index a0afd0c536..48635a8aae 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -77,7 +77,7 @@ inherits(EsriJSON, JSONFeature); /** * @param {EsriJSONGeometry} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ function readGeometry(object, opt_options) { @@ -405,7 +405,7 @@ function writeMultiPolygonGeometry(geometry, opt_options) { * * @function * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -418,7 +418,7 @@ EsriJSON.prototype.readFeature; * * @function * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -474,7 +474,7 @@ EsriJSON.prototype.readFeaturesFromObject = function(object, opt_options) { * * @function * @param {ArrayBuffer|Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index b28acc098d..aac9e7b364 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -5,6 +5,22 @@ import Geometry from '../geom/Geometry.js'; import {assign} from '../obj.js'; import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js'; + +/** + * @typedef {Object} ReadOptions + * @property {ol.ProjectionLike} dataProjection Projection of the data we are reading. + * If not provided, the projection will be derived from the data (where possible) or + * the `defaultDataProjection` of the format is assigned (where set). If the projection + * can not be derived from the data and if no `defaultDataProjection` is set for a format, + * the features will not be reprojected. + * @property {ol.Extent} extent Tile extent of the tile being read. This is only used and + * required for {@link ol.format.MVT}. + * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries + * created by the format reader. If not provided, features will be returned in the + * `dataProjection`. + */ + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -38,8 +54,8 @@ const FeatureFormat = function() { /** * Adds the data projection to the read options. * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. - * @return {olx.format.ReadOptions|undefined} Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. + * @return {module:ol/format/Feature~ReadOptions|undefined} Options. * @protected */ FeatureFormat.prototype.getReadOptions = function(source, opt_options) { @@ -58,10 +74,10 @@ FeatureFormat.prototype.getReadOptions = function(source, opt_options) { /** * Sets the `defaultDataProjection` on the options, if no `dataProjection` * is set. - * @param {olx.format.WriteOptions|olx.format.ReadOptions|undefined} options + * @param {olx.format.WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options * Options. * @protected - * @return {olx.format.WriteOptions|olx.format.ReadOptions|undefined} + * @return {olx.format.WriteOptions|module:ol/format/Feature~ReadOptions|undefined} * Updated options. */ FeatureFormat.prototype.adaptOptions = function(options) { @@ -93,7 +109,7 @@ FeatureFormat.prototype.getType = function() {}; * * @abstract * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. */ FeatureFormat.prototype.readFeature = function(source, opt_options) {}; @@ -104,7 +120,7 @@ FeatureFormat.prototype.readFeature = function(source, opt_options) {}; * * @abstract * @param {Document|Node|ArrayBuffer|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. */ FeatureFormat.prototype.readFeatures = function(source, opt_options) {}; @@ -115,7 +131,7 @@ FeatureFormat.prototype.readFeatures = function(source, opt_options) {}; * * @abstract * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ FeatureFormat.prototype.readGeometry = function(source, opt_options) {}; @@ -168,7 +184,7 @@ export default FeatureFormat; /** * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {boolean} write Set to true for writing, false for reading. - * @param {(olx.format.WriteOptions|olx.format.ReadOptions)=} opt_options + * @param {(olx.format.WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options * Options. * @return {ol.geom.Geometry|module:ol/extent~Extent} Transformed geometry. */ diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index ccee933ae3..ed74e076b1 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -540,7 +540,7 @@ GMLBase.prototype.readGeometryFromNode = function(node, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index d363cfc62d..21f4698e56 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -522,7 +522,7 @@ function parseTrkSeg(node, objectStack) { * @return {ol.Feature|undefined} Track. */ function readRte(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const values = pushParseAndPop({ 'flatCoordinates': [], 'layoutOptions': {} @@ -551,7 +551,7 @@ function readRte(node, objectStack) { * @return {ol.Feature|undefined} Track. */ function readTrk(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const values = pushParseAndPop({ 'flatCoordinates': [], 'ends': [], @@ -583,7 +583,7 @@ function readTrk(node, objectStack) { * @return {ol.Feature|undefined} Waypoint. */ function readWpt(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const values = pushParseAndPop({}, WPT_PARSERS, node, objectStack); if (!values) { return undefined; @@ -625,7 +625,7 @@ GPX.prototype.handleReadExtensions_ = function(features) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -659,7 +659,7 @@ GPX.prototype.readFeatureFromNode = function(node, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 3a1a0aa423..5873ac9b71 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -98,7 +98,7 @@ const GEOMETRY_WRITERS = { /** * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. */ function readGeometry(object, opt_options) { @@ -114,7 +114,7 @@ function readGeometry(object, opt_options) { /** * @param {GeoJSONGeometryCollection} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.GeometryCollection} Geometry collection. */ function readGeometryCollectionGeometry(object, opt_options) { @@ -320,7 +320,7 @@ function writePolygonGeometry(geometry, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -334,7 +334,7 @@ GeoJSON.prototype.readFeature; * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -402,7 +402,7 @@ GeoJSON.prototype.readFeaturesFromObject = function(object, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index 04174e8f9c..b4b493958e 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -85,7 +85,7 @@ const NEWLINE_RE = /\r\n|\r|\n/; * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -175,7 +175,7 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/JSONFeature.js b/src/ol/format/JSONFeature.js index a51a1d923e..f8debdc686 100644 --- a/src/ol/format/JSONFeature.js +++ b/src/ol/format/JSONFeature.js @@ -67,7 +67,7 @@ JSONFeature.prototype.readFeatures = function(source, opt_options) { /** * @abstract * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.Feature} Feature. */ @@ -77,7 +77,7 @@ JSONFeature.prototype.readFeatureFromObject = function(object, opt_options) {}; /** * @abstract * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {Array.} Features. */ @@ -96,7 +96,7 @@ JSONFeature.prototype.readGeometry = function(source, opt_options) { /** * @abstract * @param {Object} object Object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.geom.Geometry} Geometry. */ diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 10ff2878eb..7fc23d2e04 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -1678,7 +1678,7 @@ KML.prototype.readPlacemark_ = function(node, objectStack) { if (id !== null) { feature.setId(id); } - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const geometry = object['geometry']; if (geometry) { @@ -1768,7 +1768,7 @@ KML.prototype.readSharedStyleMap_ = function(node, objectStack) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -1799,7 +1799,7 @@ KML.prototype.readFeatureFromNode = function(node, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 9047aa2d09..3e42fc0738 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -279,7 +279,7 @@ function getGeometryType(type, numEnds) { * @private * @param {ol.ext.PBF} pbf PBF * @param {Object} rawFeature Raw Mapbox feature. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature|ol.render.Feature} Feature. */ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index 0469f03563..353935ae0e 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -80,7 +80,7 @@ const NODE_PARSERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function readNode(node, objectStack) { - const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~ReadOptions} */ (objectStack[0]); const state = /** @type {Object} */ (objectStack[objectStack.length - 1]); const id = node.getAttribute('id'); /** @type {module:ol/coordinate~Coordinate} */ @@ -145,7 +145,7 @@ function readTag(node, objectStack) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index d185b33d9d..543c29adb9 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -262,7 +262,7 @@ export function encodeUnsignedInteger(num) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -284,7 +284,7 @@ Polyline.prototype.readFeatureFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -305,7 +305,7 @@ Polyline.prototype.readFeaturesFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index d2fdbe117d..601c91cb1b 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -54,7 +54,7 @@ TextFeature.prototype.readFeature = function(source, opt_options) { /** * @abstract * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.Feature} Feature. */ @@ -72,7 +72,7 @@ TextFeature.prototype.readFeatures = function(source, opt_options) { /** * @abstract * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {Array.} Features. */ @@ -90,7 +90,7 @@ TextFeature.prototype.readGeometry = function(source, opt_options) { /** * @abstract * @param {string} text Text. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @protected * @return {ol.geom.Geometry} Geometry. */ diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index f061718d04..70596f6750 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -216,7 +216,7 @@ function readMultiPolygonGeometry(object, arcs) { * @param {string|undefined} property Property to set the `GeometryCollection`'s parent * object to. * @param {string} name Name of the `Topology`'s child object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Array of features. */ function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) { @@ -240,7 +240,7 @@ function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, * @param {string|undefined} property Property to set the `GeometryCollection`'s parent * object to. * @param {string} name Name of the `Topology`'s child object. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. */ function readFeatureFromGeometry(object, arcs, scale, translate, property, name, opt_options) { diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 30dafcbf97..6b8772bcfd 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -132,7 +132,7 @@ WFS.prototype.setFeatureType = function(featureType) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index aff1f9948a..6f92076cfd 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -718,7 +718,7 @@ WKT.prototype.parse_ = function(wkt) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.Feature} Feature. * @api */ @@ -744,7 +744,7 @@ WKT.prototype.readFeatureFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {Array.} Features. * @api */ @@ -779,7 +779,7 @@ WKT.prototype.readFeaturesFromText = function(text, opt_options) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Read options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Read options. * @return {ol.geom.Geometry} Geometry. * @api */ diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index 79e47e3fd1..f4d73bb584 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -143,7 +143,7 @@ WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) { * * @function * @param {Document|Node|Object|string} source Source. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {Array.} Features. * @api */ diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index 33efdf772e..963a9f2659 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -58,7 +58,7 @@ XMLFeature.prototype.readFeature = function(source, opt_options) { /** * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {ol.Feature} Feature. */ XMLFeature.prototype.readFeatureFromDocument = function(doc, opt_options) { @@ -73,7 +73,7 @@ XMLFeature.prototype.readFeatureFromDocument = function(doc, opt_options) { /** * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @return {ol.Feature} Feature. */ XMLFeature.prototype.readFeatureFromNode = function(node, opt_options) { @@ -101,7 +101,7 @@ XMLFeature.prototype.readFeatures = function(source, opt_options) { /** * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {Array.} Features. */ @@ -120,7 +120,7 @@ XMLFeature.prototype.readFeaturesFromDocument = function(doc, opt_options) { /** * @abstract * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {Array.} Features. */ @@ -147,7 +147,7 @@ XMLFeature.prototype.readGeometry = function(source, opt_options) { /** * @param {Document} doc Document. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {ol.geom.Geometry} Geometry. */ @@ -158,7 +158,7 @@ XMLFeature.prototype.readGeometryFromDocument = function(doc, opt_options) { /** * @param {Node} node Node. - * @param {olx.format.ReadOptions=} opt_options Options. + * @param {module:ol/format/Feature~ReadOptions=} opt_options Options. * @protected * @return {ol.geom.Geometry} Geometry. */ diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index ee20fb4e1a..4160e2d633 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -236,7 +236,7 @@ DragAndDrop.prototype.setMap = function(map) { /** * @param {ol.format.Feature} format Format. * @param {string} text Text. - * @param {olx.format.ReadOptions} options Read options. + * @param {module:ol/format/Feature~ReadOptions} options Read options. * @private * @return {Array.} Features. */ From 8eaee5618e0246b502772e35aaef51cd16464f5e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 15:55:48 -0600 Subject: [PATCH 02/16] Move WriteOptions to ol/format/Feature --- externs/olx.js | 60 ------------------------------------ externs/xol.js | 28 ----------------- src/ol/format/EsriJSON.js | 28 ++++++++--------- src/ol/format/Feature.js | 38 +++++++++++++++++++---- src/ol/format/GML.js | 4 +-- src/ol/format/GML2.js | 2 +- src/ol/format/GML3.js | 8 ++--- src/ol/format/GPX.js | 10 +++--- src/ol/format/GeoJSON.js | 30 +++++++++--------- src/ol/format/JSONFeature.js | 6 ++-- src/ol/format/KML.js | 6 ++-- src/ol/format/Polyline.js | 2 +- src/ol/format/TextFeature.js | 6 ++-- src/ol/format/WKT.js | 6 ++-- src/ol/format/XMLFeature.js | 6 ++-- 15 files changed, 89 insertions(+), 151 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 314e997797..72e1408807 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,66 +5,6 @@ let olx; -/** - * @typedef {{dataProjection: ol.ProjectionLike, - * featureProjection: ol.ProjectionLike, - * rightHanded: (boolean|undefined), - * decimals: (number|undefined)}} - */ -olx.format.WriteOptions; - - -/** - * Projection of the data we are writing. If not provided, the - * `defaultDataProjection` of the format is assigned (where set). If no - * `defaultDataProjection` is set for a format, the features will be returned - * in the `featureProjection`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.WriteOptions.prototype.dataProjection; - - -/** - * Projection of the feature geometries that will be serialized by the format - * writer. If not provided, geometries are assumed to be in the - * `dataProjection` if that is set; in other words, they are not transformed. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.WriteOptions.prototype.featureProjection; - - -/** - * When writing geometries, follow the right-hand rule for linear ring - * orientation. This means that polygons will have counter-clockwise exterior - * rings and clockwise interior rings. By default, coordinates are serialized - * as they are provided at construction. If `true`, the right-hand rule will - * be applied. If `false`, the left-hand rule will be applied (clockwise for - * exterior and counter-clockwise for interior rings). Note that not all - * formats support this. The GeoJSON format does use this property when writing - * geometries. - * - * @type {boolean|undefined} - * @api - */ -olx.format.WriteOptions.prototype.rightHanded; - - -/** - * Maximum number of decimal places for coordinates. Coordinates are stored - * internally as floats, but floating-point arithmetic can create coordinates - * with a large number of decimal places, not generally wanted on output. - * Set a number here to round coordinates. Can also be used to ensure that - * coordinates read in can be written back out with the same number of decimals. - * Default is no rounding. - * - * @type {number|undefined} - * @api - */ -olx.format.WriteOptions.prototype.decimals; - - /** * @typedef {{defaultDataProjection: ol.ProjectionLike, * geometryName: (string|undefined), diff --git a/externs/xol.js b/externs/xol.js index f4e5670752..b7d8186602 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,32 +1,4 @@ -/** - * @typedef {Object} format_WriteOptions - * @property {ol.ProjectionLike} dataProjection Projection of the data we are writing. If not provided, the - * `defaultDataProjection` of the format is assigned (where set). If no - * `defaultDataProjection` is set for a format, the features will be returned - * in the `featureProjection`. - * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries that will be serialized by the format - * writer. If not provided, geometries are assumed to be in the - * `dataProjection` if that is set; in other words, they are not transformed. - * @property {boolean|undefined} rightHanded When writing geometries, follow the right-hand rule for linear ring - * orientation. This means that polygons will have counter-clockwise exterior - * rings and clockwise interior rings. By default, coordinates are serialized - * as they are provided at construction. If `true`, the right-hand rule will - * be applied. If `false`, the left-hand rule will be applied (clockwise for - * exterior and counter-clockwise for interior rings). Note that not all - * formats support this. The GeoJSON format does use this property when writing - * geometries. - * - * @property {number|undefined} decimals Maximum number of decimal places for coordinates. Coordinates are stored - * internally as floats, but floating-point arithmetic can create coordinates - * with a large number of decimal places, not generally wanted on output. - * Set a number here to round coordinates. Can also be used to ensure that - * coordinates read in can be written back out with the same number of decimals. - * Default is no rounding. - * - */ - - /** * @typedef {Object} format_GeoJSONOptions * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 48635a8aae..004c471f7f 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -37,7 +37,7 @@ GEOMETRY_READERS[GeometryType.MULTI_POLYGON] = readMultiPolygonGeometry; /** * @const - * @type {Object.} + * @type {Object.} */ const GEOMETRY_WRITERS = {}; GEOMETRY_WRITERS[GeometryType.POINT] = writePointGeometry; @@ -261,7 +261,7 @@ function readPolygonGeometry(object) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONGeometry} EsriJSON geometry. */ function writePointGeometry(geometry, opt_options) { @@ -316,7 +316,7 @@ function getHasZM(geometry) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONPolyline} EsriJSON geometry. */ function writeLineStringGeometry(geometry, opt_options) { @@ -333,7 +333,7 @@ function writeLineStringGeometry(geometry, opt_options) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONPolygon} EsriJSON geometry. */ function writePolygonGeometry(geometry, opt_options) { @@ -349,7 +349,7 @@ function writePolygonGeometry(geometry, opt_options) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONPolyline} EsriJSON geometry. */ function writeMultiLineStringGeometry(geometry, opt_options) { @@ -364,7 +364,7 @@ function writeMultiLineStringGeometry(geometry, opt_options) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONMultipoint} EsriJSON geometry. */ function writeMultiPointGeometry(geometry, opt_options) { @@ -379,7 +379,7 @@ function writeMultiPointGeometry(geometry, opt_options) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONPolygon} EsriJSON geometry. */ function writeMultiPolygonGeometry(geometry, opt_options) { @@ -516,7 +516,7 @@ EsriJSON.prototype.readProjectionFromObject = function(object) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONGeometry} EsriJSON geometry. */ function writeGeometry(geometry, opt_options) { @@ -531,7 +531,7 @@ function writeGeometry(geometry, opt_options) { * * @function * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} EsriJSON. * @api */ @@ -542,7 +542,7 @@ EsriJSON.prototype.writeGeometry; * Encode a geometry as a EsriJSON object. * * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {EsriJSONGeometry} Object. * @override * @api @@ -557,7 +557,7 @@ EsriJSON.prototype.writeGeometryObject = function(geometry, opt_options) { * * @function * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} EsriJSON. * @api */ @@ -568,7 +568,7 @@ EsriJSON.prototype.writeFeature; * Encode a feature as a esriJSON Feature object. * * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} Object. * @override * @api @@ -601,7 +601,7 @@ EsriJSON.prototype.writeFeatureObject = function(feature, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} EsriJSON. * @api */ @@ -612,7 +612,7 @@ EsriJSON.prototype.writeFeatures; * Encode an array of features as a EsriJSON object. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} EsriJSON Object. * @override * @api diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index aac9e7b364..225487e5b5 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -21,6 +21,32 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten */ +/** + * @typedef {Object} WriteOptions + * @property {ol.ProjectionLike} dataProjection Projection of the data we are writing. + * If not provided, the `defaultDataProjection` of the format is assigned (where set). + * If no `defaultDataProjection` is set for a format, the features will be returned + * in the `featureProjection`. + * @property {ol.ProjectionLike} featureProjection Projection of the feature geometries + * that will be serialized by the format writer. If not provided, geometries are assumed + * to be in the `dataProjection` if that is set; in other words, they are not transformed. + * @property {boolean|undefined} rightHanded When writing geometries, follow the right-hand + * rule for linear ring orientation. This means that polygons will have counter-clockwise + * exterior rings and clockwise interior rings. By default, coordinates are serialized + * as they are provided at construction. If `true`, the right-hand rule will + * be applied. If `false`, the left-hand rule will be applied (clockwise for + * exterior and counter-clockwise for interior rings). Note that not all + * formats support this. The GeoJSON format does use this property when writing + * geometries. + * @property {number|undefined} decimals Maximum number of decimal places for coordinates. + * Coordinates are stored internally as floats, but floating-point arithmetic can create + * coordinates with a large number of decimal places, not generally wanted on output. + * Set a number here to round coordinates. Can also be used to ensure that + * coordinates read in can be written back out with the same number of decimals. + * Default is no rounding. + */ + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -74,10 +100,10 @@ FeatureFormat.prototype.getReadOptions = function(source, opt_options) { /** * Sets the `defaultDataProjection` on the options, if no `dataProjection` * is set. - * @param {olx.format.WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options + * @param {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} options * Options. * @protected - * @return {olx.format.WriteOptions|module:ol/format/Feature~ReadOptions|undefined} + * @return {module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions|undefined} * Updated options. */ FeatureFormat.prototype.adaptOptions = function(options) { @@ -152,7 +178,7 @@ FeatureFormat.prototype.readProjection = function(source) {}; * * @abstract * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Result. */ FeatureFormat.prototype.writeFeature = function(feature, opt_options) {}; @@ -163,7 +189,7 @@ FeatureFormat.prototype.writeFeature = function(feature, opt_options) {}; * * @abstract * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Result. */ FeatureFormat.prototype.writeFeatures = function(features, opt_options) {}; @@ -174,7 +200,7 @@ FeatureFormat.prototype.writeFeatures = function(features, opt_options) {}; * * @abstract * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Result. */ FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {}; @@ -184,7 +210,7 @@ export default FeatureFormat; /** * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {boolean} write Set to true for writing, false for reading. - * @param {(olx.format.WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options + * @param {(module:ol/format/Feature~WriteOptions|module:ol/format/Feature~ReadOptions)=} opt_options * Options. * @return {ol.geom.Geometry|module:ol/extent~Extent} Transformed geometry. */ diff --git a/src/ol/format/GML.js b/src/ol/format/GML.js index 88a8913ddc..cce96b29b0 100644 --- a/src/ol/format/GML.js +++ b/src/ol/format/GML.js @@ -23,7 +23,7 @@ const GML = GML3; * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {string} Result. * @api */ @@ -35,7 +35,7 @@ GML.prototype.writeFeatures; * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @api */ diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 0d1b58a6c0..99aa6ee518 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -282,7 +282,7 @@ GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta * @param {Array.<*>} objectStack Node stack. */ GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) { - const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); + const context = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[objectStack.length - 1]); const item = assign({}, context); item.node = node; let value; diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index de128fb730..44645869db 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -940,7 +940,7 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) { * @param {Array.<*>} objectStack Node stack. */ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) { - const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); + const context = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[objectStack.length - 1]); const item = assign({}, context); item.node = node; let value; @@ -1097,7 +1097,7 @@ GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam * Encode a geometry in GML 3.1.1 Simple Features. * * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api @@ -1121,7 +1121,7 @@ GML3.prototype.writeGeometryNode = function(geometry, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {string} Result. * @api */ @@ -1132,7 +1132,7 @@ GML3.prototype.writeFeatures; * Encode an array of features in the GML 3.1.1 format as an XML node. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 21f4698e56..7f96a94098 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -768,7 +768,7 @@ function writeWptType(node, coordinate, objectStack) { * @param {Array.<*>} objectStack Object stack. */ function writeRte(node, feature, objectStack) { - const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]); const properties = feature.getProperties(); const context = {node: node, 'properties': properties}; let geometry = feature.getGeometry(); @@ -792,7 +792,7 @@ function writeRte(node, feature, objectStack) { * @param {Array.<*>} objectStack Object stack. */ function writeTrk(node, feature, objectStack) { - const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]); const properties = feature.getProperties(); /** @type {module:ol/xml~NodeStackItem} */ const context = {node: node, 'properties': properties}; @@ -832,7 +832,7 @@ function writeTrkSeg(node, lineString, objectStack) { * @param {Array.<*>} objectStack Object stack. */ function writeWpt(node, feature, objectStack) { - const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]); const context = objectStack[objectStack.length - 1]; context['properties'] = feature.getProperties(); let geometry = feature.getGeometry(); @@ -852,7 +852,7 @@ function writeWpt(node, feature, objectStack) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Result. * @api */ @@ -865,7 +865,7 @@ GPX.prototype.writeFeatures; * as tracks (``). * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 5873ac9b71..28e98919ff 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -82,7 +82,7 @@ const GEOMETRY_READERS = { /** * @const - * @type {Object.} + * @type {Object.} */ const GEOMETRY_WRITERS = { 'Point': writePointGeometry, @@ -186,7 +186,7 @@ function readPolygonGeometry(object) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} GeoJSON geometry. */ function writeGeometry(geometry, opt_options) { @@ -210,7 +210,7 @@ function writeEmptyGeometryCollectionGeometry(geometry) { /** * @param {ol.geom.GeometryCollection} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometryCollection} GeoJSON geometry collection. */ function writeGeometryCollectionGeometry(geometry, opt_options) { @@ -228,7 +228,7 @@ function writeGeometryCollectionGeometry(geometry, opt_options) { /** * @param {ol.geom.LineString} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry} GeoJSON geometry. */ function writeLineStringGeometry(geometry, opt_options) { @@ -241,7 +241,7 @@ function writeLineStringGeometry(geometry, opt_options) { /** * @param {ol.geom.MultiLineString} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry} GeoJSON geometry. */ function writeMultiLineStringGeometry(geometry, opt_options) { @@ -254,7 +254,7 @@ function writeMultiLineStringGeometry(geometry, opt_options) { /** * @param {ol.geom.MultiPoint} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry} GeoJSON geometry. */ function writeMultiPointGeometry(geometry, opt_options) { @@ -267,7 +267,7 @@ function writeMultiPointGeometry(geometry, opt_options) { /** * @param {ol.geom.MultiPolygon} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry} GeoJSON geometry. */ function writeMultiPolygonGeometry(geometry, opt_options) { @@ -284,7 +284,7 @@ function writeMultiPolygonGeometry(geometry, opt_options) { /** * @param {ol.geom.Point} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry} GeoJSON geometry. */ function writePointGeometry(geometry, opt_options) { @@ -297,7 +297,7 @@ function writePointGeometry(geometry, opt_options) { /** * @param {ol.geom.Polygon} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry} GeoJSON geometry. */ function writePolygonGeometry(geometry, opt_options) { @@ -453,7 +453,7 @@ GeoJSON.prototype.readProjectionFromObject = function(object) { * * @function * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} GeoJSON. * @override * @api @@ -465,7 +465,7 @@ GeoJSON.prototype.writeFeature; * Encode a feature as a GeoJSON Feature object. * * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONFeature} Object. * @override * @api @@ -502,7 +502,7 @@ GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} GeoJSON. * @api */ @@ -513,7 +513,7 @@ GeoJSON.prototype.writeFeatures; * Encode an array of features as a GeoJSON object. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONFeatureCollection} GeoJSON Object. * @override * @api @@ -536,7 +536,7 @@ GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) { * * @function * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} GeoJSON. * @api */ @@ -547,7 +547,7 @@ GeoJSON.prototype.writeGeometry; * Encode a geometry as a GeoJSON object. * * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object. * @override * @api diff --git a/src/ol/format/JSONFeature.js b/src/ol/format/JSONFeature.js index f8debdc686..fc77ed6c33 100644 --- a/src/ol/format/JSONFeature.js +++ b/src/ol/format/JSONFeature.js @@ -131,7 +131,7 @@ JSONFeature.prototype.writeFeature = function(feature, opt_options) { /** * @abstract * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} Object. */ JSONFeature.prototype.writeFeatureObject = function(feature, opt_options) {}; @@ -148,7 +148,7 @@ JSONFeature.prototype.writeFeatures = function(features, opt_options) { /** * @abstract * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} Object. */ JSONFeature.prototype.writeFeaturesObject = function(features, opt_options) {}; @@ -165,7 +165,7 @@ JSONFeature.prototype.writeGeometry = function(geometry, opt_options) { /** * @abstract * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {Object} Object. */ JSONFeature.prototype.writeGeometryObject = function(geometry, opt_options) {}; diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 7fc23d2e04..05672657fb 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -2698,7 +2698,7 @@ function writePlacemark(node, feature, objectStack) { OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); // serialize geometry - const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); + const options = /** @type {module:ol/format/Feature~WriteOptions} */ (objectStack[0]); let geometry = feature.getGeometry(); if (geometry) { geometry = transformWithOptions(geometry, true, options); @@ -2940,7 +2940,7 @@ const KML_SERIALIZERS = makeStructureNS( * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {string} Result. * @api */ @@ -2952,7 +2952,7 @@ KML.prototype.writeFeatures; * MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries. * * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. * @override * @api diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index 543c29adb9..bdbe316bcb 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -366,7 +366,7 @@ Polyline.prototype.writeFeaturesText = function(features, opt_options) { * * @function * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} Geometry. * @api */ diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index 601c91cb1b..145e4128e2 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -126,7 +126,7 @@ TextFeature.prototype.writeFeature = function(feature, opt_options) { /** * @abstract * @param {ol.Feature} feature Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @protected * @return {string} Text. */ @@ -144,7 +144,7 @@ TextFeature.prototype.writeFeatures = function(features, opt_options) { /** * @abstract * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @protected * @return {string} Text. */ @@ -162,7 +162,7 @@ TextFeature.prototype.writeGeometry = function(geometry, opt_options) { /** * @abstract * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @protected * @return {string} Text. */ diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index 6f92076cfd..3c06cd4f9c 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -856,7 +856,7 @@ Parser.prototype.parseGeometry_ = function() { * * @function * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} WKT string. * @api */ @@ -880,7 +880,7 @@ WKT.prototype.writeFeatureText = function(feature, opt_options) { * * @function * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} WKT string. * @api */ @@ -908,7 +908,7 @@ WKT.prototype.writeFeaturesText = function(features, opt_options) { * * @function * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Write options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Write options. * @return {string} WKT string. * @api */ diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index 963a9f2659..d7d7aae2f5 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -215,7 +215,7 @@ XMLFeature.prototype.writeFeature = function(feature, opt_options) { /** * @param {ol.Feature} feature Feature. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @protected * @return {Node} Node. */ @@ -235,7 +235,7 @@ XMLFeature.prototype.writeFeatures = function(features, opt_options) { /** * @param {Array.} features Features. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. */ XMLFeature.prototype.writeFeaturesNode = function(features, opt_options) { @@ -254,7 +254,7 @@ XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { /** * @param {ol.geom.Geometry} geometry Geometry. - * @param {olx.format.WriteOptions=} opt_options Options. + * @param {module:ol/format/Feature~WriteOptions=} opt_options Options. * @return {Node} Node. */ XMLFeature.prototype.writeGeometryNode = function(geometry, opt_options) { From a9263321136d251a7322ce46f24ce26f96cc41e5 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 16:02:41 -0600 Subject: [PATCH 03/16] Move Options to ol/format/GeoJSON --- externs/olx.js | 46 ---------------------------------------- externs/xol.js | 13 ------------ src/ol/format/GeoJSON.js | 18 +++++++++++++++- 3 files changed, 17 insertions(+), 60 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 72e1408807..b65465bfc2 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,52 +5,6 @@ let olx; -/** - * @typedef {{defaultDataProjection: ol.ProjectionLike, - * geometryName: (string|undefined), - * extractGeometryName: (boolean|undefined), - * featureProjection: ol.ProjectionLike}} - */ -olx.format.GeoJSONOptions; - - -/** - * Default data projection. Default is `EPSG:4326`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.GeoJSONOptions.prototype.defaultDataProjection; - - -/** - * Projection for features read or written by the format. Options passed to - * read or write methods will take precedence. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.GeoJSONOptions.prototype.featureProjection; - - -/** - * Geometry name to use when creating features. - * @type {string|undefined} - * @api - */ -olx.format.GeoJSONOptions.prototype.geometryName; - - -/** - * Certain GeoJSON providers include the geometry_name field in the feature - * geoJSON. If set to `true` the geoJSON reader will look for that field to - * set the geometry name. If both this field is set to `true` and a - * `geometryName` is provided, the `geometryName` will take precedence. - * Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.GeoJSONOptions.prototype.extractGeometryName; - - /** * @typedef {{geometryName: (string|undefined)}} */ diff --git a/externs/xol.js b/externs/xol.js index b7d8186602..b37b8c250f 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,17 +1,4 @@ -/** - * @typedef {Object} format_GeoJSONOptions - * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. - * @property {ol.ProjectionLike} featureProjection Projection for features read or written by the format. Options passed to - * read or write methods will take precedence. - * @property {string|undefined} geometryName Geometry name to use when creating features. - * @property {boolean|undefined} extractGeometryName Certain GeoJSON providers include the geometry_name field in the feature - * geoJSON. If set to `true` the geoJSON reader will look for that field to - * set the geometry name. If both this field is set to `true` and a - * `geometryName` is provided, the `geometryName` will take precedence. - * Default is `false`. - */ - /** * @typedef {Object} format_EsriJSONOptions diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 28e98919ff..a1ff628aac 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -19,13 +19,29 @@ import Polygon from '../geom/Polygon.js'; import {assign, isEmpty} from '../obj.js'; import {get as getProjection} from '../proj.js'; + +/** + * @typedef {Object} Options + * @property {ol.ProjectionLike} defaultDataProjection Default data projection. + * Default is `EPSG:4326`. + * @property {ol.ProjectionLike} featureProjection Projection for features read or + * written by the format. Options passed to read or write methods will take precedence. + * @property {string|undefined} geometryName Geometry name to use when creating features. + * @property {boolean|undefined} extractGeometryName Certain GeoJSON providers include + * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader + * will look for that field to set the geometry name. If both this field is set to `true` + * and a `geometryName` is provided, the `geometryName` will take precedence. + * Default is `false`. + */ + + /** * @classdesc * Feature format for reading and writing data in the GeoJSON format. * * @constructor * @extends {ol.format.JSONFeature} - * @param {olx.format.GeoJSONOptions=} opt_options Options. + * @param {module:ol/format/GeoJSON~Options=} opt_options Options. * @api */ const GeoJSON = function(opt_options) { From a7c5ae1ca3ead7402aed1060cb138766d7fe00f2 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 16:03:30 -0600 Subject: [PATCH 04/16] Move Options to ol/format/EsriJSON --- externs/olx.js | 14 -------------- externs/xol.js | 7 ------- src/ol/format/EsriJSON.js | 8 +++++++- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index b65465bfc2..ca39637278 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,20 +5,6 @@ let olx; -/** - * @typedef {{geometryName: (string|undefined)}} - */ -olx.format.EsriJSONOptions; - - -/** - * Geometry name to use when creating features. - * @type {string|undefined} - * @api - */ -olx.format.EsriJSONOptions.prototype.geometryName; - - /** * @typedef {{featureClass: (function((ol.geom.Geometry|Object.)=)| * function(ol.geom.GeometryType,Array., diff --git a/externs/xol.js b/externs/xol.js index b37b8c250f..d1441918fc 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,11 +1,4 @@ - -/** - * @typedef {Object} format_EsriJSONOptions - * @property {string|undefined} geometryName Geometry name to use when creating features. - */ - - /** * @typedef {Object} format_MVTOptions * @property {undefined|function((ol.geom.Geometry|Object.)=)| function(ol.geom.GeometryType,Array., diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 004c471f7f..5ad0bab99e 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -48,13 +48,19 @@ GEOMETRY_WRITERS[GeometryType.MULTI_LINE_STRING] = writeMultiLineStringGeometry; GEOMETRY_WRITERS[GeometryType.MULTI_POLYGON] = writeMultiPolygonGeometry; +/** + * @typedef {Object} Options + * @property {string|undefined} geometryName Geometry name to use when creating features. + */ + + /** * @classdesc * Feature format for reading and writing data in the EsriJSON format. * * @constructor * @extends {ol.format.JSONFeature} - * @param {olx.format.EsriJSONOptions=} opt_options Options. + * @param {module:ol/format/EsriJSON~Options=} opt_options Options. * @api */ const EsriJSON = function(opt_options) { From 7f6c4ef6cf7444e4165f0e8c6ac2e9a0d62a9546 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 16:06:32 -0600 Subject: [PATCH 05/16] Move Options to ol/format/MVT --- externs/olx.js | 50 -------------------------------------------- externs/xol.js | 15 ------------- src/ol/format/MVT.js | 19 ++++++++++++++++- 3 files changed, 18 insertions(+), 66 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index ca39637278..8501328d66 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,56 +5,6 @@ let olx; -/** - * @typedef {{featureClass: (function((ol.geom.Geometry|Object.)=)| - * function(ol.geom.GeometryType,Array., - * (Array.|Array.>),Object.)| - * undefined), - * geometryName: (string|undefined), - * layers: (Array.|undefined), - * layerName: (string|undefined)}} - */ -olx.format.MVTOptions; - - -/** - * Class for features returned by {@link ol.format.MVT#readFeatures}. Set to - * {@link ol.Feature} to get full editing and geometry support at the cost of - * decreased rendering performance. The default is {@link ol.render.Feature}, - * which is optimized for rendering and hit detection. - * @type {undefined|function((ol.geom.Geometry|Object.)=)| - * function(ol.geom.GeometryType,Array., - * (Array.|Array.>),Object.,number)} - * @api - */ -olx.format.MVTOptions.prototype.featureClass; - - -/** - * Geometry name to use when creating features. Default is 'geometry'. - * @type {string|undefined} - * @api - */ -olx.format.MVTOptions.prototype.geometryName; - - -/** - * Name of the feature attribute that holds the layer name. Default is 'layer'. - * @type {string|undefined} - * @api - */ -olx.format.MVTOptions.prototype.layerName; - - -/** - * Layers to read features from. If not provided, features will be read from all - * layers. - * @type {Array.|undefined} - * @api - */ -olx.format.MVTOptions.prototype.layers; - - /** * @typedef {{factor: (number|undefined), * geometryLayout: (ol.geom.GeometryLayout|undefined)}} diff --git a/externs/xol.js b/externs/xol.js index d1441918fc..b2a97786bf 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,19 +1,4 @@ -/** - * @typedef {Object} format_MVTOptions - * @property {undefined|function((ol.geom.Geometry|Object.)=)| function(ol.geom.GeometryType,Array., - (Array.|Array.>),Object.,number)} - featureClass Class for features returned by {@link ol.format.MVT#readFeatures}. Set to - * {@link ol.Feature} to get full editing and geometry support at the cost of - * decreased rendering performance. The default is {@link ol.render.Feature}, - * which is optimized for rendering and hit detection. - * @property {string|undefined} geometryName Geometry name to use when creating features. Default is 'geometry'. - * @property {string|undefined} layerName Name of the feature attribute that holds the layer name. Default is 'layer'. - * @property {Array.|undefined} layers Layers to read features from. If not provided, features will be read from all - * layers. - */ - - /** * @typedef {Object} format_PolylineOptions * @property {number|undefined} factor The factor by which the coordinates values will be scaled. diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 3e42fc0738..db8ed9854c 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -21,13 +21,30 @@ import Projection from '../proj/Projection.js'; import Units from '../proj/Units.js'; import RenderFeature from '../render/Feature.js'; + +/** + * @typedef {Object} Options + * @property {undefined|function((ol.geom.Geometry|Object.)=)|function(ol.geom.GeometryType,Array.,(Array.|Array.>),Object.,number)} featureClass + * Class for features returned by {@link ol.format.MVT#readFeatures}. Set to + * {@link ol.Feature} to get full editing and geometry support at the cost of + * decreased rendering performance. The default is {@link ol.render.Feature}, + * which is optimized for rendering and hit detection. + * @property {string|undefined} geometryName Geometry name to use when creating + * features. Default is `'geometry'`. + * @property {string|undefined} layerName Name of the feature attribute that + * holds the layer name. Default is `'layer'`. + * @property {Array.|undefined} layers Layers to read features from. If not + * provided, features will be read from all layers. + */ + + /** * @classdesc * Feature format for reading data in the Mapbox MVT format. * * @constructor * @extends {ol.format.Feature} - * @param {olx.format.MVTOptions=} opt_options Options. + * @param {module:ol/format/MVT~Options=} opt_options Options. * @api */ const MVT = function(opt_options) { From 5d5aa6c96d4ae9f53dcaf65479cf9411098e9058 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:05:19 -0600 Subject: [PATCH 06/16] Move Options to ol/format/Polyline --- externs/olx.js | 25 ------------------------- externs/xol.js | 9 --------- src/ol/format/Polyline.js | 13 +++++++++++-- 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 8501328d66..9780d08b8a 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,31 +5,6 @@ let olx; -/** - * @typedef {{factor: (number|undefined), - * geometryLayout: (ol.geom.GeometryLayout|undefined)}} - */ -olx.format.PolylineOptions; - - -/** - * The factor by which the coordinates values will be scaled. - * Default is `1e5`. - * @type {number|undefined} - * @api - */ -olx.format.PolylineOptions.prototype.factor; - - -/** - * Layout of the feature geometries created by the format reader. - * Default is `ol.geom.GeometryLayout.XY`. - * @type {ol.geom.GeometryLayout|undefined} - * @api - */ -olx.format.PolylineOptions.prototype.geometryLayout; - - /** * @typedef {{ * defaultDataProjection: ol.ProjectionLike, diff --git a/externs/xol.js b/externs/xol.js index b2a97786bf..f5a220ca31 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,13 +1,4 @@ -/** - * @typedef {Object} format_PolylineOptions - * @property {number|undefined} factor The factor by which the coordinates values will be scaled. - * Default is `1e5`. - * @property {ol.geom.GeometryLayout|undefined} geometryLayout Layout of the feature geometries created by the format reader. - * Default is `ol.geom.GeometryLayout.XY`. - */ - - /** * @typedef {Object} format_TopoJSONOptions * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index bdbe316bcb..0b25153cae 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -13,6 +13,16 @@ import {flipXY} from '../geom/flat/flip.js'; import {inflateCoordinates} from '../geom/flat/inflate.js'; import {get as getProjection} from '../proj.js'; + +/** + * @typedef {Object} Options + * @property {number|undefined} factor The factor by which the coordinates + * values will be scaled. Default is `1e5`. + * @property {ol.geom.GeometryLayout|undefined} geometryLayout Layout of the + * feature geometries created by the format reader. Default is `ol.geom.GeometryLayout.XY`. + */ + + /** * @classdesc * Feature format for reading and writing data in the Encoded @@ -20,8 +30,7 @@ import {get as getProjection} from '../proj.js'; * * @constructor * @extends {ol.format.TextFeature} - * @param {olx.format.PolylineOptions=} opt_options - * Optional configuration object. + * @param {module:ol/format/Polyline~Options=} opt_options Optional configuration object. * @api */ const Polyline = function(opt_options) { From 95e1c6f69a68fcba3d912cfeb2718da9d37987b3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:07:51 -0600 Subject: [PATCH 07/16] Move Options to ol/format/TopoJSON --- externs/olx.js | 50 --------------------------------------- externs/xol.js | 24 ------------------- src/ol/format/TopoJSON.js | 29 ++++++++++++++++++++++- 3 files changed, 28 insertions(+), 75 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 9780d08b8a..770eee4abf 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,56 +5,6 @@ let olx; -/** - * @typedef {{ - * defaultDataProjection: ol.ProjectionLike, - * layerName: (string|undefined), - * layers: (Array.|undefined) - * }} - */ -olx.format.TopoJSONOptions; - - -/** - * Default data projection. Default is `EPSG:4326`. - * @type {ol.ProjectionLike} - * @api - */ -olx.format.TopoJSONOptions.prototype.defaultDataProjection; - - -/** - * Set the name of the TopoJSON topology `objects`'s children as feature - * property with the specified name. This means that when set to `'layer'`, a - * topology like - * ``` - * { - * "type": "Topology", - * "objects": { - * "example": { - * "type": "GeometryCollection", - * "geometries": [] - * } - * } - * } - * ``` - * will result in features that have a property `'layer'` set to `'example'`. - * When not set, no property will be added to features. - * @type {string|undefined} - * @api - */ -olx.format.TopoJSONOptions.prototype.layerName; - - -/** - * Names of the TopoJSON topology's `objects`'s children to read features from. - * If not provided, features will be read from all children. - * @type {Array.|undefined} - * @api - */ -olx.format.TopoJSONOptions.prototype.layers; - - /** * @typedef {{altitudeMode: (IGCZ|string|undefined)}} */ diff --git a/externs/xol.js b/externs/xol.js index f5a220ca31..db6c04be00 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,28 +1,4 @@ -/** - * @typedef {Object} format_TopoJSONOptions - * @property {ol.ProjectionLike} defaultDataProjection Default data projection. Default is `EPSG:4326`. - * @property {string|undefined} layerName Set the name of the TopoJSON topology `objects`'s children as feature - * property with the specified name. This means that when set to `'layer'`, a - * topology like - * ``` - * { - * "type": "Topology", - * "objects": { - * "example": { - * "type": "GeometryCollection", - * "geometries": [] - * } - * } - * } - * ``` - * will result in features that have a property `'layer'` set to `'example'`. - * When not set, no property will be added to features. - * @property {Array.|undefined} layers Names of the TopoJSON topology's `objects`'s children to read features from. - * If not provided, features will be read from all children. - */ - - /** * @typedef {Object} format_IGCOptions * @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index 70596f6750..2fc3c52ff8 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -13,13 +13,40 @@ import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import {get as getProjection} from '../proj.js'; + +/** + * @typedef {Object} Options + * @property {ol.ProjectionLike} defaultDataProjection Default data projection. + * Default is `EPSG:4326`. + * @property {string|undefined} layerName Set the name of the TopoJSON topology + * `objects`'s children as feature property with the specified name. This means + * that when set to `'layer'`, a topology like + * ``` + * { + * "type": "Topology", + * "objects": { + * "example": { + * "type": "GeometryCollection", + * "geometries": [] + * } + * } + * } + * ``` + * will result in features that have a property `'layer'` set to `'example'`. + * When not set, no property will be added to features. + * @property {Array.|undefined} layers Names of the TopoJSON topology's + * `objects`'s children to read features from. If not provided, features will + * be read from all children. + */ + + /** * @classdesc * Feature format for reading data in the TopoJSON format. * * @constructor * @extends {ol.format.JSONFeature} - * @param {olx.format.TopoJSONOptions=} opt_options Options. + * @param {module:ol/format/TopoJSON~Options=} opt_options Options. * @api */ const TopoJSON = function(opt_options) { From 2ce44e8fc87c91783980b34d1cfa8f8cf46263a0 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:09:55 -0600 Subject: [PATCH 08/16] Move Options to ol/format/IGC --- externs/olx.js | 15 --------------- externs/xol.js | 7 ------- src/ol/format/IGC.js | 11 ++++++++++- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 770eee4abf..4bc33d3092 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,21 +5,6 @@ let olx; -/** - * @typedef {{altitudeMode: (IGCZ|string|undefined)}} - */ -olx.format.IGCOptions; - - -/** - * Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default - * is `none`. - * @type {IGCZ|string|undefined} - * @api - */ -olx.format.IGCOptions.prototype.altitudeMode; - - /** * @typedef {{extractStyles: (boolean|undefined), * defaultStyle: (Array.|undefined), diff --git a/externs/xol.js b/externs/xol.js index db6c04be00..9806e8f51f 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,11 +1,4 @@ -/** - * @typedef {Object} format_IGCOptions - * @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible values are `barometric`, `gps`, and `none`. Default - * is `none`. - */ - - /** * @typedef {Object} format_KMLOptions * @property {boolean|undefined} extractStyles Extract styles from the KML. Default is `true`. diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index b4b493958e..ab0a1edac7 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -19,13 +19,22 @@ const IGCZ = { NONE: 'none' }; + +/** + * @typedef {Object} Options + * @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible + * values are `'barometric'`, `'gps'`, and `'none'`. Default + * is `'none'`. + */ + + /** * @classdesc * Feature format for `*.igc` flight recording files. * * @constructor * @extends {ol.format.TextFeature} - * @param {olx.format.IGCOptions=} opt_options Options. + * @param {module:ol/format/IGC~Options=} opt_options Options. * @api */ const IGC = function(opt_options) { From 458383c7d3ecfc9f9a386a01dac1562eae772a70 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:11:36 -0600 Subject: [PATCH 09/16] Move Options to ol/format/KML --- externs/olx.js | 41 ----------------------------------------- externs/xol.js | 9 --------- src/ol/format/KML.js | 15 ++++++++++++++- 3 files changed, 14 insertions(+), 51 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 4bc33d3092..da2f7a76fc 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,47 +5,6 @@ let olx; -/** - * @typedef {{extractStyles: (boolean|undefined), - * defaultStyle: (Array.|undefined), - * showPointNames: (boolean|undefined), - * writeStyles: (boolean|undefined)}} - */ -olx.format.KMLOptions; - - -/** - * Extract styles from the KML. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.KMLOptions.prototype.extractStyles; - - -/** - * Show names as labels for placemarks which contain points. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.KMLOptions.prototype.showPointNames; - - -/** - * Default style. The default default style is the same as Google Earth. - * @type {Array.|undefined} - * @api - */ -olx.format.KMLOptions.prototype.defaultStyle; - - -/** - * Write styles into KML. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.KMLOptions.prototype.writeStyles; - - /** * @typedef {{featureNS: (Object.|string|undefined), * featureType: (Array.|string|undefined), diff --git a/externs/xol.js b/externs/xol.js index 9806e8f51f..34e5387d4e 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,13 +1,4 @@ -/** - * @typedef {Object} format_KMLOptions - * @property {boolean|undefined} extractStyles Extract styles from the KML. Default is `true`. - * @property {boolean|undefined} showPointNames Show names as labels for placemarks which contain points. Default is `true`. - * @property {Array.|undefined} defaultStyle Default style. The default default style is the same as Google Earth. - * @property {boolean|undefined} writeStyles Write styles into KML. Default is `true`. - */ - - /** * @typedef {Object} format_GMLOptions * @property {Object.|string|undefined} featureNS Feature namespace. If not defined will be derived from GML. If multiple diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 05672657fb..bd06287317 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -227,6 +227,19 @@ function createStyleDefaults() { } + +/** + * @typedef {Object} Options + * @property {boolean|undefined} extractStyles Extract styles from the KML. + * Default is `true`. + * @property {boolean|undefined} showPointNames Show names as labels for placemarks + * which contain points. Default is `true`. + * @property {Array.|undefined} defaultStyle Default style. The + * default default style is the same as Google Earth. + * @property {boolean|undefined} writeStyles Write styles into KML. Default is `true`. + */ + + /** * @classdesc * Feature format for reading and writing data in the KML format. @@ -236,7 +249,7 @@ function createStyleDefaults() { * * @constructor * @extends {ol.format.XMLFeature} - * @param {olx.format.KMLOptions=} opt_options Options. + * @param {module:ol/format/KML~Options=} opt_options Options. * @api */ const KML = function(opt_options) { From 209162992265ed2286e49e44289b86ce3d2819bc Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:15:11 -0600 Subject: [PATCH 10/16] Move Options to ol/format/GMLBase --- externs/olx.js | 98 +--------------------------------------- externs/xol.js | 32 +------------ src/ol/format/GML.js | 2 +- src/ol/format/GML2.js | 4 +- src/ol/format/GML3.js | 4 +- src/ol/format/GMLBase.js | 36 ++++++++++++++- 6 files changed, 42 insertions(+), 134 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index da2f7a76fc..76db8ffdb2 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,100 +5,6 @@ let olx; -/** - * @typedef {{featureNS: (Object.|string|undefined), - * featureType: (Array.|string|undefined), - * srsName: string, - * surface: (boolean|undefined), - * curve: (boolean|undefined), - * multiCurve: (boolean|undefined), - * multiSurface: (boolean|undefined), - * schemaLocation: (string|undefined)}} - */ -olx.format.GMLOptions; - - -/** - * Feature namespace. If not defined will be derived from GML. If multiple - * feature types have been configured which come from different feature - * namespaces, this will be an object with the keys being the prefixes used - * in the entries of featureType array. The values of the object will be the - * feature namespaces themselves. So for instance there might be a featureType - * item `topp:states` in the `featureType` array and then there will be a key - * `topp` in the featureNS object with value `http://www.openplans.org/topp`. - * @type {Object.|string|undefined} - * @api - */ -olx.format.GMLOptions.prototype.featureNS; - - -/** - * Feature type(s) to parse. If multiple feature types need to be configured - * which come from different feature namespaces, `featureNS` will be an object - * with the keys being the prefixes used in the entries of featureType array. - * The values of the object will be the feature namespaces themselves. - * So for instance there might be a featureType item `topp:states` and then - * there will be a key named `topp` in the featureNS object with value - * `http://www.openplans.org/topp`. - * @type {Array.|string|undefined} - * @api - */ -olx.format.GMLOptions.prototype.featureType; - - -/** - * srsName to use when writing geometries. - * @type {string} - * @api - */ -olx.format.GMLOptions.prototype.srsName; - - -/** - * Write gml:Surface instead of gml:Polygon elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.surface; - - -/** - * Write gml:Curve instead of gml:LineString elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.curve; - - -/** - * Write gml:MultiCurve instead of gml:MultiLineString. Since the latter is - * deprecated in GML 3, the default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.multiCurve; - - -/** - * Write gml:multiSurface instead of gml:MultiPolygon. Since the latter is - * deprecated in GML 3, the default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.format.GMLOptions.prototype.multiSurface; - - -/** - * Optional schemaLocation to use when writing out the GML, this will override - * the default provided. - * @type {string|undefined} - * @api - */ -olx.format.GMLOptions.prototype.schemaLocation; - - /** * @typedef {{readExtensions: (function(ol.Feature, Node)|undefined)}} */ @@ -304,7 +210,7 @@ olx.format.WFSWriteGetFeatureOptions.prototype.resultType; * handle: (string|undefined), * hasZ: (boolean|undefined), * nativeElements: Array., - * gmlOptions: (olx.format.GMLOptions|undefined), + * gmlOptions: (module:ol/format/GMLBase~Options|undefined), * version: (string|undefined)}} */ olx.format.WFSWriteTransactionOptions; @@ -370,7 +276,7 @@ olx.format.WFSWriteTransactionOptions.prototype.nativeElements; /** * GML options for the WFS transaction writer. - * @type {olx.format.GMLOptions|undefined} + * @type {module:ol/format/GMLBase~Options|undefined} * @api */ olx.format.WFSWriteTransactionOptions.prototype.gmlOptions; diff --git a/externs/xol.js b/externs/xol.js index 34e5387d4e..1f9458eb69 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,34 +1,4 @@ -/** - * @typedef {Object} format_GMLOptions - * @property {Object.|string|undefined} featureNS Feature namespace. If not defined will be derived from GML. If multiple - * feature types have been configured which come from different feature - * namespaces, this will be an object with the keys being the prefixes used - * in the entries of featureType array. The values of the object will be the - * feature namespaces themselves. So for instance there might be a featureType - * item `topp:states` in the `featureType` array and then there will be a key - * `topp` in the featureNS object with value `http://www.openplans.org/topp`. - * @property {Array.|string|undefined} featureType Feature type(s) to parse. If multiple feature types need to be configured - * which come from different feature namespaces, `featureNS` will be an object - * with the keys being the prefixes used in the entries of featureType array. - * The values of the object will be the feature namespaces themselves. - * So for instance there might be a featureType item `topp:states` and then - * there will be a key named `topp` in the featureNS object with value - * `http://www.openplans.org/topp`. - * @property {string} srsName srsName to use when writing geometries. - * @property {boolean|undefined} surface Write gml:Surface instead of gml:Polygon elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @property {boolean|undefined} curve Write gml:Curve instead of gml:LineString elements. This also affects the - * elements in multi-part geometries. Default is `false`. - * @property {boolean|undefined} multiCurve Write gml:MultiCurve instead of gml:MultiLineString. Since the latter is - * deprecated in GML 3, the default is `true`. - * @property {boolean|undefined} multiSurface Write gml:multiSurface instead of gml:MultiPolygon. Since the latter is - * deprecated in GML 3, the default is `true`. - * @property {string|undefined} schemaLocation Optional schemaLocation to use when writing out the GML, this will override - * the default provided. - */ - - /** * @typedef {Object} format_GPXOptions * @property {function(ol.Feature, Node)|undefined} readExtensions Callback function to process `extensions` nodes. @@ -85,7 +55,7 @@ * @property {boolean|undefined} hasZ Must be set to true if the transaction is for a 3D layer. This will allow * the Z coordinate to be included in the transaction. * @property {Array.} nativeElements Native elements. Currently not supported. - * @property {olx.format.GMLOptions|undefined} gmlOptions GML options for the WFS transaction writer. + * @property {module:ol/format/GMLBase~Options|undefined} gmlOptions GML options for the WFS transaction writer. * @property {string|undefined} version WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`. * Default is `1.1.0`. */ diff --git a/src/ol/format/GML.js b/src/ol/format/GML.js index cce96b29b0..c03e9b88af 100644 --- a/src/ol/format/GML.js +++ b/src/ol/format/GML.js @@ -10,7 +10,7 @@ import GML3 from '../format/GML3.js'; * Currently only supports GML 3.1.1 Simple Features profile. * * @constructor - * @param {olx.format.GMLOptions=} opt_options + * @param {module:ol/format/GMLBase~Options=} opt_options * Optional configuration object. * @extends {ol.format.GMLBase} * @api diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 99aa6ee518..fc6483a087 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -26,12 +26,12 @@ const schemaLocation = GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xs * version 2.1.2. * * @constructor - * @param {olx.format.GMLOptions=} opt_options Optional configuration object. + * @param {module:ol/format/GMLBase~Options=} opt_options Optional configuration object. * @extends {ol.format.GMLBase} * @api */ const GML2 = function(opt_options) { - const options = /** @type {olx.format.GMLOptions} */ + const options = /** @type {module:ol/format/GMLBase~Options} */ (opt_options ? opt_options : {}); GMLBase.call(this, options); diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index 44645869db..d89d9db184 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -37,13 +37,13 @@ const schemaLocation = GMLNS + * Currently only supports GML 3.1.1 Simple Features profile. * * @constructor - * @param {olx.format.GMLOptions=} opt_options + * @param {module:ol/format/GMLBase~Options=} opt_options * Optional configuration object. * @extends {ol.format.GMLBase} * @api */ const GML3 = function(opt_options) { - const options = /** @type {olx.format.GMLOptions} */ + const options = /** @type {module:ol/format/GMLBase~Options} */ (opt_options ? opt_options : {}); GMLBase.call(this, options); diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index ed74e076b1..4833c5e112 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -29,6 +29,38 @@ import {getAllTextContent, getAttributeNS, makeArrayPusher, makeReplacer, parseN export const GMLNS = 'http://www.opengis.net/gml'; +/** + * @typedef {Object} Options + * @property {Object.|string|undefined} featureNS Feature + * namespace. If not defined will be derived from GML. If multiple + * feature types have been configured which come from different feature + * namespaces, this will be an object with the keys being the prefixes used + * in the entries of featureType array. The values of the object will be the + * feature namespaces themselves. So for instance there might be a featureType + * item `topp:states` in the `featureType` array and then there will be a key + * `topp` in the featureNS object with value `http://www.openplans.org/topp`. + * @property {Array.|string|undefined} featureType Feature type(s) to parse. + * If multiple feature types need to be configured + * which come from different feature namespaces, `featureNS` will be an object + * with the keys being the prefixes used in the entries of featureType array. + * The values of the object will be the feature namespaces themselves. + * So for instance there might be a featureType item `topp:states` and then + * there will be a key named `topp` in the featureNS object with value + * `http://www.openplans.org/topp`. + * @property {string} srsName srsName to use when writing geometries. + * @property {boolean|undefined} surface Write gml:Surface instead of gml:Polygon + * elements. This also affects the elements in multi-part geometries. Default is `false`. + * @property {boolean|undefined} curve Write gml:Curve instead of gml:LineString + * elements. This also affects the elements in multi-part geometries. Default is `false`. + * @property {boolean|undefined} multiCurve Write gml:MultiCurve instead of gml:MultiLineString. + * Since the latter is deprecated in GML 3, the default is `true`. + * @property {boolean|undefined} multiSurface Write gml:multiSurface instead of + * gml:MultiPolygon. Since the latter is deprecated in GML 3, the default is `true`. + * @property {string|undefined} schemaLocation Optional schemaLocation to use when + * writing out the GML, this will override the default provided. + */ + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -40,12 +72,12 @@ export const GMLNS = 'http://www.opengis.net/gml'; * * @constructor * @abstract - * @param {olx.format.GMLOptions=} opt_options + * @param {module:ol/format/GMLBase~Options=} opt_options * Optional configuration object. * @extends {ol.format.XMLFeature} */ const GMLBase = function(opt_options) { - const options = /** @type {olx.format.GMLOptions} */ (opt_options ? opt_options : {}); + const options = /** @type {module:ol/format/GMLBase~Options} */ (opt_options ? opt_options : {}); /** * @protected From bb816de76834e588e626c00a736bd157803bc92a Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:23:18 -0600 Subject: [PATCH 11/16] Move Options to ol/format/GPX --- externs/olx.js | 19 ------------------- externs/xol.js | 11 ----------- src/ol/format/GPX.js | 14 +++++++++++++- 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 76db8ffdb2..0ace491a77 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,25 +5,6 @@ let olx; -/** - * @typedef {{readExtensions: (function(ol.Feature, Node)|undefined)}} - */ -olx.format.GPXOptions; - - -/** - * Callback function to process `extensions` nodes. - * To prevent memory leaks, this callback function must - * not store any references to the node. Note that the `extensions` - * node is not allowed in GPX 1.0. Moreover, only `extensions` - * nodes from `wpt`, `rte` and `trk` can be processed, as those are - * directly mapped to a feature. - * @type {function(ol.Feature, Node)|undefined} - * @api - */ -olx.format.GPXOptions.prototype.readExtensions; - - /** * @typedef {{featureNS: (Object.|string|undefined), * featureType: (Array.|string|undefined), diff --git a/externs/xol.js b/externs/xol.js index 1f9458eb69..b93b7f3e60 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,15 +1,4 @@ -/** - * @typedef {Object} format_GPXOptions - * @property {function(ol.Feature, Node)|undefined} readExtensions Callback function to process `extensions` nodes. - * To prevent memory leaks, this callback function must - * not store any references to the node. Note that the `extensions` - * node is not allowed in GPX 1.0. Moreover, only `extensions` - * nodes from `wpt`, `rte` and `trk` can be processed, as those are - * directly mapped to a feature. - */ - - /** * @typedef {Object} format_WFSOptions * @property {Object.|string|undefined} featureNS The namespace URI used for features. diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 7f96a94098..27aafd3962 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -17,13 +17,25 @@ import {createElementNS, makeArrayPusher, makeArraySerializer, makeChildAppender OBJECT_PROPERTY_NODE_FACTORY, parseNode, pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js'; + +/** + * @typedef {Object} Options + * @property {function(ol.Feature, Node)|undefined} readExtensions Callback function + * to process `extensions` nodes. To prevent memory leaks, this callback function must + * not store any references to the node. Note that the `extensions` + * node is not allowed in GPX 1.0. Moreover, only `extensions` + * nodes from `wpt`, `rte` and `trk` can be processed, as those are + * directly mapped to a feature. + */ + + /** * @classdesc * Feature format for reading and writing data in the GPX format. * * @constructor * @extends {ol.format.XMLFeature} - * @param {olx.format.GPXOptions=} opt_options Options. + * @param {module:ol/format/GPX~Options=} opt_options Options. * @api */ const GPX = function(opt_options) { From 4c78642ae2e80514f3173de990ddac3d5300c023 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:23:47 -0600 Subject: [PATCH 12/16] Move Options to ol/format/WFS --- externs/olx.js | 42 ------------------------------------------ externs/xol.js | 10 ---------- src/ol/format/WFS.js | 16 ++++++++++++++-- 3 files changed, 14 insertions(+), 54 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 0ace491a77..72f1cb37de 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,48 +5,6 @@ let olx; -/** - * @typedef {{featureNS: (Object.|string|undefined), - * featureType: (Array.|string|undefined), - * gmlFormat: (ol.format.GMLBase|undefined), - * schemaLocation: (string|undefined)}} - */ -olx.format.WFSOptions; - - -/** - * The namespace URI used for features. - * @type {Object.|string|undefined} - * @api - */ -olx.format.WFSOptions.prototype.featureNS; - - -/** - * The feature type to parse. Only used for read operations. - * @type {Array.|string|undefined} - * @api - */ -olx.format.WFSOptions.prototype.featureType; - - -/** - * The GML format to use to parse the response. Default is `ol.format.GML3`. - * @type {ol.format.GMLBase|undefined} - * @api - */ -olx.format.WFSOptions.prototype.gmlFormat; - - -/** - * Optional schemaLocation to use for serialization, this will override the - * default. - * @type {string|undefined} - * @api - */ -olx.format.WFSOptions.prototype.schemaLocation; - - /** * @typedef {{featureNS: string, * featurePrefix: string, diff --git a/externs/xol.js b/externs/xol.js index b93b7f3e60..cd9202a500 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,14 +1,4 @@ -/** - * @typedef {Object} format_WFSOptions - * @property {Object.|string|undefined} featureNS The namespace URI used for features. - * @property {Array.|string|undefined} featureType The feature type to parse. Only used for read operations. - * @property {ol.format.GMLBase|undefined} gmlFormat The GML format to use to parse the response. Default is `ol.format.GML3`. - * @property {string|undefined} schemaLocation Optional schemaLocation to use for serialization, this will override the - * default. - */ - - /** * @typedef {Object} format_WFSWriteGetFeatureOptions * @property {string} featureNS The namespace URI used for features. diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 6b8772bcfd..9cc0a36d11 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -17,6 +17,19 @@ import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender, pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js'; +/** + * @typedef {Object} Options + * @property {Object.|string|undefined} featureNS The namespace + * URI used for features. + * @property {Array.|string|undefined} featureType The feature type to parse. + * Only used for read operations. + * @property {ol.format.GMLBase|undefined} gmlFormat The GML format to use to parse + * the response. Default is `ol.format.GML3`. + * @property {string|undefined} schemaLocation Optional schemaLocation to use for + * serialization, this will override the default. + */ + + /** * @type {string} */ @@ -71,8 +84,7 @@ const DEFAULT_VERSION = '1.1.0'; * Also see {@link ol.format.GMLBase} which is used by this format. * * @constructor - * @param {olx.format.WFSOptions=} opt_options - * Optional configuration object. + * @param {module:ol/format/WFS~Options=} opt_options Optional configuration object. * @extends {ol.format.XMLFeature} * @api */ From ca46c4dd076a4d091bb8d6a0f126dbcd2aaa50a1 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:26:22 -0600 Subject: [PATCH 13/16] Move WriteGetFeatureOptions to ol/format/WFS --- externs/olx.js | 136 ------------------------------------------- externs/xol.js | 24 -------- src/ol/format/WFS.js | 27 ++++++++- 3 files changed, 26 insertions(+), 161 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 72f1cb37de..73a5109345 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,142 +5,6 @@ let olx; -/** - * @typedef {{featureNS: string, - * featurePrefix: string, - * featureTypes: Array., - * srsName: (string|undefined), - * handle: (string|undefined), - * outputFormat: (string|undefined), - * maxFeatures: (number|undefined), - * geometryName: (string|undefined), - * propertyNames: (Array.|undefined), - * startIndex: (number|undefined), - * count: (number|undefined), - * bbox: (ol.Extent|undefined), - * filter: (ol.format.filter.Filter|undefined), - * resultType: (string|undefined)}} - */ -olx.format.WFSWriteGetFeatureOptions; - - -/** - * The namespace URI used for features. - * @type {string} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.featureNS; - - -/** - * The prefix for the feature namespace. - * @type {string} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.featurePrefix; - - -/** - * The feature type names. - * @type {Array.} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.featureTypes; - - -/** - * SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.srsName; - - -/** - * Handle. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.handle; - - -/** - * Output format. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.outputFormat; - - -/** - * Maximum number of features to fetch. - * @type {number|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.maxFeatures; - - -/** - * Geometry name to use in a BBOX filter. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.geometryName; - - -/** - * Optional list of property names to serialize. - * @type {Array.|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.propertyNames; - - -/** - * Start index to use for WFS paging. This is a WFS 2.0 feature backported to - * WFS 1.1.0 by some Web Feature Services. - * @type {number|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.startIndex; - - -/** - * Number of features to retrieve when paging. This is a WFS 2.0 feature - * backported to WFS 1.1.0 by some Web Feature Services. Please note that some - * Web Feature Services have repurposed `maxfeatures` instead. - * @type {number|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.count; - - -/** - * Extent to use for the BBOX filter. - * @type {ol.Extent|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.bbox; - - -/** - * Filter condition. See {@link ol.format.filter} for more information. - * @type {ol.format.filter.Filter|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.filter; - - -/** - * Indicates what response should be returned, E.g. `hits` only includes the - * `numberOfFeatures` attribute in the response and no features. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteGetFeatureOptions.prototype.resultType; - - /** * @typedef {{featureNS: string, * featurePrefix: string, diff --git a/externs/xol.js b/externs/xol.js index cd9202a500..e5bc5a0d41 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,28 +1,4 @@ -/** - * @typedef {Object} format_WFSWriteGetFeatureOptions - * @property {string} featureNS The namespace URI used for features. - * @property {string} featurePrefix The prefix for the feature namespace. - * @property {Array.} featureTypes The feature type names. - * @property {string|undefined} srsName SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @property {string|undefined} handle Handle. - * @property {string|undefined} outputFormat Output format. - * @property {number|undefined} maxFeatures Maximum number of features to fetch. - * @property {string|undefined} geometryName Geometry name to use in a BBOX filter. - * @property {Array.|undefined} propertyNames Optional list of property names to serialize. - * @property {number|undefined} startIndex Start index to use for WFS paging. This is a WFS 2.0 feature backported to - * WFS 1.1.0 by some Web Feature Services. - * @property {number|undefined} count Number of features to retrieve when paging. This is a WFS 2.0 feature - * backported to WFS 1.1.0 by some Web Feature Services. Please note that some - * Web Feature Services have repurposed `maxfeatures` instead. - * @property {ol.Extent|undefined} bbox Extent to use for the BBOX filter. - * @property {ol.format.filter.Filter|undefined} filter Filter condition. See {@link ol.format.filter} for more information. - * @property {string|undefined} resultType Indicates what response should be returned, E.g. `hits` only includes the - * `numberOfFeatures` attribute in the response and no features. - */ - - /** * @typedef {Object} format_WFSWriteTransactionOptions * @property {string} featureNS The namespace URI used for features. diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 9cc0a36d11..71a98b1e01 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -30,6 +30,31 @@ import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender, */ +/** + * @typedef {Object} WriteGetFeatureOptions + * @property {string} featureNS The namespace URI used for features. + * @property {string} featurePrefix The prefix for the feature namespace. + * @property {Array.} featureTypes The feature type names. + * @property {string|undefined} srsName SRS name. No srsName attribute will be set on + * geometries when this is not provided. + * @property {string|undefined} handle Handle. + * @property {string|undefined} outputFormat Output format. + * @property {number|undefined} maxFeatures Maximum number of features to fetch. + * @property {string|undefined} geometryName Geometry name to use in a BBOX filter. + * @property {Array.|undefined} propertyNames Optional list of property names to serialize. + * @property {number|undefined} startIndex Start index to use for WFS paging. This is a + * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services. + * @property {number|undefined} count Number of features to retrieve when paging. This is a + * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services. Please note that some + * Web Feature Services have repurposed `maxfeatures` instead. + * @property {ol.Extent|undefined} bbox Extent to use for the BBOX filter. + * @property {ol.format.filter.Filter|undefined} filter Filter condition. See + * {@link ol.format.filter} for more information. + * @property {string|undefined} resultType Indicates what response should be returned, + * E.g. `hits` only includes the `numberOfFeatures` attribute in the response and no features. + */ + + /** * @type {string} */ @@ -890,7 +915,7 @@ function writeGetFeature(node, featureTypes, objectStack) { /** * Encode format as WFS `GetFeature` and return the Node. * - * @param {olx.format.WFSWriteGetFeatureOptions} options Options. + * @param {module:ol/format/WFS~WriteGetFeatureOptions} options Options. * @return {Node} Result. * @api */ From 55e257d6fb04836548d1bac363fbc27ff1ad2040 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:28:19 -0600 Subject: [PATCH 14/16] Move WriteTransactionOptions to ol/format/WFS --- externs/olx.js | 89 -------------------------------------------- externs/xol.js | 17 --------- src/ol/format/WFS.js | 20 +++++++++- 3 files changed, 19 insertions(+), 107 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 73a5109345..349b1f8552 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,95 +5,6 @@ let olx; -/** - * @typedef {{featureNS: string, - * featurePrefix: string, - * featureType: string, - * srsName: (string|undefined), - * handle: (string|undefined), - * hasZ: (boolean|undefined), - * nativeElements: Array., - * gmlOptions: (module:ol/format/GMLBase~Options|undefined), - * version: (string|undefined)}} - */ -olx.format.WFSWriteTransactionOptions; - - -/** - * The namespace URI used for features. - * @type {string} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.featureNS; - - -/** - * The prefix for the feature namespace. - * @type {string} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.featurePrefix; - - -/** - * The feature type name. - * @type {string} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.featureType; - - -/** - * SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.srsName; - - -/** - * Handle. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.handle; - - -/** - * Must be set to true if the transaction is for a 3D layer. This will allow - * the Z coordinate to be included in the transaction. - * @type {boolean|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.hasZ; - - -/** - * Native elements. Currently not supported. - * @type {Array.} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.nativeElements; - - -/** - * GML options for the WFS transaction writer. - * @type {module:ol/format/GMLBase~Options|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.gmlOptions; - - -/** - * WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`. - * Default is `1.1.0`. - * @type {string|undefined} - * @api - */ -olx.format.WFSWriteTransactionOptions.prototype.version; - - /** * @typedef {{splitCollection: (boolean|undefined)}} */ diff --git a/externs/xol.js b/externs/xol.js index e5bc5a0d41..29306696dc 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,21 +1,4 @@ -/** - * @typedef {Object} format_WFSWriteTransactionOptions - * @property {string} featureNS The namespace URI used for features. - * @property {string} featurePrefix The prefix for the feature namespace. - * @property {string} featureType The feature type name. - * @property {string|undefined} srsName SRS name. No srsName attribute will be set on geometries when this is not - * provided. - * @property {string|undefined} handle Handle. - * @property {boolean|undefined} hasZ Must be set to true if the transaction is for a 3D layer. This will allow - * the Z coordinate to be included in the transaction. - * @property {Array.} nativeElements Native elements. Currently not supported. - * @property {module:ol/format/GMLBase~Options|undefined} gmlOptions GML options for the WFS transaction writer. - * @property {string|undefined} version WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`. - * Default is `1.1.0`. - */ - - /** * @typedef {Object} format_WKTOptions * @property {boolean|undefined} splitCollection Whether to split GeometryCollections into diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 71a98b1e01..295e982db8 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -55,6 +55,24 @@ import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender, */ +/** + * @typedef {Object} WriteTransactionOptions + * @property {string} featureNS The namespace URI used for features. + * @property {string} featurePrefix The prefix for the feature namespace. + * @property {string} featureType The feature type name. + * @property {string|undefined} srsName SRS name. No srsName attribute will be set on + * geometries when this is not provided. + * @property {string|undefined} handle Handle. + * @property {boolean|undefined} hasZ Must be set to true if the transaction is for + * a 3D layer. This will allow the Z coordinate to be included in the transaction. + * @property {Array.} nativeElements Native elements. Currently not supported. + * @property {module:ol/format/GMLBase~Options|undefined} gmlOptions GML options for + * the WFS transaction writer. + * @property {string|undefined} version WFS version to use for the transaction. Can be + * either `1.0.0` or `1.1.0`. Default is `1.1.0`. + */ + + /** * @type {string} */ @@ -982,7 +1000,7 @@ WFS.prototype.writeGetFeature = function(options) { * @param {Array.} inserts The features to insert. * @param {Array.} updates The features to update. * @param {Array.} deletes The features to delete. - * @param {olx.format.WFSWriteTransactionOptions} options Write options. + * @param {module:ol/format/WFS~WriteTransactionOptions} options Write options. * @return {Node} Result. * @api */ From 7d52a9b8c4c7903aa13d5aac52c601cdbc58a6be Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:29:36 -0600 Subject: [PATCH 15/16] Move Options to ol/format/WKT --- externs/olx.js | 15 --------------- externs/xol.js | 7 ------- src/ol/format/WKT.js | 9 ++++++++- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 349b1f8552..ca44065d92 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,21 +5,6 @@ let olx; -/** - * @typedef {{splitCollection: (boolean|undefined)}} - */ -olx.format.WKTOptions; - - -/** - * Whether to split GeometryCollections into - * multiple features on reading. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.format.WKTOptions.prototype.splitCollection; - - /** * @typedef {{ * layers: (Array.|undefined) diff --git a/externs/xol.js b/externs/xol.js index 29306696dc..6a9d340840 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,11 +1,4 @@ -/** - * @typedef {Object} format_WKTOptions - * @property {boolean|undefined} splitCollection Whether to split GeometryCollections into - * multiple features on reading. Default is `false`. - */ - - /** * @typedef {Object} format_WMSGetFeatureInfoOptions * @property {Array.|undefined} layers If set, only features of the given layers will be returned by the format diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index 3c06cd4f9c..e07deec019 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -17,6 +17,13 @@ import Polygon from '../geom/Polygon.js'; import SimpleGeometry from '../geom/SimpleGeometry.js'; +/** + * @typedef {Object} Options + * @property {boolean|undefined} splitCollection Whether to split GeometryCollections into + * multiple features on reading. Default is `false`. + */ + + /** * @const * @type {string} @@ -526,7 +533,7 @@ Parser.prototype.formatErrorMessage_ = function() { * * @constructor * @extends {ol.format.TextFeature} - * @param {olx.format.WKTOptions=} opt_options Options. + * @param {module:ol/format/WKT~Options=} opt_options Options. * @api */ const WKT = function(opt_options) { From 03a7a6cb087be4fb2403420d2666fe269c02713a Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:31:46 -0600 Subject: [PATCH 16/16] Move Options to ol/format/WMSGetFeatureInfo --- externs/olx.js | 17 ----------------- externs/xol.js | 7 ------- src/ol/format/WMSGetFeatureInfo.js | 10 +++++++++- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index ca44065d92..b18745825c 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,23 +5,6 @@ let olx; -/** - * @typedef {{ - * layers: (Array.|undefined) - * }} - */ -olx.format.WMSGetFeatureInfoOptions; - - -/** - * If set, only features of the given layers will be returned by the format - * when read. - * @type {Array.|undefined} - * @api - */ -olx.format.WMSGetFeatureInfoOptions.prototype.layers; - - /** * @typedef {{duration: (number|undefined), * delta: (number|undefined)}} diff --git a/externs/xol.js b/externs/xol.js index 6a9d340840..b3e1c6091c 100644 --- a/externs/xol.js +++ b/externs/xol.js @@ -1,11 +1,4 @@ -/** - * @typedef {Object} format_WMSGetFeatureInfoOptions - * @property {Array.|undefined} layers If set, only features of the given layers will be returned by the format - * when read. - */ - - /** * @typedef {Object} interaction_DoubleClickZoomOptions * @property {number|undefined} duration Animation duration in milliseconds. Default is `250`. diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index f4d73bb584..cc7e393cc1 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -8,6 +8,14 @@ import XMLFeature from '../format/XMLFeature.js'; import {assign} from '../obj.js'; import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js'; + +/** + * @typedef {Object} Options + * @property {Array.|undefined} layers If set, only features of the + * given layers will be returned by the format when read. + */ + + /** * @classdesc * Format for reading WMSGetFeatureInfo format. It uses @@ -15,7 +23,7 @@ import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js'; * * @constructor * @extends {ol.format.XMLFeature} - * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options. + * @param {module:ol/format/WMSGetFeatureInfo~Options=} opt_options Options. * @api */ const WMSGetFeatureInfo = function(opt_options) {