From 8a4d60192f7a960cd7cfb6cad501a7fc51ffcd7d Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 15 Mar 2018 15:20:01 +0100 Subject: [PATCH] Mark optional property with square brackets --- src/ol/PluggableMap.js | 4 ++-- src/ol/Tile.js | 9 +++------ src/ol/control.js | 2 +- src/ol/control/Control.js | 6 +++--- src/ol/control/FullScreen.js | 19 ++++++++----------- src/ol/format/EsriJSON.js | 2 +- src/ol/format/Feature.js | 4 ++-- src/ol/format/GPX.js | 2 +- src/ol/format/IGC.js | 5 ++--- src/ol/format/MVT.js | 12 ++++++------ src/ol/format/WKT.js | 4 ++-- src/ol/proj/Projection.js | 12 +++++------- 12 files changed, 36 insertions(+), 45 deletions(-) diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 36f4387984..64776d6d34 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -68,9 +68,9 @@ import {create as createTransform, apply as applyTransform} from './transform.js * {@link ol.layer.Layer layer-candidate} and it should return a boolean value. * Only layers which are visible and for which this function returns `true` * will be tested for features. By default, all visible layers will be tested. - * @property {number|undefined} hitTolerance Hit-detection tolerance in pixels. Pixels + * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels * inside the radius around the given position will be checked for features. This only - * works for the canvas renderer and not for WebGL. Default is `0`. + * works for the canvas renderer and not for WebGL. */ diff --git a/src/ol/Tile.js b/src/ol/Tile.js index a0a22c97a3..2d59a3e037 100644 --- a/src/ol/Tile.js +++ b/src/ol/Tile.js @@ -35,10 +35,8 @@ import EventType from './events/EventType.js'; /** * @typedef {Object} Options - * @property {number|undefined} transition A duration for tile opacity - * transitions. By default, tiles will render with an opacity transition that - * lasts 250 ms. To change the duration, pass a number in milliseconds. A - * duration of 0 disables the opacity transition. + * @property {number} [transition=250] A duration for tile opacity + * transitions in milliseconds. A duration of 0 disables the opacity transition. * @api */ @@ -90,8 +88,7 @@ const Tile = function(tileCoord, state, opt_options) { * The duration for the opacity transition. * @type {number} */ - this.transition_ = options.transition === undefined ? - 250 : options.transition; + this.transition_ = options.transition === undefined ? 250 : options.transition; /** * Lookup of start times for rendering transitions. If the start time is diff --git a/src/ol/control.js b/src/ol/control.js index 9db378f6e5..2f8fe9d746 100644 --- a/src/ol/control.js +++ b/src/ol/control.js @@ -9,7 +9,7 @@ import Zoom from './control/Zoom.js'; /** * @typedef {Object} DefaultsOptions - * @property {boolean|undefined} [attribution=true] Include + * @property {boolean} [attribution=true] Include * {@link module:ol/control/Attribution~Attribution}. * @property {module:ol/control/Attribution~AttributionOptions} [attributionOptions] * Options for {@link module:ol/control/Attribution~Attribution}. diff --git a/src/ol/control/Control.js b/src/ol/control/Control.js index 7832bfd562..9690ddcdb7 100644 --- a/src/ol/control/Control.js +++ b/src/ol/control/Control.js @@ -11,13 +11,13 @@ import {listen, unlistenByKey} from '../events.js'; /** * @typedef {Object} Options - * @property {Element|undefined} element The element is the control's + * @property {Element} [element] The element is the control's * container element. This only needs to be specified if you're developing * a custom control. - * @property {function(module:ol/MapEvent~MapEvent)|undefined} render Function called when + * @property {function(module:ol/MapEvent~MapEvent)} [render] Function called when * the control should be re-rendered. This is called in a `requestAnimationFrame` * callback. - * @property {Element|string|undefined} target Specify a target if you want + * @property {Element|string} [target] Specify a target if you want * the control to be rendered outside of the map's viewport. */ diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index 0fd100fa98..f27ea87bd7 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -34,20 +34,17 @@ const getChangeType = (function() { /** * @typedef {Object} Options - * @property {string|undefined} className CSS class name. Default is - * `'ol-full-screen'`. - * @property {string|Element|undefined} label Text label to use for the button. - * Default is `'\u2922'` (NORTH EAST AND SOUTH WEST ARROW). + * @property {string} [className='ol-full-screen'] CSS class name. + * @property {string|Element} [label='\u2922'] Text label to use for the button. * Instead of text, also an element (e.g. a `span` element) can be used. - * @property {string|Element|undefined} labelActive Text label to use for the - * button when full-screen is active. Default is `'\u00d7'` (a cross). + * @property {string|Element} [labelActive='\u00d7'] Text label to use for the + * button when full-screen is active. * Instead of text, also an element (e.g. a `span` element) can be used. - * @property {string|undefined} tipLabel Text label to use for the button tip. - * Default is `'Toggle full-screen'`. - * @property {boolean|undefined} keys Full keyboard access. - * @property {Element|string|undefined} target Specify a target if you want the + * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip. + * @property {boolean} [keys=false] Full keyboard access. + * @property {Element|string} [target] Specify a target if you want the * control to be rendered outside of the map's viewport. - * @property {Element|string|undefined} source The element to be displayed + * @property {Element|string} [source] The element to be displayed * fullscreen. When not provided, the element containing the map viewport will * be displayed fullscreen. */ diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 017cef0db5..8325ac87db 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -50,7 +50,7 @@ GEOMETRY_WRITERS[GeometryType.MULTI_POLYGON] = writeMultiPolygonGeometry; /** * @typedef {Object} Options - * @property {string|undefined} geometryName Geometry name to use when creating features. + * @property {string} [geometryName] Geometry name to use when creating features. */ diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index 2badf8c6bc..0a7a2fed6a 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -30,7 +30,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten * @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 + * @property {boolean} [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 @@ -38,7 +38,7 @@ import {get as getProjection, equivalent as equivalentProjection, transformExten * 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. + * @property {number} [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 diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index 53ad9e0a27..09d24fb16b 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -20,7 +20,7 @@ import {createElementNS, makeArrayPusher, makeArraySerializer, makeChildAppender /** * @typedef {Object} Options - * @property {function(module:ol/Feature~Feature, Node)|undefined} readExtensions Callback function + * @property {function(module:ol/Feature~Feature, Node)} [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` diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index c3b53b516c..fdf2d2c8af 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -22,9 +22,8 @@ const IGCZ = { /** * @typedef {Object} Options - * @property {IGCZ|string|undefined} altitudeMode Altitude mode. Possible - * values are `'barometric'`, `'gps'`, and `'none'`. Default - * is `'none'`. + * @property {IGCZ|string} [altitudeMode='none'] Altitude mode. Possible + * values are `'barometric'`, `'gps'`, and `'none'`. */ diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index c28d2de3a0..a66cc9cc93 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -24,16 +24,16 @@ import RenderFeature from '../render/Feature.js'; /** * @typedef {Object} Options - * @property {undefined|function((module:ol/geom/Geometry~Geometry|Object.)=)|function(module:ol/geom/GeometryType~GeometryType,Array.,(Array.|Array.>),Object.,number)} featureClass + * @property {function((module:ol/geom/Geometry~Geometry|Object.)=)|function(module:ol/geom/GeometryType~GeometryType,Array.,(Array.|Array.>),Object.,number)} [featureClass] * Class for features returned by {@link ol.format.MVT#readFeatures}. Set to * {@link module:ol/Feature~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 + * @property {string} [geometryName='geometry'] Geometry name to use when creating + * features. + * @property {string} [layerName='layer'] Name of the feature attribute that + * holds the layer name. + * @property {Array.} [layers] Layers to read features from. If not * provided, features will be read from all layers. */ diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index a794451267..68b4a8531a 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -19,8 +19,8 @@ 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`. + * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into + * multiple features on reading. */ diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index 84a54177e9..48bc58b563 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -7,18 +7,16 @@ import {METERS_PER_UNIT} from '../proj/Units.js'; /** * @typedef {Object} Options * @property {string} code The SRS identifier code, e.g. `EPSG:4326`. - * @property {module:ol/proj/Units~Units|string|undefined} units Units. Required unless a + * @property {module:ol/proj/Units~Units|string} [units] Units. Required unless a * proj4 projection is defined for `code`. * @property {module:ol/extent~Extent} [extent] The validity extent for the SRS. - * @property {string|undefined} axisOrientation The axis orientation as specified - * in Proj4. The default is `enu`. - * @property {boolean|undefined} global Whether the projection is valid for the - * whole globe. Default is `false`. - * @property {number|undefined} metersPerUnit The meters per unit for the SRS. + * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4. + * @property {boolean} [global=false] Whether the projection is valid for the whole globe. + * @property {number} [metersPerUnit] The meters per unit for the SRS. * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT} * lookup table. * @property {module:ol/extent~Extent} [worldExtent] The world extent for the SRS. - * @property {(function(number, module:ol/coordinate~Coordinate):number|undefined)} getPointResolution + * @property {function(number, module:ol/coordinate~Coordinate):number} [getPointResolution] * Function to determine resolution at a point. The function is called with a * `{number}` view resolution and an `{module:ol/coordinate~Coordinate}` as arguments, and returns * the `{number}` resolution at the passed coordinate. If this is `undefined`,