From 95e1c6f69a68fcba3d912cfeb2718da9d37987b3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 11 Mar 2018 22:07:51 -0600 Subject: [PATCH] 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) {