Move Options to ol/format/TopoJSON

This commit is contained in:
Tim Schaub
2018-03-11 22:07:51 -06:00
parent 5d5aa6c96d
commit 95e1c6f69a
3 changed files with 28 additions and 75 deletions

View File

@@ -5,56 +5,6 @@
let olx;
/**
* @typedef {{
* defaultDataProjection: ol.ProjectionLike,
* layerName: (string|undefined),
* layers: (Array.<string>|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.<string>|undefined}
* @api
*/
olx.format.TopoJSONOptions.prototype.layers;
/**
* @typedef {{altitudeMode: (IGCZ|string|undefined)}}
*/

View File

@@ -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.<string>|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

View File

@@ -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.<string>|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) {