Merge pull request #7965 from tschaub/types

Redistribute types from externs/olx.js
This commit is contained in:
Tim Schaub
2018-03-11 12:41:14 -06:00
committed by GitHub
16 changed files with 306 additions and 1120 deletions

View File

@@ -2,8 +2,8 @@
* @fileoverview Generates JSON output based on exportable symbols (those with
* an api tag) and boolean defines (with a define tag and a default value).
*/
var assert = require('assert');
var path = require('path');
const assert = require('assert');
const path = require('path');
/**
@@ -15,7 +15,7 @@ var path = require('path');
exports.publish = function(data, opts) {
function getTypes(data) {
var types = [];
const types = [];
data.forEach(function(name) {
types.push(name.replace(/^function$/, 'Function'));
});
@@ -24,43 +24,43 @@ exports.publish = function(data, opts) {
// get all doclets with the "api" property or define (excluding events) or
// with olx namespace
var classes = {};
var docs = data(
[
{define: {isObject: true}},
function() {
if (this.kind == 'class') {
if (!('extends' in this) || typeof this.api == 'boolean') {
classes[this.longname] = this;
return true;
}
const classes = {};
const docs = data(
[
{define: {isObject: true}},
function() {
if (this.kind == 'class') {
if (!('extends' in this) || typeof this.api == 'boolean') {
classes[this.longname] = this;
return true;
}
return (typeof this.api == 'boolean' ||
this.meta && (/[\\\/]externs$/).test(this.meta.path));
}
],
{kind: {'!is': 'file'}},
{kind: {'!is': 'event'}}).get();
return (typeof this.api == 'boolean' ||
this.meta && (/[\\\/]externs$/).test(this.meta.path));
}
],
{kind: {'!is': 'file'}},
{kind: {'!is': 'event'}}).get();
// get symbols data, filter out those that are members of private classes
var symbols = [];
var defines = [];
var typedefs = [];
var externs = [];
var base = [];
var augments = {};
var symbolsByName = {};
const symbols = [];
const defines = [];
const typedefs = [];
const externs = [];
let base = [];
const augments = {};
const symbolsByName = {};
docs.filter(function(doc) {
var include = true;
var constructor = doc.memberof;
let include = true;
const constructor = doc.memberof;
if (constructor && constructor.substr(-1) === '_' && constructor.indexOf('module:') === -1) {
assert.strictEqual(doc.inherited, true,
'Unexpected export on private class: ' + doc.longname);
'Unexpected export on private class: ' + doc.longname);
include = false;
}
return include;
}).forEach(function(doc) {
var isExterns = (/[\\\/]externs$/).test(doc.meta.path);
const isExterns = (/[\\\/]externs$/).test(doc.meta.path);
if (isExterns && doc.longname.indexOf('olx.') === 0) {
if (doc.kind == 'typedef') {
typedefs.push({
@@ -68,12 +68,15 @@ exports.publish = function(data, opts) {
types: ['{}']
});
} else {
var typedef = typedefs[typedefs.length - 1];
var type = typedef.types[0];
const typedef = typedefs[typedefs.length - 1];
if (!typedef) {
throw new Error(`Expected to see a typedef before ${doc.longname} at ${doc.meta.filename}:${doc.meta.lineno}`);
}
const type = typedef.types[0];
typedef.types[0] = type
.replace(/\}$/, ', ' + doc.longname.split('#')[1] +
.replace(/\}$/, ', ' + doc.longname.split('#')[1] +
': (' + getTypes(doc.type.names).join('|') + ')}')
.replace('{, ', '{');
.replace('{, ', '{');
}
} else if (doc.define) {
defines.push({
@@ -88,7 +91,7 @@ exports.publish = function(data, opts) {
types: getTypes(doc.type.names)
});
} else {
var symbol = {
const symbol = {
name: doc.longname,
kind: doc.kind,
description: doc.classdesc || doc.description,
@@ -104,9 +107,9 @@ exports.publish = function(data, opts) {
symbol.types = getTypes(doc.type.names);
}
if (doc.params) {
var params = [];
const params = [];
doc.params.forEach(function(param) {
var paramInfo = {
const paramInfo = {
name: param.name
};
params.push(paramInfo);
@@ -141,10 +144,10 @@ exports.publish = function(data, opts) {
});
}
var target = isExterns ? externs : (doc.api ? symbols : base);
var existingSymbol = symbolsByName[symbol.name];
const target = isExterns ? externs : (doc.api ? symbols : base);
const existingSymbol = symbolsByName[symbol.name];
if (existingSymbol) {
var idx = target.indexOf(existingSymbol);
const idx = target.indexOf(existingSymbol);
target.splice(idx, 1);
}
target.push(symbol);
@@ -168,13 +171,13 @@ exports.publish = function(data, opts) {
return new Promise(function(resolve, reject) {
process.stdout.write(
JSON.stringify({
symbols: symbols,
defines: defines,
typedefs: typedefs,
externs: externs,
base: base
}, null, 2));
JSON.stringify({
symbols: symbols,
defines: defines,
typedefs: typedefs,
externs: externs,
base: base
}, null, 2));
});
};

View File

@@ -2,868 +2,7 @@
/**
* @type {Object}
*/
var olx;
/**
* Object literal with options for the {@link ol.Map#forEachFeatureAtPixel} and
* {@link ol.Map#hasFeatureAtPixel} methods.
* @typedef {{layerFilter: ((function(ol.layer.Layer): boolean)|undefined),
* hitTolerance: (number|undefined)}}
*/
olx.AtPixelOptions;
/**
* Layer filter function. The filter function will receive one argument, the
* {@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.
* @type {((function(ol.layer.Layer): boolean)|undefined)}
* @api
*/
olx.AtPixelOptions.prototype.layerFilter;
/**
* 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`.
* @type {number|undefined}
* @api
*/
olx.AtPixelOptions.prototype.hitTolerance;
/**
* Object literal with config options for the projection.
* @typedef {{code: string,
* units: (ol.proj.Units|string|undefined),
* extent: (ol.Extent|undefined),
* axisOrientation: (string|undefined),
* global: (boolean|undefined),
* metersPerUnit: (number|undefined),
* worldExtent: (ol.Extent|undefined),
* getPointResolution: (function(number, ol.Coordinate):number|undefined) }}
*/
olx.ProjectionOptions;
/**
* The SRS identifier code, e.g. `EPSG:4326`.
* @type {string}
* @api
*/
olx.ProjectionOptions.prototype.code;
/**
* Units. Required unless a proj4 projection is defined for `code`.
* @type {ol.proj.Units|string|undefined}
* @api
*/
olx.ProjectionOptions.prototype.units;
/**
* The validity extent for the SRS.
* @type {ol.Extent|undefined}
* @api
*/
olx.ProjectionOptions.prototype.extent;
/**
* The axis orientation as specified in Proj4. The default is `enu`.
* @type {string|undefined}
* @api
*/
olx.ProjectionOptions.prototype.axisOrientation;
/**
* Whether the projection is valid for the whole globe. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.ProjectionOptions.prototype.global;
/**
* The meters per unit for the SRS. If not provided, the `units` are used to get
* the meters per unit from the {@link ol.proj.METERS_PER_UNIT} lookup table.
* @type {number|undefined}
* @api
*/
olx.ProjectionOptions.prototype.metersPerUnit;
/**
* The world extent for the SRS.
* @type {ol.Extent|undefined}
* @api
*/
olx.ProjectionOptions.prototype.worldExtent;
/**
* Function to determine resolution at a point. The function is called with a
* `{number}` view resolution and an `{ol.Coordinate}` as arguments, and returns
* the `{number}` resolution at the passed coordinate. If this is `undefined`,
* the default {@link ol.proj#getPointResolution} function will be used.
* @type {(function(number, ol.Coordinate):number|undefined)}
* @api
*/
olx.ProjectionOptions.prototype.getPointResolution;
/**
* @typedef {{
* center: (ol.Coordinate|undefined),
* zoom: (number|undefined),
* resolution: (number|undefined),
* rotation: (number|undefined),
* anchor: (ol.Coordinate|undefined),
* duration: (number|undefined),
* easing: (undefined|function(number):number)
* }}
*/
olx.AnimationOptions;
/**
* The center of the view at the end of the animation.
* @type {ol.Coordinate|undefined}
* @api
*/
olx.AnimationOptions.prototype.center;
/**
* The zoom level of the view at the end of the animation. This takes
* precedence over `resolution`.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.zoom;
/**
* The resolution of the view at the end of the animation. If `zoom` is also
* provided, this option will be ignored.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.resolution;
/**
* The rotation of the view at the end of the animation.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.rotation;
/**
* Optional anchor to remained fixed during a rotation or resolution animation.
* @type {ol.Coordinate|undefined}
* @api
*/
olx.AnimationOptions.prototype.anchor;
/**
* The duration of the animation in milliseconds (defaults to `1000`).
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.duration;
/**
* The easing function used during the animation (defaults to {@link ol.easing.inAndOut}).
* The function will be called for each frame with a number representing a
* fraction of the animation's duration. The function should return a number
* between 0 and 1 representing the progress toward the destination state.
* @type {undefined|function(number):number}
* @api
*/
olx.AnimationOptions.prototype.easing;
/**
* Namespace.
* @type {Object}
*/
olx.control;
/**
* @typedef {{className: (string|undefined),
* collapsible: (boolean|undefined),
* collapsed: (boolean|undefined),
* tipLabel: (string|undefined),
* label: (string|Element|undefined),
* collapseLabel: (string|Element|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|string|undefined)}}
*/
olx.control.AttributionOptions;
/**
* CSS class name. Default is `ol-attribution`.
* @type {string|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.className;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.target;
/**
* Specify if attributions can be collapsed. If you use an OSM source,
* should be set to `false` — see
* {@link https://www.openstreetmap.org/copyright OSM Copyright} —
* Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.collapsible;
/**
* Specify if attributions should be collapsed at startup. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.collapsed;
/**
* Text label to use for the button tip. Default is `Attributions`
* @type {string|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.tipLabel;
/**
* Text label to use for the collapsed attributions button. Default is `i`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.label;
/**
* Text label to use for the expanded attributions button. Default is `»`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.collapseLabel;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.AttributionOptions.prototype.render;
/**
* @typedef {{element: (Element|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|string|undefined)}}
*/
olx.control.ControlOptions;
/**
* The element is the control's container element. This only needs to be
* specified if you're developing a custom control.
* @type {Element|undefined}
* @api
*/
olx.control.ControlOptions.prototype.element;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.ControlOptions.prototype.render;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.ControlOptions.prototype.target;
/**
* @typedef {{className: (string|undefined),
* label: (string|Element|undefined),
* labelActive: (string|Element|undefined),
* tipLabel: (string|undefined),
* keys: (boolean|undefined),
* target: (Element|string|undefined),
* source: (Element|string|undefined)}}
*/
olx.control.FullScreenOptions;
/**
* CSS class name. Default is `ol-full-screen`.
* @type {string|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.className;
/**
* Text label to use for the button. Default is `\u2922` (NORTH EAST AND SOUTH WEST ARROW).
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.label;
/**
* Text label to use for the button when full-screen is active.
* Default is `\u00d7` (a cross).
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.labelActive;
/**
* Text label to use for the button tip. Default is `Toggle full-screen`
* @type {string|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.tipLabel;
/**
* Full keyboard access.
* @type {boolean|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.keys;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.target;
/**
* The element to be displayed fullscreen. When not provided, the element containing the map viewport will be displayed fullscreen.
* @type {Element|string|undefined}
* @api
*/
olx.control.FullScreenOptions.prototype.source;
/**
* @typedef {{className: (string|undefined),
* coordinateFormat: (module:ol/coordinate~CoordinateFormat|undefined),
* projection: ol.ProjectionLike,
* render: (function(ol.MapEvent)|undefined),
* target: (Element|string|undefined),
* undefinedHTML: (string|undefined)}}
*/
olx.control.MousePositionOptions;
/**
* CSS class name. Default is `ol-mouse-position`.
* @type {string|undefined}
* @api
*/
olx.control.MousePositionOptions.prototype.className;
/**
* Coordinate format.
* @type {module:ol/coordinate~CoordinateFormat|undefined}
* @api
*/
olx.control.MousePositionOptions.prototype.coordinateFormat;
/**
* Projection.
* @type {ol.ProjectionLike}
* @api
*/
olx.control.MousePositionOptions.prototype.projection;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.MousePositionOptions.prototype.render;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.MousePositionOptions.prototype.target;
/**
* Markup for undefined coordinates. Default is `` (empty string).
* @type {string|undefined}
* @api
*/
olx.control.MousePositionOptions.prototype.undefinedHTML;
/**
* @typedef {{collapsed: (boolean|undefined),
* collapseLabel: (string|Element|undefined),
* collapsible: (boolean|undefined),
* label: (string|Element|undefined),
* layers: (Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|string|undefined),
* tipLabel: (string|undefined),
* view: (ol.View|undefined)}}
*/
olx.control.OverviewMapOptions;
/**
* Whether the control should start collapsed or not (expanded).
* Default to `true`.
* @type {boolean|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.collapsed;
/**
* Text label to use for the expanded overviewmap button. Default is `«`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.collapseLabel;
/**
* Whether the control can be collapsed or not. Default to `true`.
* @type {boolean|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.collapsible;
/**
* Text label to use for the collapsed overviewmap button. Default is `»`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.label;
/**
* Layers for the overview map. If not set, then all main map layers are used
* instead.
* @type {Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.layers;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.render;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.target;
/**
* Text label to use for the button tip. Default is `Overview map`
* @type {string|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.tipLabel;
/**
* Custom view for the overview map. If not provided, a default view with
* an EPSG:3857 projection will be used.
* @type {ol.View|undefined}
* @api
*/
olx.control.OverviewMapOptions.prototype.view;
/**
* @typedef {{className: (string|undefined),
* minWidth: (number|undefined),
* render: (function(ol.MapEvent)|undefined),
* target: (Element|string|undefined),
* units: (ol.control.ScaleLineUnits|string|undefined)}}
*/
olx.control.ScaleLineOptions;
/**
* CSS Class name. Default is `ol-scale-line`.
* @type {string|undefined}
* @api
*/
olx.control.ScaleLineOptions.prototype.className;
/**
* Minimum width in pixels. Default is `64`.
* @type {number|undefined}
* @api
*/
olx.control.ScaleLineOptions.prototype.minWidth;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.ScaleLineOptions.prototype.render;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.ScaleLineOptions.prototype.target;
/**
* Units. Default is `metric`.
* @type {ol.control.ScaleLineUnits|string|undefined}
* @api
*/
olx.control.ScaleLineOptions.prototype.units;
/**
* @typedef {{duration: (number|undefined),
* className: (string|undefined),
* label: (string|Element|undefined),
* tipLabel: (string|undefined),
* target: (Element|string|undefined),
* render: (function(ol.MapEvent)|undefined),
* resetNorth: (function()|undefined),
* autoHide: (boolean|undefined)}}
*/
olx.control.RotateOptions;
/**
* CSS class name. Default is `ol-rotate`.
* @type {string|undefined}
* @api
*/
olx.control.RotateOptions.prototype.className;
/**
* Text label to use for the rotate button. Default is `⇧`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.RotateOptions.prototype.label;
/**
* Text label to use for the rotate tip. Default is `Reset rotation`
* @type {string|undefined}
* @api
*/
olx.control.RotateOptions.prototype.tipLabel;
/**
* Animation duration in milliseconds. Default is `250`.
* @type {number|undefined}
* @api
*/
olx.control.RotateOptions.prototype.duration;
/**
* Hide the control when rotation is 0. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.control.RotateOptions.prototype.autoHide;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.RotateOptions.prototype.render;
/**
* Function called when the control is clicked. This will override the
* default resetNorth.
* @type {function()|undefined}
* @api
*/
olx.control.RotateOptions.prototype.resetNorth;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.RotateOptions.prototype.target;
/**
* @typedef {{duration: (number|undefined),
* className: (string|undefined),
* zoomInLabel: (string|Element|undefined),
* zoomOutLabel: (string|Element|undefined),
* zoomInTipLabel: (string|undefined),
* zoomOutTipLabel: (string|undefined),
* delta: (number|undefined),
* target: (Element|string|undefined)}}
*/
olx.control.ZoomOptions;
/**
* Animation duration in milliseconds. Default is `250`.
* @type {number|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.duration;
/**
* CSS class name. Default is `ol-zoom`.
* @type {string|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.className;
/**
* Text label to use for the zoom-in button. Default is `+`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.zoomInLabel;
/**
* Text label to use for the zoom-out button. Default is `-`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.zoomOutLabel;
/**
* Text label to use for the button tip. Default is `Zoom in`
* @type {string|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.zoomInTipLabel;
/**
* Text label to use for the button tip. Default is `Zoom out`
* @type {string|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.zoomOutTipLabel;
/**
* The zoom delta applied on each click.
* @type {number|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.delta;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.ZoomOptions.prototype.target;
/**
* @typedef {{className: (string|undefined),
* duration: (number|undefined),
* maxResolution: (number|undefined),
* minResolution: (number|undefined),
* render: (function(ol.MapEvent)|undefined)}}
*/
olx.control.ZoomSliderOptions;
/**
* CSS class name.
* @type {string|undefined}
* @api
*/
olx.control.ZoomSliderOptions.prototype.className;
/**
* Animation duration in milliseconds. Default is `200`.
* @type {number|undefined}
* @api
*/
olx.control.ZoomSliderOptions.prototype.duration;
/**
* Maximum resolution.
* @type {number|undefined}
* @api
*/
olx.control.ZoomSliderOptions.prototype.maxResolution;
/**
* Minimum resolution.
* @type {number|undefined}
* @api
*/
olx.control.ZoomSliderOptions.prototype.minResolution;
/**
* Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @type {function(ol.MapEvent)|undefined}
* @api
*/
olx.control.ZoomSliderOptions.prototype.render;
/**
* @typedef {{className: (string|undefined),
* target: (Element|string|undefined),
* label: (string|Element|undefined),
* tipLabel: (string|undefined),
* extent: (ol.Extent|undefined)}}
*/
olx.control.ZoomToExtentOptions;
/**
* Class name. Default is `ol-zoom-extent`.
* @type {string|undefined}
* @api
*/
olx.control.ZoomToExtentOptions.prototype.className;
/**
* Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @type {Element|string|undefined}
* @api
*/
olx.control.ZoomToExtentOptions.prototype.target;
/**
* Text label to use for the button. Default is `E`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @type {string|Element|undefined}
* @api
*/
olx.control.ZoomToExtentOptions.prototype.label;
/**
* Text label to use for the button tip. Default is `Zoom to extent`
* @type {string|undefined}
* @api
*/
olx.control.ZoomToExtentOptions.prototype.tipLabel;
/**
* The extent to zoom to. If undefined the validity extent of the view
* projection is used.
* @type {ol.Extent|undefined}
* @api
*/
olx.control.ZoomToExtentOptions.prototype.extent;
/**
* Namespace.
* @type {Object}
*/
olx.format;
let olx;
/**

View File

@@ -1,200 +1,4 @@
/**
* @typedef {Object} AtPixelOptions
* @property {((function(ol.layer.Layer): boolean)|undefined)} layerFilter Layer filter function. The filter function will receive one argument, the
* {@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 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`.
*/
/**
* @typedef {Object} ProjectionOptions
* @property {string} code The SRS identifier code, e.g. `EPSG:4326`.
* @property {ol.proj.Units|string|undefined} units Units. Required unless a proj4 projection is defined for `code`.
* @property {ol.Extent|undefined} 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. If not provided, the `units` are used to get
* the meters per unit from the {@link ol.proj.METERS_PER_UNIT} lookup table.
* @property {ol.Extent|undefined} worldExtent The world extent for the SRS.
* @property {(function(number, ol.Coordinate):number|undefined)} getPointResolution Function to determine resolution at a point. The function is called with a
* `{number}` view resolution and an `{ol.Coordinate}` as arguments, and returns
* the `{number}` resolution at the passed coordinate. If this is `undefined`,
* the default {@link ol.proj#getPointResolution} function will be used.
*/
/**
* @typedef {Object} AnimationOptions
* @property {ol.Coordinate|undefined} center The center of the view at the end of the animation.
* @property {number|undefined} zoom The zoom level of the view at the end of the animation. This takes
* precedence over `resolution`.
* @property {number|undefined} resolution The resolution of the view at the end of the animation. If `zoom` is also
* provided, this option will be ignored.
* @property {number|undefined} rotation The rotation of the view at the end of the animation.
* @property {ol.Coordinate|undefined} anchor Optional anchor to remained fixed during a rotation or resolution animation.
* @property {number|undefined} duration The duration of the animation in milliseconds (defaults to `1000`).
* @property {undefined|function(number):number} easing The easing function used during the animation (defaults to {@link ol.easing.inAndOut}).
* The function will be called for each frame with a number representing a
* fraction of the animation's duration. The function should return a number
* between 0 and 1 representing the progress toward the destination state.
*/
/**
* @typedef {Object} control_AttributionOptions
* @property {string|undefined} className CSS class name. Default is `ol-attribution`.
* @property {Element|string|undefined} target Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @property {boolean|undefined} collapsible Specify if attributions can be collapsed. If you use an OSM source,
* should be set to `false` — see
* {@link https://www.openstreetmap.org/copyright OSM Copyright} —
* Default is `true`.
* @property {boolean|undefined} collapsed Specify if attributions should be collapsed at startup. Default is `true`.
* @property {string|undefined} tipLabel Text label to use for the button tip. Default is `Attributions`
* @property {string|Element|undefined} label Text label to use for the collapsed attributions button. Default is `i`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|Element|undefined} collapseLabel Text label to use for the expanded attributions button. Default is `»`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {function(ol.MapEvent)|undefined} render Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
*/
/**
* @typedef {Object} control_ControlOptions
* @property {Element|undefined} element The element is the control's container element. This only needs to be
* specified if you're developing a custom control.
* @property {function(ol.MapEvent)|undefined} 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 the control to be rendered outside of the map's
* viewport.
*/
/**
* @typedef {Object} control_FullScreenOptions
* @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).
* 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).
* 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 control to be rendered outside of the map's
* viewport.
* @property {Element|string|undefined} source The element to be displayed fullscreen. When not provided, the element containing the map viewport will be displayed fullscreen.
*/
/**
* @typedef {Object} control_MousePositionOptions
* @property {string|undefined} className CSS class name. Default is `ol-mouse-position`.
* @property {module:ol/coordinate~CoordinateFormat|undefined} coordinateFormat Coordinate format.
* @property {ol.ProjectionLike} projection Projection.
* @property {function(ol.MapEvent)|undefined} 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 the control to be rendered outside of the map's
* viewport.
* @property {string|undefined} undefinedHTML Markup for undefined coordinates. Default is `` (empty string).
*/
/**
* @typedef {Object} control_OverviewMapOptions
* @property {boolean|undefined} collapsed Whether the control should start collapsed or not (expanded).
* Default to `true`.
* @property {string|Element|undefined} collapseLabel Text label to use for the expanded overviewmap button. Default is `«`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {boolean|undefined} collapsible Whether the control can be collapsed or not. Default to `true`.
* @property {string|Element|undefined} label Text label to use for the collapsed overviewmap button. Default is `»`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined} layers Layers for the overview map. If not set, then all main map layers are used
* instead.
* @property {function(ol.MapEvent)|undefined} 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 the control to be rendered outside of the map's
* viewport.
* @property {string|undefined} tipLabel Text label to use for the button tip. Default is `Overview map`
* @property {ol.View|undefined} view Custom view for the overview map. If not provided, a default view with
* an EPSG:3857 projection will be used.
*/
/**
* @typedef {Object} control_ScaleLineOptions
* @property {string|undefined} className CSS Class name. Default is `ol-scale-line`.
* @property {number|undefined} minWidth Minimum width in pixels. Default is `64`.
* @property {function(ol.MapEvent)|undefined} 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 the control to be rendered outside of the map's
* viewport.
* @property {ol.control.ScaleLineUnits|string|undefined} units Units. Default is `metric`.
*/
/**
* @typedef {Object} control_RotateOptions
* @property {string|undefined} className CSS class name. Default is `ol-rotate`.
* @property {string|Element|undefined} label Text label to use for the rotate button. Default is `⇧`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|undefined} tipLabel Text label to use for the rotate tip. Default is `Reset rotation`
* @property {number|undefined} duration Animation duration in milliseconds. Default is `250`.
* @property {boolean|undefined} autoHide Hide the control when rotation is 0. Default is `true`.
* @property {function(ol.MapEvent)|undefined} render Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
* @property {function()|undefined} resetNorth Function called when the control is clicked. This will override the
* default resetNorth.
* @property {Element|string|undefined} target Specify a target if you want the control to be rendered outside of the map's
* viewport.
*/
/**
* @typedef {Object} control_ZoomOptions
* @property {number|undefined} duration Animation duration in milliseconds. Default is `250`.
* @property {string|undefined} className CSS class name. Default is `ol-zoom`.
* @property {string|Element|undefined} zoomInLabel Text label to use for the zoom-in button. Default is `+`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|Element|undefined} zoomOutLabel Text label to use for the zoom-out button. Default is `-`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|undefined} zoomInTipLabel Text label to use for the button tip. Default is `Zoom in`
* @property {string|undefined} zoomOutTipLabel Text label to use for the button tip. Default is `Zoom out`
* @property {number|undefined} delta The zoom delta applied on each click.
* @property {Element|string|undefined} target Specify a target if you want the control to be rendered outside of the map's
* viewport.
*/
/**
* @typedef {Object} control_ZoomSliderOptions
* @property {string|undefined} className CSS class name.
* @property {number|undefined} duration Animation duration in milliseconds. Default is `200`.
* @property {number|undefined} maxResolution Maximum resolution.
* @property {number|undefined} minResolution Minimum resolution.
* @property {function(ol.MapEvent)|undefined} render Function called when the control should be re-rendered. This is called
* in a requestAnimationFrame callback.
*/
/**
* @typedef {Object} control_ZoomToExtentOptions
* @property {string|undefined} className Class name. Default is `ol-zoom-extent`.
* @property {Element|string|undefined} target Specify a target if you want the control to be rendered outside of the map's
* viewport.
* @property {string|Element|undefined} label Text label to use for the button. Default is `E`.
* 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 `Zoom to extent`
* @property {ol.Extent|undefined} extent The extent to zoom to. If undefined the validity extent of the view
* projection is used.
*/
/**
* @typedef {Object} format_ReadOptions
* @property {ol.ProjectionLike} dataProjection Projection of the data we are reading. If not provided, the projection will

View File

@@ -61,6 +61,19 @@ import {create as createTransform, apply as applyTransform} from './transform.js
*/
/**
* @typedef {Object} AtPixelOptions
* @property {((function(ol.layer.Layer): boolean)|undefined)} layerFilter Layer filter
* function. The filter function will receive one argument, the
* {@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
* 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`.
*/
/**
* @typedef {Object} MapOptionsInternal
* @property {module:ol/Collection~Collection.<module:ol/control/Control~Control>} [controls]
@@ -554,7 +567,7 @@ PluggableMap.prototype.disposeInternal = function() {
* the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for
* unmanaged layers. To stop detection, callback functions can return a
* truthy value.
* @param {olx.AtPixelOptions=} opt_options Optional options.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options.
* @return {T|undefined} Callback result, i.e. the return value of last
* callback execution, or the first truthy callback return value.
* @template S,T
@@ -579,7 +592,7 @@ PluggableMap.prototype.forEachFeatureAtPixel = function(pixel, callback, opt_opt
/**
* Get all features that intersect a pixel on the viewport.
* @param {module:ol~Pixel} pixel Pixel.
* @param {olx.AtPixelOptions=} opt_options Optional options.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options.
* @return {Array.<module:ol/Feature~Feature|module:ol/render/Feature~Feature>} The detected features or
* `null` if none were found.
* @api
@@ -636,7 +649,7 @@ PluggableMap.prototype.forEachLayerAtPixel = function(pixel, callback, opt_this,
* Detect if features intersect a pixel on the viewport. Layers included in the
* detection can be configured through `opt_layerFilter`.
* @param {module:ol~Pixel} pixel Pixel.
* @param {olx.AtPixelOptions=} opt_options Optional options.
* @param {module:ol/PluggableMap~AtPixelOptions=} opt_options Optional options.
* @return {boolean} Is there a feature at the given pixel?
* @template U
* @api

View File

@@ -134,6 +134,28 @@ import Units from './proj/Units.js';
*/
/**
* @typedef {Object} AnimationOptions
* @property {ol.Coordinate|undefined} center The center of the view at the end of
* the animation.
* @property {number|undefined} zoom The zoom level of the view at the end of the
* animation. This takes precedence over `resolution`.
* @property {number|undefined} resolution The resolution of the view at the end
* of the animation. If `zoom` is also provided, this option will be ignored.
* @property {number|undefined} rotation The rotation of the view at the end of
* the animation.
* @property {ol.Coordinate|undefined} anchor Optional anchor to remained fixed
* during a rotation or resolution animation.
* @property {number|undefined} duration The duration of the animation in milliseconds
* (defaults to `1000`).
* @property {undefined|function(number):number} easing The easing function used
* during the animation (defaults to {@link ol.easing.inAndOut}).
* The function will be called for each frame with a number representing a
* fraction of the animation's duration. The function should return a number
* between 0 and 1 representing the progress toward the destination state.
*/
/**
* Default min zoom level for the map view.
* @type {number}
@@ -372,7 +394,7 @@ View.prototype.getUpdatedOptions_ = function(newOptions) {
* calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
* (or another method that calls one of these).
*
* @param {...(olx.AnimationOptions|function(boolean))} var_args Animation
* @param {...(module:ol/View~AnimationOptions|function(boolean))} var_args Animation
* options. Multiple animations can be run in series by passing multiple
* options objects. To run multiple animations in parallel, call the method
* multiple times. An optional callback can be provided as a final
@@ -412,7 +434,7 @@ View.prototype.animate = function(var_args) {
let rotation = this.getRotation();
const series = [];
for (let i = 0; i < animationCount; ++i) {
const options = /** @type {olx.AnimationOptions} */ (arguments[i]);
const options = /** @type {module:ol/View~AnimationOptions} */ (arguments[i]);
const animation = /** @type {module:ol/View~Animation} */ ({
start: start,

View File

@@ -10,6 +10,34 @@ import {listen} from '../events.js';
import EventType from '../events/EventType.js';
import {visibleAtResolution} from '../layer/Layer.js';
/**
* @typedef {Object} Options
* @property {string|undefined} className CSS class name. Default is
* `'ol-attribution'`.
* @property {Element|string|undefined} target Specify a target if you
* want the control to be rendered outside of the map's
* viewport.
* @property {boolean|undefined} collapsible Specify if attributions can
* be collapsed. If you use an OSM source, should be set to `false` — see
* {@link https://www.openstreetmap.org/copyright OSM Copyright} —
* Default is `true`.
* @property {boolean|undefined} collapsed Specify if attributions should
* be collapsed at startup. Default is `true`.
* @property {string|undefined} tipLabel Text label to use for the button
* tip. Default is `'Attributions'`
* @property {string|Element|undefined} label Text label to use for the
* collapsed attributions button. Default is `'i'`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|Element|undefined} collapseLabel Text label to use
* for the expanded attributions button. Default is `'»'`.
* Instead of text, also an element (e.g. a `span` element) can be used.
* @property {function(ol.MapEvent)|undefined} render Function called when
* the control should be re-rendered. This is called in a `requestAnimationFrame`
* callback.
*/
/**
* @classdesc
* Control to show all the attributions associated with the layer sources
@@ -19,7 +47,7 @@ import {visibleAtResolution} from '../layer/Layer.js';
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.AttributionOptions=} opt_options Attribution options.
* @param {module:ol/control/Attribution~Options=} opt_options Attribution options.
* @api
*/
const Attribution = function(opt_options) {

View File

@@ -8,6 +8,20 @@ import BaseObject from '../Object.js';
import {removeNode} from '../dom.js';
import {listen, unlistenByKey} from '../events.js';
/**
* @typedef {Object} Options
* @property {Element|undefined} element The element is the control's
* container element. This only needs to be specified if you're developing
* a custom control.
* @property {function(ol.MapEvent)|undefined} 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
* the control to be rendered outside of the map's viewport.
*/
/**
* @classdesc
* A control is a visible widget with a DOM element in a fixed position on the
@@ -34,7 +48,7 @@ import {listen, unlistenByKey} from '../events.js';
* @constructor
* @extends {ol.Object}
* @implements {oli.control.Control}
* @param {olx.control.ControlOptions} options Control options.
* @param {module:ol/control/Control~Options} options Control options.
* @api
*/
const Control = function(options) {

View File

@@ -32,6 +32,27 @@ 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).
* 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).
* 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
* control to be rendered outside of the map's viewport.
* @property {Element|string|undefined} source The element to be displayed
* fullscreen. When not provided, the element containing the map viewport will
* be displayed fullscreen.
*/
/**
* @classdesc
* Provides a button that when clicked fills up the full screen with the map.
@@ -46,7 +67,7 @@ const getChangeType = (function() {
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.FullScreenOptions=} opt_options Options.
* @param {module:ol/control/FullScreen~Options=} opt_options Options.
* @api
*/
const FullScreen = function(opt_options) {

View File

@@ -21,6 +21,23 @@ const PROJECTION = 'projection';
const COORDINATE_FORMAT = 'coordinateFormat';
/**
* @typedef {Object} Options
* @property {string|undefined} className CSS class name. Default is
* `'ol-mouse-position'`.
* @property {module:ol/coordinate~CoordinateFormat|undefined} coordinateFormat
* Coordinate format.
* @property {ol.ProjectionLike} projection Projection.
* @property {function(ol.MapEvent)|undefined} 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 the
* control to be rendered outside of the map's viewport.
* @property {string|undefined} undefinedHTML Markup for undefined coordinates.
* Default is `''` (empty string).
*/
/**
* @classdesc
* A control to show the 2D coordinates of the mouse cursor. By default, these
@@ -30,7 +47,7 @@ const COORDINATE_FORMAT = 'coordinateFormat';
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.MousePositionOptions=} opt_options Mouse position
* @param {module:ol/control/MousePosition~Options=} opt_options Mouse position
* options.
* @api
*/

View File

@@ -36,12 +36,38 @@ const MAX_RATIO = 0.75;
const MIN_RATIO = 0.1;
/**
* @typedef {Object} Options
* @property {boolean|undefined} collapsed Whether the control should start collapsed
* or not (expanded). Default to `true`.
* @property {string|Element|undefined} collapseLabel Text label to use for the
* expanded overviewmap button. Default is `'«'`. Instead of text, also an element
* (e.g. a `span` element) can be used.
* @property {boolean|undefined} collapsible Whether the control can be collapsed
* or not. Default to `true`.
* @property {string|Element|undefined} label Text label to use for the collapsed
* overviewmap button. Default is `'»'`. Instead of text, also an element
* (e.g. a `span` element) can be used.
* @property {Array.<ol.layer.Layer>|ol.Collection.<ol.layer.Layer>|undefined} layers
* Layers for the overview map. If not set, then all main map layers are used
* instead.
* @property {function(ol.MapEvent)|undefined} 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 the control
* to be rendered outside of the map's viewport.
* @property {string|undefined} tipLabel Text label to use for the button tip. Default
* is `'Overview map'`.
* @property {ol.View|undefined} view Custom view for the overview map. If not provided,
* a default view with an EPSG:3857 projection will be used.
*/
/**
* Create a new control with a map acting as an overview map for an other
* defined map.
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.OverviewMapOptions=} opt_options OverviewMap options.
* @param {module:ol/control/OverviewMap~Options=} opt_options OverviewMap options.
* @api
*/
const OverviewMap = function(opt_options) {

View File

@@ -9,6 +9,25 @@ import {listen} from '../events.js';
import EventType from '../events/EventType.js';
import {inherits} from '../index.js';
/**
* @typedef {Object} Options
* @property {string|undefined} className CSS class name. Default is `'ol-rotate'`.
* @property {string|Element|undefined} label Text label to use for the rotate button.
* Default is `'⇧'`. Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|undefined} tipLabel Text label to use for the rotate tip. Default is
* `'Reset rotation'`
* @property {number|undefined} duration Animation duration in milliseconds. Default is `250`.
* @property {boolean|undefined} autoHide Hide the control when rotation is 0. Default is `true`.
* @property {function(ol.MapEvent)|undefined} render Function called when the control should
* be re-rendered. This is called in a `requestAnimationFrame` callback.
* @property {function()|undefined} resetNorth Function called when the control is clicked.
* This will override the default `resetNorth`.
* @property {Element|string|undefined} target Specify a target if you want the control to be
* rendered outside of the map's viewport.
*/
/**
* @classdesc
* A button control to reset rotation to 0.
@@ -17,7 +36,7 @@ import {inherits} from '../index.js';
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.RotateOptions=} opt_options Rotate options.
* @param {module:ol/control/Rotate~Options=} opt_options Rotate options.
* @api
*/
const Rotate = function(opt_options) {

View File

@@ -25,6 +25,18 @@ const UNITS = 'units';
const LEADING_DIGITS = [1, 2, 5];
/**
* @typedef {Object} Options
* @property {string|undefined} className CSS Class name. Default is `'ol-scale-line'`.
* @property {number|undefined} minWidth Minimum width in pixels. Default is `64`.
* @property {function(ol.MapEvent)|undefined} 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 the control
* to be rendered outside of the map's viewport.
* @property {ol.control.ScaleLineUnits|string|undefined} units Units. Default is `'metric'`.
*/
/**
* @classdesc
* A control displaying rough y-axis distances, calculated for the center of the
@@ -37,7 +49,7 @@ const LEADING_DIGITS = [1, 2, 5];
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.ScaleLineOptions=} opt_options Scale line options.
* @param {module:ol/control/ScaleLine~Options=} opt_options Scale line options.
* @api
*/
const ScaleLine = function(opt_options) {

View File

@@ -8,6 +8,25 @@ import Control from '../control/Control.js';
import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
import {easeOut} from '../easing.js';
/**
* @typedef {Object} Options
* @property {number|undefined} duration Animation duration in milliseconds. Default is `250`.
* @property {string|undefined} className CSS class name. Default is `'ol-zoom'`.
* @property {string|Element|undefined} zoomInLabel Text label to use for the zoom-in
* button. Default is `'+'`. Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|Element|undefined} zoomOutLabel Text label to use for the zoom-out button.
* Default is `'-'`. Instead of text, also an element (e.g. a `span` element) can be used.
* @property {string|undefined} zoomInTipLabel Text label to use for the button tip. Default is
* `'Zoom in'`.
* @property {string|undefined} zoomOutTipLabel Text label to use for the button tip. Default is
* `'Zoom out'`.
* @property {number|undefined} delta The zoom delta applied on each click.
* @property {Element|string|undefined} target Specify a target if you want the control to be
* rendered outside of the map's viewport.
*/
/**
* @classdesc
* A control with 2 buttons, one for zoom in and one for zoom out.
@@ -16,7 +35,7 @@ import {easeOut} from '../easing.js';
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.ZoomOptions=} opt_options Zoom options.
* @param {module:ol/control/Zoom~Options=} opt_options Zoom options.
* @api
*/
const Zoom = function(opt_options) {

View File

@@ -25,6 +25,17 @@ const Direction = {
};
/**
* @typedef {Object} Options
* @property {string|undefined} className CSS class name.
* @property {number|undefined} duration Animation duration in milliseconds. Default is `200`.
* @property {number|undefined} maxResolution Maximum resolution.
* @property {number|undefined} minResolution Minimum resolution.
* @property {function(ol.MapEvent)|undefined} render Function called when the control
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
*/
/**
* @classdesc
* A slider type of control for zooming.
@@ -35,7 +46,7 @@ const Direction = {
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options.
* @param {module:ol/control/ZoomSlider~Options=} opt_options Zoom slider options.
* @api
*/
const ZoomSlider = function(opt_options) {

View File

@@ -7,6 +7,21 @@ import EventType from '../events/EventType.js';
import Control from '../control/Control.js';
import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
/**
* @typedef {Object} Options
* @property {string|undefined} className Class name. Default is `'ol-zoom-extent'`.
* @property {Element|string|undefined} target Specify a target if you want the control
* to be rendered outside of the map's viewport.
* @property {string|Element|undefined} label Text label to use for the button. Default
* is `'E'`. 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 `'Zoom to extent'`.
* @property {ol.Extent|undefined} extent The extent to zoom to. If undefined the validity
* extent of the view projection is used.
*/
/**
* @classdesc
* A button control which, when pressed, changes the map view to a specific
@@ -14,7 +29,7 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
*
* @constructor
* @extends {ol.control.Control}
* @param {olx.control.ZoomToExtentOptions=} opt_options Options.
* @param {module:ol/control/ZoomToExtent~Options=} opt_options Options.
* @api
*/
const ZoomToExtent = function(opt_options) {

View File

@@ -3,6 +3,29 @@
*/
import {METERS_PER_UNIT} from '../proj/Units.js';
/**
* @typedef {Object} Options
* @property {string} code The SRS identifier code, e.g. `EPSG:4326`.
* @property {ol.proj.Units|string|undefined} units Units. Required unless a
* proj4 projection is defined for `code`.
* @property {ol.Extent|undefined} 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.
* If not provided, the `units` are used to get the meters per unit from the {@link ol.proj.METERS_PER_UNIT}
* lookup table.
* @property {ol.Extent|undefined} worldExtent The world extent for the SRS.
* @property {(function(number, ol.Coordinate):number|undefined)} getPointResolution
* Function to determine resolution at a point. The function is called with a
* `{number}` view resolution and an `{ol.Coordinate}` as arguments, and returns
* the `{number}` resolution at the passed coordinate. If this is `undefined`,
* the default {@link ol.proj#getPointResolution} function will be used.
*/
/**
* @classdesc
* Projection definition class. One of these is created for each projection
@@ -29,7 +52,7 @@ import {METERS_PER_UNIT} from '../proj/Units.js';
* namespace for proj4, use {@link ol.proj.setProj4}.
*
* @constructor
* @param {olx.ProjectionOptions} options Projection options.
* @param {module:ol/proj/Projection~Options} options Projection options.
* @struct
* @api
*/