diff --git a/config/jsdoc/api/conf.json b/config/jsdoc/api/conf.json index 13cf7460f1..9c46eba800 100644 --- a/config/jsdoc/api/conf.json +++ b/config/jsdoc/api/conf.json @@ -1,6 +1,7 @@ { "opts": { - "recurse": true + "recurse": true, + "template": "config/jsdoc/api/template" }, "tags": { "allowUnknownTags": true diff --git a/config/jsdoc/api/index.md b/config/jsdoc/api/index.md index 48cc20a3f9..4817f900f6 100644 --- a/config/jsdoc/api/index.md +++ b/config/jsdoc/api/index.md @@ -1,43 +1,43 @@ - + - +[View](module-ol_View-View.html) with center, projection, resolution and rotation + - - +[Map default interactions](module-ol_interaction.html#~defaults)
+Interactions for [vector features](module-ol_Feature-Feature.html) + +[All interactions](module-ol_interaction_Interaction-Interaction.html) + - - + +[ol/Geolocation](module-ol_Geolocation.html)
+[ol/Overlay](module-ol_Overlay-Overlay.html)
MapViewLayers

A [map](ol.Map.html) is made of [layers](ol.layer.html), a [view](ol.View.html) to visualize them, [interactions](ol.interaction.html) to modify map content and [controls](ol.control.html) with UI components.

-[Overview](ol.Map.html)
-[Creation](ol.Map.html#Map)
-[Events](ol.MapBrowserEvent.html)

A [map](module-ol_Map-Map.html) is made of [layers](module-ol_layer_Base-BaseLayer.html), a [view](module-ol_View-View.html) to visualize them, [interactions](module-ol_interaction_Interaction-Interaction.html) to modify map content and [controls](module-ol_control_Control-Control.html) with UI components.

+[Overview](module-ol_Map-Map.html)
+[Creation](module-ol_Map-Map.html#Map)
+[Events](module-ol_MapBrowserEvent-MapBrowserEvent.html)

The view manages the visual parameters of the map view, like resolution or rotation.

-[ol.View](ol.View.html) with center, projection, resolution and rotation

Layers are lightweight containers that get their data from [sources](ol.source.html).

-[ol.layer.Tile](ol.layer.Tile.html)
-[ol.layer.Image](ol.layer.Image.html)
-[ol.layer.Vector](ol.layer.Vector.html)
-[ol.layer.VectorTile](ol.layer.VectorTile.html)

Layers are lightweight containers that get their data from [sources](module-ol_source_Source-Source.html).

+[layer/Tile](module-ol_layer_Tile-TileLayer.html)
+[layer/Image](module-ol_layer_Image-ImageLayer.html)
+[layer/Vector](module-ol_layer_Vector-VectorLayer.html)
+[layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)
ControlsInteractionsSources and formats
[Map default controls](ol.control.html#.defaults)
-[All controls](ol.control.html) +
[Map default controls](module-ol_control_util.html#.defaults)
+[All controls](module-ol_control_Control-Control.html)
-[Map default interactions](ol.interaction.html#.defaults)
-Interactions for [vector features](ol.Feature.html) -
  • [ol.interaction.Select](ol.interaction.Select.html)
  • -
  • [ol.interaction.Draw](ol.interaction.Draw.html)
  • -
  • [ol.interaction.Modify](ol.interaction.Modify.html)
-[All interactions](ol.interaction.html)
[Tile sources](ol.source.Tile.html) for [ol.layer.Tile](ol.layer.Tile.html) -
[Image sources](ol.source.Image.html) for [ol.layer.Image](ol.layer.Image.html) -
[Vector sources](ol.source.Vector.html) for [ol.layer.Vector](ol.layer.Vector.html) -
[Vector tile sources](ol.source.VectorTile.html) for [ol.layer.VectorTile](ol.layer.VectorTile.html) -
[Formats](ol.format.Feature.html) for reading/writing vector data -
[ol.format.WMSCapabilities](ol.format.WMSCapabilities.html)
[Tile sources](module-ol_source_Tile-TileSource.html) for [layer/Tile](module-ol_layer_Tile-TileLayer.html) +
[Image sources](module-ol_source_Image-ImageSource.html) for [layer/Image](module-ol_layer_Image-ImageLayer.html) +
[Vector sources](module-ol_source_Vector-VectorSource.html) for [layer/Vector](module-ol_layer_Vector-VectorLayer.html) +
[Vector tile sources](module-ol_source_VectorTile-VectorTile.html) for [layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html) +
[Formats](module-ol_format_Feature-FeatureFormat.html) for reading/writing vector data +
[format/WMSCapabilities](module-ol_format_WMSCapabilities-WMSCapabilities.html)
ProjectionsObservable objectsOther components

All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#.transform) and [ol.proj.transformExtent()](ol.proj.html#.transformExtent).

-[ol.proj](ol.proj.html)

Changes to all [ol.Objects](ol.Object.html) can be observed by calling the [object.on('propertychange')](ol.Object.html#on) method. Listeners receive an [ol.Object.Event](ol.Object.Event.html) with information on the changed property and old value.

+

All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [proj.transform()](module-ol_proj.html#.transform) and [proj.transformExtent()](module-ol_proj.html#.transformExtent).

+[ol/proj](module-ol_proj.html)

Changes to all [ol/Object](module-ol_Object-BaseObject.html)s can be observed by calling the [object.on('propertychange')](module-ol_Object-BaseObject.html#on) method. Listeners receive an [ol/Object~ObjectEvent](module-ol_Object-ObjectEvent.html) with information on the changed property and old value.

-[ol.Geolocation](ol.Geolocation.html)
-[ol.Overlay](ol.Overlay.html)
  @@ -52,11 +52,4 @@ The OpenLayers API consists of Within a major release series, the API will not be changed. Any changes to the API will be accompanied by a new major release. -*Note*: The API change policy does not cover CSS class names that are used to style the -OpenLayers UI. - -*Note for Closure Compiler users compiling their application code together with OpenLayers*: -The names of types other than those in the list above (e.g. `ol.Coordinate`) are subject to change. It -is therefore recommended to either use the resolved type as listed in the API docs (e.g. -`Array.` instead of `ol.Coordinate`), or pay attention to the upgrade notes, which will list -the changes for those types. +*Note*: The API change policy does not cover CSS class names that are used to style the OpenLayers UI. It also does not cover any typedefs and enums. diff --git a/config/jsdoc/api/plugins/api.js b/config/jsdoc/api/plugins/api.js index b7d9390548..56635004df 100644 --- a/config/jsdoc/api/plugins/api.js +++ b/config/jsdoc/api/plugins/api.js @@ -76,15 +76,12 @@ function extractTypes(item) { } function includeTypes(doclet) { - if (doclet.params && doclet.kind != 'class') { + if (doclet.params) { doclet.params.forEach(extractTypes); } if (doclet.returns) { doclet.returns.forEach(extractTypes); } - if (doclet.isEnum) { - types[doclet.meta.code.name] = true; - } if (doclet.type && doclet.meta.code.type == 'MemberExpression') { extractTypes(doclet); } @@ -131,6 +128,10 @@ exports.handlers = { continue; } if (doclet.kind == 'module' && doclet.longname in modules) { + // Document all modules that are referenced by the API + continue; + } + if (doclet.isEnum) { continue; } if (doclet.kind == 'class' && api.some(hasApiMembers, doclet)) { diff --git a/config/jsdoc/api/plugins/default-export.js b/config/jsdoc/api/plugins/default-export.js index e85d0941f7..593f2eceea 100644 --- a/config/jsdoc/api/plugins/default-export.js +++ b/config/jsdoc/api/plugins/default-export.js @@ -22,7 +22,7 @@ function addDefaultExportPath(obj) { const lines = file.split('\n'); let hasDefaultExport = false; for (let i = 0, ii = lines.length; i < ii; ++i) { - hasDefaultExport = hasDefaultExport || lines[i].indexOf('export default ') == 0; + hasDefaultExport = hasDefaultExport || /^export default [^\{]/.test(lines[i]); const match = lines[i].match(/^export default ([A-Za-z_$][A-Za-z0-9_$]+);$/); if (match) { // Use variable name if default export is assigned to a variable. diff --git a/config/jsdoc/api/plugins/observable.js b/config/jsdoc/api/plugins/observable.js index 4622987d07..44e7353c54 100644 --- a/config/jsdoc/api/plugins/observable.js +++ b/config/jsdoc/api/plugins/observable.js @@ -47,7 +47,7 @@ exports.handlers = { if (!cls.fires) { cls.fires = []; } - event = 'ol.Object.Event#event:change:' + name; + event = 'module:ol/Object~ObjectEvent#event:change:' + name; if (cls.fires.indexOf(event) == -1) { cls.fires.push(event); } diff --git a/config/jsdoc/api/template/publish.js b/config/jsdoc/api/template/publish.js index a5d5de68b1..dbebe1da7a 100644 --- a/config/jsdoc/api/template/publish.js +++ b/config/jsdoc/api/template/publish.js @@ -1,4 +1,13 @@ /*global env: true */ + +const hasOwnProp = Object.prototype.hasOwnProperty; + +// Work around an issue with hasOwnProperty in JSDoc's templateHelper.js. +//TODO Fix in JSDoc. +Object.prototype.hasOwnProperty = function(property) { + return property in this; +}; + const template = require('jsdoc/lib/jsdoc/template'); const fs = require('jsdoc/lib/jsdoc/fs'); const path = require('jsdoc/lib/jsdoc/path'); @@ -9,9 +18,12 @@ const _ = require('underscore'); const htmlsafe = helper.htmlsafe; const linkto = helper.linkto; const resolveAuthorLinks = helper.resolveAuthorLinks; -const hasOwnProp = Object.prototype.hasOwnProperty; const outdir = env.opts.destination; +// Work around an issue with hasOwnProperty in JSDoc's templateHelper.js. +//TODO Fix in JSDoc. +Object.prototype.hasOwnProperty = hasOwnProp; + let view; let data; @@ -192,7 +204,7 @@ function attachModuleSymbols(doclets, modules) { function buildNav(members) { const nav = []; // merge namespaces and classes, then sort - const merged = members.namespaces.concat(members.classes); + const merged = members.modules.concat(members.classes); merged.sort(function(a, b) { if (a.longname > b.longname) { return 1; @@ -205,9 +217,9 @@ function buildNav(members) { _.each(merged, function(v) { // exclude interfaces from sidebar if (v.interface !== true) { - if (v.kind == 'namespace') { + if (v.kind == 'module') { nav.push({ - type: 'namespace', + type: 'module', longname: v.longname, name: v.name, members: find({ diff --git a/config/jsdoc/api/template/tmpl/container.tmpl b/config/jsdoc/api/template/tmpl/container.tmpl index 5a41fdf963..39568170b8 100644 --- a/config/jsdoc/api/template/tmpl/container.tmpl +++ b/config/jsdoc/api/template/tmpl/container.tmpl @@ -20,12 +20,10 @@
a.replace(/>\./g, '>').replace(/\.
import  from '';
diff --git a/config/jsdoc/api/template/tmpl/navigation.tmpl b/config/jsdoc/api/template/tmpl/navigation.tmpl index 2fe64ace28..f57d604640 100644 --- a/config/jsdoc/api/template/tmpl/navigation.tmpl +++ b/config/jsdoc/api/template/tmpl/navigation.tmpl @@ -11,7 +11,7 @@ var self = this; ?>
  • - + 0)) { ?> diff --git a/config/jsdoc/api/template/tmpl/observables.tmpl b/config/jsdoc/api/template/tmpl/observables.tmpl index 99b372e6f3..2bd88204b1 100644 --- a/config/jsdoc/api/template/tmpl/observables.tmpl +++ b/config/jsdoc/api/template/tmpl/observables.tmpl @@ -8,7 +8,7 @@ Name Type Settable - ol.Object.Event type + ol/Object~ObjectEvent type Description diff --git a/package.json b/package.json index 72228ece8f..b1512c6bca 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "src-closure": "babel -q --out-dir build/src-closure src/", "pretypecheck": "npm run src-closure", "typecheck": "node tasks/typecheck", - "apidoc": "jsdoc -c config/jsdoc/api/conf.json -d build/apidoc" + "apidoc": "jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -d build/apidoc" }, "main": "src/ol/index.js", "repository": { diff --git a/src/ol/ObjectEventType.js b/src/ol/ObjectEventType.js index 2fc546c02b..6bbdd2c8af 100644 --- a/src/ol/ObjectEventType.js +++ b/src/ol/ObjectEventType.js @@ -8,7 +8,7 @@ export default { /** * Triggered when a property is changed. - * @event module:ol/Object~Event#propertychange + * @event module:ol/Object~ObjectEvent#propertychange * @api */ PROPERTYCHANGE: 'propertychange' diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 79a43eb1df..f48bd698f5 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -28,7 +28,7 @@ import {assign} from '../obj.js'; * Abstract base class; normally only used for creating subclasses and not * instantiated in apps. * Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in - * the options is set as a {@link module:ol/Object property on the layer object, so + * the options is set as a {@link module:ol/Object} property on the layer object, so * is observable, and has get/set accessors. * * @constructor diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index 588aa94289..8abc57f9d2 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -58,7 +58,7 @@ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00']; /** * @classdesc * Layer for rendering vector data as a heatmap. - * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * diff --git a/src/ol/layer/Image.js b/src/ol/layer/Image.js index 96ba7a87df..04742c5a5b 100644 --- a/src/ol/layer/Image.js +++ b/src/ol/layer/Image.js @@ -30,7 +30,7 @@ import Layer from '../layer/Layer.js'; * @classdesc * Server-rendered images that are available for arbitrary extents and * resolutions. - * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * diff --git a/src/ol/layer/Tile.js b/src/ol/layer/Tile.js index df68e39cfa..9a293be109 100644 --- a/src/ol/layer/Tile.js +++ b/src/ol/layer/Tile.js @@ -35,7 +35,7 @@ import {assign} from '../obj.js'; * @classdesc * For layer sources that provide pre-rendered, tiled images in grids that are * organized by zoom levels for specific resolutions. - * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 57993b80f1..5b19b459f5 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -80,7 +80,7 @@ const Property = { /** * @classdesc * Vector data that is rendered client-side. - * Note that any property set in the options is set as a {@link } + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 2f9afc660a..8e44dd43f2 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -91,7 +91,7 @@ export const RenderType = { /** * @classdesc * Layer for vector tile data that is rendered client-side. - * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject + * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject} * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. *