From 95d6251dbbd07b363e4cb28823f0b4964523a0ea Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Thu, 8 Mar 2018 18:42:57 +0100 Subject: [PATCH] Get rid of olx.js and typedef.js typedefs for ol --- externs/olx.js | 713 +------------------ src/ol/CanvasMap.js | 52 +- src/ol/Collection.js | 2 +- src/ol/CollectionEventType.js | 4 +- src/ol/Feature.js | 71 +- src/ol/Geolocation.js | 12 +- src/ol/Graticule.js | 20 +- src/ol/Image.js | 32 +- src/ol/ImageBase.js | 14 +- src/ol/ImageCanvas.js | 19 +- src/ol/ImageTile.js | 14 +- src/ol/Map.js | 50 +- src/ol/MapBrowserEvent.js | 10 +- src/ol/MapBrowserEventHandler.js | 46 +- src/ol/MapBrowserEventType.js | 10 +- src/ol/MapBrowserPointerEvent.js | 11 +- src/ol/MapEvent.js | 12 +- src/ol/MapEventType.js | 6 +- src/ol/Object.js | 50 +- src/ol/ObjectEventType.js | 2 +- src/ol/Observable.js | 18 +- src/ol/Overlay.js | 99 ++- src/ol/PluggableMap.js | 78 +- src/ol/Tile.js | 58 +- src/ol/TileCache.js | 4 +- src/ol/TileQueue.js | 18 +- src/ol/TileRange.js | 16 +- src/ol/VectorImageTile.js | 64 +- src/ol/VectorTile.js | 84 +-- src/ol/View.js | 206 ++++-- src/ol/centerconstraint.js | 17 +- src/ol/color.js | 32 +- src/ol/color.jsdoc | 8 - src/ol/colorlike.js | 22 +- src/ol/colorlike.jsdoc | 5 - src/ol/control.js | 29 +- src/ol/control/Control.js | 2 +- src/ol/control/MousePosition.js | 14 +- src/ol/control/OverviewMap.js | 12 +- src/ol/control/ZoomSlider.js | 2 +- src/ol/control/ZoomToExtent.js | 2 +- src/ol/coordinate.js | 128 ++-- src/ol/coordinate.jsdoc | 3 - src/ol/easing.js | 4 +- src/ol/easing.jsdoc | 4 - src/ol/events.js | 79 +- src/ol/events/Event.js | 2 +- src/ol/events/EventTarget.js | 16 +- src/ol/extent.js | 206 +++--- src/ol/extent.jsdoc | 3 - src/ol/featureloader.js | 60 +- src/ol/featureloader.jsdoc | 4 - src/ol/format/Feature.js | 8 +- src/ol/format/GML2.js | 34 +- src/ol/format/GML3.js | 50 +- src/ol/format/GMLBase.js | 14 +- src/ol/format/GPX.js | 40 +- src/ol/format/KML.js | 116 +-- src/ol/format/MVT.js | 2 +- src/ol/format/OSMXML.js | 8 +- src/ol/format/OWS.js | 28 +- src/ol/format/TopoJSON.js | 24 +- src/ol/format/WFS.js | 34 +- src/ol/format/WMSCapabilities.js | 36 +- src/ol/format/WMTSCapabilities.js | 22 +- src/ol/format/filter.js | 2 +- src/ol/format/filter/Bbox.js | 4 +- src/ol/geom/Circle.js | 18 +- src/ol/geom/Geometry.js | 36 +- src/ol/geom/LineString.js | 18 +- src/ol/geom/LinearRing.js | 6 +- src/ol/geom/MultiLineString.js | 8 +- src/ol/geom/MultiPoint.js | 6 +- src/ol/geom/MultiPolygon.js | 6 +- src/ol/geom/Point.js | 4 +- src/ol/geom/Polygon.js | 14 +- src/ol/geom/SimpleGeometry.js | 6 +- src/ol/geom/flat/contains.js | 4 +- src/ol/geom/flat/deflate.js | 8 +- src/ol/geom/flat/geodesic.js | 14 +- src/ol/geom/flat/inflate.js | 12 +- src/ol/geom/flat/interpolate.js | 4 +- src/ol/geom/flat/intersectsextent.js | 14 +- src/ol/geom/flat/segments.js | 2 +- src/ol/geom/flat/transform.js | 2 +- src/ol/has.jsdoc | 3 - src/ol/index.js | 8 + src/ol/interaction.js | 54 +- src/ol/interaction/DragAndDrop.js | 2 +- src/ol/interaction/DragBox.js | 10 +- src/ol/interaction/DragPan.js | 4 +- src/ol/interaction/DragZoom.js | 2 +- src/ol/interaction/Draw.js | 16 +- src/ol/interaction/Extent.js | 38 +- src/ol/interaction/Interaction.js | 12 +- src/ol/interaction/Modify.js | 16 +- src/ol/interaction/MouseWheelZoom.js | 2 +- src/ol/interaction/PinchRotate.js | 2 +- src/ol/interaction/PinchZoom.js | 2 +- src/ol/interaction/Pointer.js | 2 +- src/ol/interaction/Select.js | 2 +- src/ol/interaction/Snap.js | 12 +- src/ol/interaction/Translate.js | 8 +- src/ol/layer/Base.js | 18 +- src/ol/layer/Group.js | 4 +- src/ol/layer/Layer.js | 23 +- src/ol/layer/Vector.js | 14 +- src/ol/loadingstrategy.js | 20 +- src/ol/loadingstrategy.jsdoc | 4 - src/ol/plugins.js | 25 +- src/ol/pointer/MouseSource.js | 2 +- src/ol/pointer/PointerEventHandler.js | 2 +- src/ol/proj.js | 135 ++-- src/ol/proj/Projection.js | 20 +- src/ol/proj/epsg3857.js | 4 +- src/ol/proj/epsg4326.js | 2 +- src/ol/proj/transforms.js | 8 +- src/ol/render.js | 35 +- src/ol/render.jsdoc | 3 - src/ol/render/Box.js | 8 +- src/ol/render/Feature.js | 10 +- src/ol/render/canvas.js | 4 +- src/ol/render/canvas/ImageReplay.js | 2 +- src/ol/render/canvas/Immediate.js | 10 +- src/ol/render/canvas/LineStringReplay.js | 2 +- src/ol/render/canvas/PolygonReplay.js | 2 +- src/ol/render/canvas/Replay.js | 46 +- src/ol/render/canvas/ReplayGroup.js | 18 +- src/ol/render/canvas/TextReplay.js | 2 +- src/ol/render/webgl/CircleReplay.js | 2 +- src/ol/render/webgl/ImageReplay.js | 2 +- src/ol/render/webgl/Immediate.js | 6 +- src/ol/render/webgl/LineStringReplay.js | 2 +- src/ol/render/webgl/PolygonReplay.js | 2 +- src/ol/render/webgl/Replay.js | 24 +- src/ol/render/webgl/ReplayGroup.js | 30 +- src/ol/render/webgl/TextReplay.js | 2 +- src/ol/render/webgl/TextureReplay.js | 2 +- src/ol/renderer/Layer.js | 8 +- src/ol/renderer/Map.js | 16 +- src/ol/renderer/canvas/ImageLayer.js | 2 +- src/ol/renderer/canvas/IntermediateCanvas.js | 6 +- src/ol/renderer/canvas/Layer.js | 30 +- src/ol/renderer/canvas/Map.js | 4 +- src/ol/renderer/canvas/TileLayer.js | 8 +- src/ol/renderer/canvas/VectorLayer.js | 4 +- src/ol/renderer/canvas/VectorTileLayer.js | 8 +- src/ol/renderer/webgl/ImageLayer.js | 14 +- src/ol/renderer/webgl/Layer.js | 16 +- src/ol/renderer/webgl/Map.js | 12 +- src/ol/renderer/webgl/TileLayer.js | 4 +- src/ol/renderer/webgl/VectorLayer.js | 4 +- src/ol/reproj.js | 19 +- src/ol/reproj/Image.js | 10 +- src/ol/reproj/Tile.js | 8 +- src/ol/reproj/Triangulation.js | 42 +- src/ol/resolutionconstraint.js | 10 +- src/ol/rotationconstraint.js | 10 +- src/ol/size.js | 32 +- src/ol/source.jsdoc | 3 - src/ol/source/BingMaps.js | 2 +- src/ol/source/Image.js | 4 +- src/ol/source/ImageArcGISRest.js | 12 +- src/ol/source/ImageMapGuide.js | 14 +- src/ol/source/ImageStatic.js | 4 +- src/ol/source/ImageWMS.js | 18 +- src/ol/source/Raster.js | 8 +- src/ol/source/Source.js | 2 +- src/ol/source/Tile.js | 10 +- src/ol/source/TileArcGISRest.js | 8 +- src/ol/source/TileDebug.js | 6 +- src/ol/source/TileImage.js | 6 +- src/ol/source/TileUTFGrid.js | 14 +- src/ol/source/TileWMS.js | 12 +- src/ol/source/UrlTile.js | 14 +- src/ol/source/Vector.js | 34 +- src/ol/source/VectorTile.js | 4 +- src/ol/source/WMTS.js | 4 +- src/ol/source/Zoomify.js | 12 +- src/ol/sphere.js | 8 +- src/ol/structs/LRUCache.js | 2 +- src/ol/structs/RBush.js | 14 +- src/ol/style.js | 17 +- src/ol/style/Icon.js | 4 +- src/ol/style/IconImage.js | 12 +- src/ol/style/Image.js | 8 +- src/ol/style/RegularShape.js | 6 +- src/ol/style/Style.js | 4 +- src/ol/tilecoord.js | 24 +- src/ol/tilegrid.js | 43 +- src/ol/tilegrid/TileGrid.js | 74 +- src/ol/tilegrid/WMTS.js | 8 +- src/ol/tileurlfunction.js | 24 +- src/ol/transform.js | 59 +- src/ol/typedefs.js | 319 +-------- src/ol/types.js | 68 -- src/ol/vec/mat4.js | 2 +- src/ol/xml.js | 63 +- 198 files changed, 2262 insertions(+), 2698 deletions(-) delete mode 100644 src/ol/color.jsdoc delete mode 100644 src/ol/colorlike.jsdoc delete mode 100644 src/ol/coordinate.jsdoc delete mode 100644 src/ol/easing.jsdoc delete mode 100644 src/ol/extent.jsdoc delete mode 100644 src/ol/featureloader.jsdoc delete mode 100644 src/ol/has.jsdoc delete mode 100644 src/ol/loadingstrategy.jsdoc delete mode 100644 src/ol/render.jsdoc delete mode 100644 src/ol/source.jsdoc delete mode 100644 src/ol/types.js diff --git a/externs/olx.js b/externs/olx.js index cd39808c64..71328756d5 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5,23 +5,6 @@ var olx; -/** - * Options for tile constructors. - * @typedef {{transition: (number|undefined)}} - */ -olx.TileOptions; - - -/** - * 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. - * @type {number|undefined} - * @api - */ -olx.TileOptions.prototype.transition; - - /** * Object literal with options for the {@link ol.Map#forEachFeatureAtPixel} and * {@link ol.Map#hasFeatureAtPixel} methods. @@ -52,153 +35,6 @@ olx.AtPixelOptions.prototype.layerFilter; olx.AtPixelOptions.prototype.hitTolerance; -/** - * Object literal with config options for the overlay. - * @typedef {{id: (number|string|undefined), - * element: (Element|undefined), - * offset: (Array.|undefined), - * position: (ol.Coordinate|undefined), - * positioning: (ol.OverlayPositioning|string|undefined), - * stopEvent: (boolean|undefined), - * insertFirst: (boolean|undefined), - * autoPan: (boolean|undefined), - * autoPanAnimation: (olx.OverlayPanOptions|undefined), - * autoPanMargin: (number|undefined), - * className: (string|undefined)}} - */ -olx.OverlayOptions; - - -/** - * Set the overlay id. The overlay id can be used with the - * {@link ol.Map#getOverlayById} method. - * @type {number|string|undefined} - * @api - */ -olx.OverlayOptions.prototype.id; - - -/** - * The overlay element. - * @type {Element|undefined} - * @api - */ -olx.OverlayOptions.prototype.element; - - -/** - * Offsets in pixels used when positioning the overlay. The first element in the - * array is the horizontal offset. A positive value shifts the overlay right. - * The second element in the array is the vertical offset. A positive value - * shifts the overlay down. Default is `[0, 0]`. - * @type {Array.|undefined} - * @api - */ -olx.OverlayOptions.prototype.offset; - - -/** - * The overlay position in map projection. - * @type {ol.Coordinate|undefined} - * @api - */ -olx.OverlayOptions.prototype.position; - - -/** - * Defines how the overlay is actually positioned with respect to its `position` - * property. Possible values are `'bottom-left'`, `'bottom-center'`, - * `'bottom-right'`, `'center-left'`, `'center-center'`, `'center-right'`, - * `'top-left'`, `'top-center'`, and `'top-right'`. Default is `'top-left'`. - * @type {ol.OverlayPositioning|string|undefined} - * @api - */ -olx.OverlayOptions.prototype.positioning; - - -/** - * Whether event propagation to the map viewport should be stopped. Default is - * `true`. If `true` the overlay is placed in the same container as that of the - * controls (CSS class name `ol-overlaycontainer-stopevent`); if `false` it is - * placed in the container with CSS class name `ol-overlaycontainer`. - * @type {boolean|undefined} - * @api - */ -olx.OverlayOptions.prototype.stopEvent; - - -/** - * Whether the overlay is inserted first in the overlay container, or appended. - * Default is `true`. If the overlay is placed in the same container as that of - * the controls (see the `stopEvent` option) you will probably set `insertFirst` - * to `true` so the overlay is displayed below the controls. - * @type {boolean|undefined} - * @api - */ -olx.OverlayOptions.prototype.insertFirst; - - -/** - * If set to `true` the map is panned when calling `setPosition`, so that the - * overlay is entirely visible in the current viewport. - * The default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.OverlayOptions.prototype.autoPan; - - -/** - * The animation options used to pan the overlay into view. This animation - * is only used when `autoPan` is enabled. A `duration` and `easing` may be - * provided to customize the animation. - * @type {olx.OverlayPanOptions|undefined} - * @api - */ -olx.OverlayOptions.prototype.autoPanAnimation; - - -/** - * The margin (in pixels) between the overlay and the borders of the map when - * autopanning. The default is `20`. - * @type {number|undefined} - * @api - */ -olx.OverlayOptions.prototype.autoPanMargin; - -/** - * CSS class name. Default is `ol-overlay-container ol-selectable`. - * @type {string|undefined} - * @api - */ -olx.OverlayOptions.prototype.className; - -/** - * @typedef {{ - * duration: (number|undefined), - * easing: (undefined|function(number):number) - * }} - */ -olx.OverlayPanOptions; - - -/** - * The duration of the animation in milliseconds. Default is `1000`. - * @type {number|undefined} - * @api - */ -olx.OverlayPanOptions.prototype.duration; - - -/** - * The easing function to use. Can be an {@link ol.easing} or a custom function. - * Default is {@link ol.easing.inAndOut}. - * @type {undefined|function(number):number} - * @api - */ -olx.OverlayPanOptions.prototype.easing; - - /** * Object literal with config options for the projection. * @typedef {{code: string, @@ -281,170 +117,6 @@ olx.ProjectionOptions.prototype.worldExtent; olx.ProjectionOptions.prototype.getPointResolution; -/** - * Object literal with config options for the view. - * @typedef {{center: (ol.Coordinate|undefined), - * constrainRotation: (boolean|number|undefined), - * enableRotation: (boolean|undefined), - * extent: (ol.Extent|undefined), - * minResolution: (number|undefined), - * maxResolution: (number|undefined), - * minZoom: (number|undefined), - * maxZoom: (number|undefined), - * projection: ol.ProjectionLike, - * resolution: (number|undefined), - * resolutions: (Array.|undefined), - * rotation: (number|undefined), - * zoom: (number|undefined), - * zoomFactor: (number|undefined)}} - */ -olx.ViewOptions; - - -/** - * The initial center for the view. The coordinate system for the center is - * specified with the `projection` option. Default is `undefined`, and layer - * sources will not be fetched if this is not set. - * @type {ol.Coordinate|undefined} - * @api - */ -olx.ViewOptions.prototype.center; - - -/** - * Rotation constraint. `false` means no constraint. `true` means no constraint, - * but snap to zero near zero. A number constrains the rotation to that number - * of values. For example, `4` will constrain the rotation to 0, 90, 180, and - * 270 degrees. The default is `true`. - * @type {boolean|number|undefined} - * @api - */ -olx.ViewOptions.prototype.constrainRotation; - - -/** - * Enable rotation. Default is `true`. If `false` a rotation constraint that - * always sets the rotation to zero is used. The `constrainRotation` option - * has no effect if `enableRotation` is `false`. - * @type {boolean|undefined} - * @api - */ -olx.ViewOptions.prototype.enableRotation; - - -/** - * The extent that constrains the center, in other words, center cannot be set - * outside this extent. Default is `undefined`. - * @type {ol.Extent|undefined} - * @api - */ -olx.ViewOptions.prototype.extent; - - -/** - * The maximum resolution used to determine the resolution constraint. It is - * used together with `minResolution` (or `maxZoom`) and `zoomFactor`. If - * unspecified it is calculated in such a way that the projection's validity - * extent fits in a 256x256 px tile. If the projection is Spherical Mercator - * (the default) then `maxResolution` defaults to `40075016.68557849 / 256 = - * 156543.03392804097`. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.maxResolution; - - -/** - * The minimum resolution used to determine the resolution constraint. It is - * used together with `maxResolution` (or `minZoom`) and `zoomFactor`. If - * unspecified it is calculated assuming 29 zoom levels (with a factor of 2). - * If the projection is Spherical Mercator (the default) then `minResolution` - * defaults to `40075016.68557849 / 256 / Math.pow(2, 28) = - * 0.0005831682455839253`. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.minResolution; - - -/** - * The maximum zoom level used to determine the resolution constraint. It is - * used together with `minZoom` (or `maxResolution`) and `zoomFactor`. Default - * is `28`. Note that if `minResolution` is also provided, it is given - * precedence over `maxZoom`. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.maxZoom; - - -/** - * The minimum zoom level used to determine the resolution constraint. It is - * used together with `maxZoom` (or `minResolution`) and `zoomFactor`. Default - * is `0`. Note that if `maxResolution` is also provided, it is given - * precedence over `minZoom`. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.minZoom; - - -/** - * The projection. Default is `EPSG:3857` (Spherical Mercator). - * @type {ol.ProjectionLike} - * @api - */ -olx.ViewOptions.prototype.projection; - - -/** - * The initial resolution for the view. The units are `projection` units per - * pixel (e.g. meters per pixel). An alternative to setting this is to set - * `zoom`. Default is `undefined`, and layer sources will not be fetched if - * neither this nor `zoom` are defined. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.resolution; - - -/** - * Resolutions to determine the resolution constraint. If set the - * `maxResolution`, `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` - * options are ignored. - * @type {Array.|undefined} - * @api - */ -olx.ViewOptions.prototype.resolutions; - - -/** - * The initial rotation for the view in radians (positive rotation clockwise). - * Default is `0`. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.rotation; - - -/** - * Only used if `resolution` is not defined. Zoom level used to calculate the - * initial resolution for the view. The initial resolution is determined using - * the `ol.View#constrainResolution` method. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.zoom; - - -/** - * The zoom factor used to determine the resolution constraint. Default is `2`. - * @type {number|undefined} - * @api - */ -olx.ViewOptions.prototype.zoomFactor; - - /** * @typedef {{ * center: (ol.Coordinate|undefined), @@ -646,65 +318,6 @@ olx.control.ControlOptions.prototype.render; olx.control.ControlOptions.prototype.target; -/** - * @typedef {{attribution: (boolean|undefined), - * attributionOptions: (olx.control.AttributionOptions|undefined), - * rotate: (boolean|undefined), - * rotateOptions: (olx.control.RotateOptions|undefined), - * zoom: (boolean|undefined), - * zoomOptions: (olx.control.ZoomOptions|undefined)}} - */ -olx.control.DefaultsOptions; - - -/** - * Attribution. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.control.DefaultsOptions.prototype.attribution; - - -/** - * Attribution options. - * @type {olx.control.AttributionOptions|undefined} - * @api - */ -olx.control.DefaultsOptions.prototype.attributionOptions; - - -/** - * Rotate. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.control.DefaultsOptions.prototype.rotate; - - -/** - * Rotate options. - * @type {olx.control.RotateOptions|undefined} - * @api - */ -olx.control.DefaultsOptions.prototype.rotateOptions; - - -/** - * Zoom. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.control.DefaultsOptions.prototype.zoom; - - -/** - * Zoom options. - * @type {olx.control.ZoomOptions|undefined} - * @api - */ -olx.control.DefaultsOptions.prototype.zoomOptions; - - /** * @typedef {{className: (string|undefined), * label: (string|Node|undefined), @@ -777,7 +390,7 @@ olx.control.FullScreenOptions.prototype.source; /** * @typedef {{className: (string|undefined), - * coordinateFormat: (ol.CoordinateFormatType|undefined), + * coordinateFormat: (module:ol/coordinate~CoordinateFormat|undefined), * projection: ol.ProjectionLike, * render: (function(ol.MapEvent)|undefined), * target: (Element|string|undefined), @@ -796,7 +409,7 @@ olx.control.MousePositionOptions.prototype.className; /** * Coordinate format. - * @type {ol.CoordinateFormatType|undefined} + * @type {module:ol/coordinate~CoordinateFormat|undefined} * @api */ olx.control.MousePositionOptions.prototype.coordinateFormat; @@ -2012,114 +1625,6 @@ olx.format.WMSGetFeatureInfoOptions.prototype.layers; olx.interaction; -/** - * Interactions for the map. Default is `true` for all options. - * @typedef {{ - * altShiftDragRotate: (boolean|undefined), - * constrainResolution: (boolean|undefined), - * doubleClickZoom: (boolean|undefined), - * keyboard: (boolean|undefined), - * mouseWheelZoom: (boolean|undefined), - * shiftDragZoom: (boolean|undefined), - * dragPan: (boolean|undefined), - * pinchRotate: (boolean|undefined), - * pinchZoom: (boolean|undefined), - * zoomDelta: (number|undefined), - * zoomDuration: (number|undefined) - * }} - */ -olx.interaction.DefaultsOptions; - - -/** - * Whether Alt-Shift-drag rotate is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.altShiftDragRotate; - - -/** - * Zoom to the closest integer zoom level after the wheel/trackpad or - * pinch gesture ends. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.constrainResolution; - - -/** - * Whether double click zoom is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.doubleClickZoom; - - -/** - * Whether keyboard interaction is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.keyboard; - - -/** - * Whether mousewheel zoom is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.mouseWheelZoom; - - -/** - * Whether Shift-drag zoom is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.shiftDragZoom; - - -/** - * Whether drag pan is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.dragPan; - - -/** - * Whether pinch rotate is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.pinchRotate; - - -/** - * Whether pinch zoom is desired. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.pinchZoom; - - -/** - * Zoom delta. - * @type {number|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.zoomDelta; - - -/** - * Zoom duration. - * @type {number|undefined} - * @api - */ -olx.interaction.DefaultsOptions.prototype.zoomDuration; - - /** * @typedef {{duration: (number|undefined), * delta: (number|undefined)}} @@ -4038,32 +3543,6 @@ olx.render.State.prototype.resolution; olx.render.State.prototype.rotation; -/** - * @typedef {{size: (ol.Size|undefined), - * pixelRatio: (number|undefined)}} - */ -olx.render.ToContextOptions; - - -/** - * Desired size of the canvas in css pixels. When provided, both canvas and css - * size will be set according to the `pixelRatio`. If not provided, the current - * canvas and css sizes will not be altered. - * @type {ol.Size|undefined} - * @api - */ -olx.render.ToContextOptions.prototype.size; - - -/** - * Pixel ratio (canvas pixel to css pixel ratio) for the canvas. Default - * is the detected device pixel ratio. - * @type {number|undefined} - * @api - */ -olx.render.ToContextOptions.prototype.pixelRatio; - - /** * Namespace. * @type {Object} @@ -7566,151 +7045,9 @@ olx.tilegrid.XYZOptions.prototype.tileSize; olx.view; -/** - * @typedef {{ - * size: (ol.Size|undefined), - * padding: (!Array.|undefined), - * constrainResolution: (boolean|undefined), - * nearest: (boolean|undefined), - * maxZoom: (number|undefined), - * minResolution: (number|undefined), - * duration: (number|undefined), - * easing: (undefined|function(number):number), - * callback: (undefined|function(boolean)) - * }} - */ -olx.view.FitOptions; - - -/** - * The size in pixels of the box to fit the extent into. Default is - * the current size of the first map in the DOM that uses this view, or - * `[100, 100]` if no such map is found. - * @type {ol.Size|undefined} - * @api - */ -olx.view.FitOptions.prototype.size; - - -/** - * Padding (in pixels) to be cleared inside the view. Values in the array are - * top, right, bottom and left padding. Default is `[0, 0, 0, 0]`. - * @type {!Array.|undefined} - * @api - */ -olx.view.FitOptions.prototype.padding; - - -/** - * Constrain the resolution. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.view.FitOptions.prototype.constrainResolution; - - -/** - * Get the nearest extent. Default is `false`. - * @type {boolean|undefined} - * @api - */ -olx.view.FitOptions.prototype.nearest; - - -/** - * Minimum resolution that we zoom to. Default is `0`. - * @type {number|undefined} - * @api - */ -olx.view.FitOptions.prototype.minResolution; - - -/** - * Maximum zoom level that we zoom to. If `minResolution` is given, - * this property is ignored. - * @type {number|undefined} - * @api - */ -olx.view.FitOptions.prototype.maxZoom; - - -/** - * The duration of the animation in milliseconds. By default, there is no - * animations. - * @type {number|undefined} - * @api - */ -olx.view.FitOptions.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.view.FitOptions.prototype.easing; - - -/** - * Optional function called when the view is in it's final position. The callback will be - * called with `true` if the animation series completed on its own or `false` - * if it was cancelled. - * @type {undefined|function(boolean)} - * @api - */ -olx.view.FitOptions.prototype.callback; - - /* typedefs for object literals exposed by the library */ -/** - * @typedef {{animate: boolean, - * coordinateToPixelTransform: ol.Transform, - * extent: (null|ol.Extent), - * focus: ol.Coordinate, - * index: number, - * layerStates: Object., - * layerStatesArray: Array., - * pixelRatio: number, - * pixelToCoordinateTransform: ol.Transform, - * postRenderFunctions: Array., - * size: ol.Size, - * skippedFeatureUids: !Object., - * tileQueue: ol.TileQueue, - * time: number, - * usedTiles: Object.>, - * viewState: olx.ViewState, - * viewHints: Array., - * wantedTiles: !Object.>}} - */ -olx.FrameState; - - -/** - * @type {number} - * @api - */ -olx.FrameState.prototype.pixelRatio; - - -/** - * @type {number} - * @api - */ -olx.FrameState.prototype.time; - - -/** - * @type {olx.ViewState} - * @api - */ -olx.FrameState.prototype.viewState; - - /** * @typedef {{center: ol.Coordinate, * projection: ol.proj.Projection, @@ -7788,49 +7125,3 @@ olx.style.AtlasManagerOptions.prototype.maxSize; * @api */ olx.style.AtlasManagerOptions.prototype.space; - - -/** - * @typedef {{handles: function(ol.renderer.Type):boolean, - * create: function(Element, ol.PluggableMap):ol.renderer.Map}} - */ -olx.MapRendererPlugin; - - -/** - * Determine if this renderer handles the provided layer. - * @type {function(ol.renderer.Type):boolean} - * @api - */ -olx.MapRendererPlugin.prototype.handles; - - -/** - * Create the map renderer. - * @type {function(Element, ol.PluggableMap):ol.renderer.Map} - * @api - */ -olx.MapRendererPlugin.prototype.create; - - -/** - * @typedef {{handles: function(ol.renderer.Type, ol.layer.Layer):boolean, - * create: function(ol.renderer.Map, ol.layer.Layer):ol.renderer.Layer}} - */ -olx.LayerRendererPlugin; - - -/** - * Determine if this renderer handles the provided layer. - * @type {function(ol.renderer.Type, ol.layer.Layer):boolean} - * @api - */ -olx.LayerRendererPlugin.prototype.handles; - - -/** - * Create a layer renderer. - * @type {function(ol.renderer.Map, ol.layer.Layer):ol.renderer.Layer} - * @api - */ -olx.LayerRendererPlugin.prototype.create; diff --git a/src/ol/CanvasMap.js b/src/ol/CanvasMap.js index 16f0ffa828..a896319eac 100644 --- a/src/ol/CanvasMap.js +++ b/src/ol/CanvasMap.js @@ -29,47 +29,53 @@ registerMultiple(PluginType.LAYER_RENDERER, [ * The map is the core component of OpenLayers. For a map to render, a view, * one or more layers, and a target container are needed: * - * var map = new ol.CanvasMap({ - * view: new ol.View({ + * import CanvasMap from 'ol/CanvasMap'; + * import TileLayer from 'ol/layer/Tile'; + * import OSM from 'ol/source/OSM'; + * import View from 'ol/View'; + * + * var map = new CanvasMap({ + * view: new View({ * center: [0, 0], * zoom: 1 * }), * layers: [ - * new ol.layer.Tile({ - * source: new ol.source.OSM() + * new TileLayer({ + * source: new OSM() * }) * ], * target: 'map' * }); * - * The above snippet creates a map using a {@link ol.layer.Tile} to display - * {@link ol.source.OSM} OSM data and render it to a DOM element with the - * id `map`. + * The above snippet creates a map using a {@link module:ol/layer/Tile~Tile} to + * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM + * element with the id `map`. * * The constructor places a viewport container (with CSS class name * `ol-viewport`) in the target element (see `getViewport()`), and then two * further elements within the viewport: one with CSS class name * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent` - * option of {@link ol.Overlay} for the difference). The map itself is placed in - * a further element within the viewport. + * option of {@link module:ol/Overlay~Overlay} for the difference). The map + * itself is placed in a further element within the viewport. * - * Layers are stored as a `ol.Collection` in layerGroups. A top-level group is - * provided by the library. This is what is accessed by `getLayerGroup` and - * `setLayerGroup`. Layers entered in the options are added to this group, and - * `addLayer` and `removeLayer` change the layer collection in the group. - * `getLayers` is a convenience function for `getLayerGroup().getLayers()`. - * Note that `ol.layer.Group` is a subclass of `ol.layer.Base`, so layers - * entered in the options or added with `addLayer` can be groups, which can - * contain further groups, and so on. + * Layers are stored as a {@link module:ol/Collection~Collection} in + * layerGroups. A top-level group is provided by the library. This is what is + * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the + * options are added to this group, and `addLayer` and `removeLayer` change the + * layer collection in the group. `getLayers` is a convenience function for + * `getLayerGroup().getLayers()`. + * Note that {@link module:ol/layer/Group~Group} is a subclass of + * {@link module:ol/layer/Base~Base}, so layers entered in the options or added + * with `addLayer` can be groups, which can contain further groups, and so on. * * @constructor - * @extends {ol.PluggableMap} - * @param {olx.MapOptions} options Map options. - * @fires ol.MapBrowserEvent - * @fires ol.MapEvent - * @fires ol.render.Event#postcompose - * @fires ol.render.Event#precompose + * @extends {module:ol/PluggableMap~PluggableMap} + * @param {module:ol/PluggableMap~MapOptions} options Map options. + * @fires module:ol/MapBrowserEvent~MapBrowserEvent + * @fires module:ol/MapEvent~MapEvent + * @fires module:ol/render/Event~Event#postcompose + * @fires module:ol/render/Event~Event#precompose * @api */ const CanvasMap = function(options) { diff --git a/src/ol/Collection.js b/src/ol/Collection.js index a713fc4851..760af21ebf 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -25,7 +25,7 @@ const Property = { * @constructor * @extends {module:ol/events/Event~Event} * @implements {oli.CollectionEvent} - * @param {module:ol/CollectionEventType} type Type. + * @param {module:ol/CollectionEventType~CollectionEventType} type Type. * @param {*=} opt_element Element. */ export const CollectionEvent = function(type, opt_element) { diff --git a/src/ol/CollectionEventType.js b/src/ol/CollectionEventType.js index a3f93ae83b..58ee49c827 100644 --- a/src/ol/CollectionEventType.js +++ b/src/ol/CollectionEventType.js @@ -8,13 +8,13 @@ export default { /** * Triggered when an item is added to the collection. - * @event ol.CollectionEvent#add + * @event module:ol/CollectionEvent~CollectionEvent#add * @api */ ADD: 'add', /** * Triggered when an item is removed from the collection. - * @event ol.CollectionEvent#remove + * @event module:ol/CollectionEvent~CollectionEvent#remove * @api */ REMOVE: 'remove' diff --git a/src/ol/Feature.js b/src/ol/Feature.js index 8cf65df0c7..ebe63ccf5f 100644 --- a/src/ol/Feature.js +++ b/src/ol/Feature.js @@ -18,7 +18,7 @@ import Style from './style/Style.js'; * Features can be styled individually with `setStyle`; otherwise they use the * style of their vector layer. * - * Note that attribute properties are set as {@link ol.Object} properties on + * Note that attribute properties are set as {@link module:ol/Object~Object} properties on * the feature object, so they are observable, and have get/set accessors. * * Typically, a feature has a single geometry property. You can set the @@ -30,9 +30,14 @@ import Style from './style/Style.js'; * property associated with the geometry for the feature. For example: * * ```js - * var feature = new ol.Feature({ - * geometry: new ol.geom.Polygon(polyCoords), - * labelPoint: new ol.geom.Point(labelCoords), + * + * import Feature from 'ol/Feature'; + * import Polygon from 'ol/geom/Polygon'; + * import Point from 'ol/geom/Point'; + * + * var feature = new Feature({ + * geometry: new Polygon(polyCoords), + * labelPoint: new Point(labelCoords), * name: 'My Polygon' * }); * @@ -47,11 +52,11 @@ import Style from './style/Style.js'; * ``` * * @constructor - * @extends {ol.Object} - * @param {ol.geom.Geometry|Object.=} opt_geometryOrProperties - * You may pass a Geometry object directly, or an object literal - * containing properties. If you pass an object literal, you may - * include a Geometry associated with a `geometry` key. + * @extends {module:ol/Object~Object} + * @param {module:ol/geom/Geometry~Geometry|Object.=} opt_geometryOrProperties + * You may pass a Geometry object directly, or an object literal containing + * properties. If you pass an object literal, you may include a Geometry + * associated with a `geometry` key. * @api */ const Feature = function(opt_geometryOrProperties) { @@ -73,19 +78,19 @@ const Feature = function(opt_geometryOrProperties) { /** * User provided style. * @private - * @type {ol.style.Style|Array.|ol.StyleFunction} + * @type {module:ol/style/Style~Geometry|Array.|module:ol/style~StyleFunction} */ this.style_ = null; /** * @private - * @type {ol.StyleFunction|undefined} + * @type {module:ol/style~StyleFunction|undefined} */ this.styleFunction_ = undefined; /** * @private - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} */ this.geometryChangeKey_ = null; @@ -112,7 +117,7 @@ inherits(Feature, BaseObject); /** * Clone this feature. If the original feature has a geometry it * is also cloned. The feature id is not set in the clone. - * @return {ol.Feature} The clone. + * @return {module:ol/Feature~Feature} The clone. * @api */ Feature.prototype.clone = function() { @@ -133,13 +138,13 @@ Feature.prototype.clone = function() { /** * Get the feature's default geometry. A feature may have any number of named * geometries. The "default" geometry (the one that is rendered by default) is - * set when calling {@link ol.Feature#setGeometry}. - * @return {ol.geom.Geometry|undefined} The default geometry for the feature. + * set when calling {@link module:ol/Feature~Feature#setGeometry}. + * @return {module:ol/geom/Geometry~Geometry|undefined} The default geometry for the feature. * @api * @observable */ Feature.prototype.getGeometry = function() { - return /** @type {ol.geom.Geometry|undefined} */ ( + return /** @type {module:ol/geom/Geometry~Geometry|undefined} */ ( this.get(this.geometryName_)); }; @@ -147,7 +152,7 @@ Feature.prototype.getGeometry = function() { /** * Get the feature identifier. This is a stable identifier for the feature and * is either set when reading data from a remote source or set explicitly by - * calling {@link ol.Feature#setId}. + * calling {@link module:ol/Feature~Feature#setId}. * @return {number|string|undefined} Id. * @api */ @@ -170,8 +175,8 @@ Feature.prototype.getGeometryName = function() { /** * Get the feature's style. Will return what was provided to the - * {@link ol.Feature#setStyle} method. - * @return {ol.style.Style|Array.|ol.StyleFunction} The feature style. + * {@link module:ol/Feature~Feature#setStyle} method. + * @return {module:ol/style/Style~Geometry|Array.|module:ol/style~StyleFunction} The feature style. * @api */ Feature.prototype.getStyle = function() { @@ -181,7 +186,7 @@ Feature.prototype.getStyle = function() { /** * Get the feature's style function. - * @return {ol.StyleFunction|undefined} Return a function + * @return {module:ol/style~StyleFunction|undefined} Return a function * representing the current style of this feature. * @api */ @@ -217,8 +222,8 @@ Feature.prototype.handleGeometryChanged_ = function() { /** * Set the default geometry for the feature. This will update the property - * with the name returned by {@link ol.Feature#getGeometryName}. - * @param {ol.geom.Geometry|undefined} geometry The new geometry. + * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}. + * @param {module:ol/geom/Geometry~Geometry|undefined} geometry The new geometry. * @api * @observable */ @@ -231,9 +236,9 @@ Feature.prototype.setGeometry = function(geometry) { * Set the style for the feature. This can be a single style object, an array * of styles, or a function that takes a resolution and returns an array of * styles. If it is `null` the feature has no style (a `null` style). - * @param {ol.style.Style|Array.|ol.StyleFunction} style Style for this feature. + * @param {module:ol/style/Style~Geometry|Array.|module:ol/style~StyleFunction} style Style for this feature. * @api - * @fires ol.events.Event#event:change + * @fires module:ol/events/Event~Event#event:change */ Feature.prototype.setStyle = function(style) { this.style_ = style; @@ -245,11 +250,11 @@ Feature.prototype.setStyle = function(style) { /** * Set the feature id. The feature id is considered stable and may be used when * requesting features or comparing identifiers returned from a remote source. - * The feature id can be used with the {@link ol.source.Vector#getFeatureById} - * method. + * The feature id can be used with the + * {@link module:ol/source/Vector~Vector#getFeatureById} method. * @param {number|string|undefined} id The feature id. * @api - * @fires ol.events.Event#event:change + * @fires module:ol/events/Event~Event#event:change */ Feature.prototype.setId = function(id) { this.id_ = id; @@ -259,7 +264,7 @@ Feature.prototype.setId = function(id) { /** * Set the property name to be used when getting the feature's default geometry. - * When calling {@link ol.Feature#getGeometry}, the value of the property with + * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with * this name will be returned. * @param {string} name The property name of the default geometry. * @api @@ -278,25 +283,25 @@ Feature.prototype.setGeometryName = function(name) { /** * Convert the provided object into a feature style function. Functions passed - * through unchanged. Arrays of ol.style.Style or single style objects wrapped + * through unchanged. Arrays of module:ol/style/Style~Geometry or single style objects wrapped * in a new feature style function. - * @param {ol.StyleFunction|!Array.|!ol.style.Style} obj + * @param {module:ol/style~StyleFunction|!Array.|!module:ol/style/Style~Geometry} obj * A feature style function, a single style, or an array of styles. - * @return {ol.StyleFunction} A style function. + * @return {module:ol/style~StyleFunction} A style function. */ export function createStyleFunction(obj) { if (typeof obj === 'function') { return obj; } else { /** - * @type {Array.} + * @type {Array.} */ let styles; if (Array.isArray(obj)) { styles = obj; } else { assert(obj instanceof Style, - 41); // Expected an `ol.style.Style` or an array of `ol.style.Style` + 41); // Expected an `module:ol/style/Style~Geometry` or an array of `module:ol/style/Style~Geometry` styles = [obj]; } return function() { diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index 2f82079d81..780bffd6e8 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -18,7 +18,7 @@ import {get as getProjection, getTransformFromProjections, identityTransform} fr * instantiation. * @property {GeolocationPositionOptions} [trackingOptions] Tracking options. * See {@link http://www.w3.org/TR/geolocation-API/#position_options_interface}. - * @property {module:ol/types~ProjectionLike} [projection] The projection the position + * @property {module:ol/proj~ProjectionLike} [projection] The projection the position * is reported in. */ @@ -58,13 +58,13 @@ const Geolocation = function(opt_options) { /** * The unprojected (EPSG:4326) device position. * @private - * @type {module:ol/types~Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.position_ = null; /** * @private - * @type {module:ol/types~TransformFunction} + * @type {module:ol/proj~TransformFunction} */ this.transform_ = identityTransform; @@ -247,13 +247,13 @@ Geolocation.prototype.getHeading = function() { /** * Get the position of the device. - * @return {module:ol/types~Coordinate|undefined} The current position of the device reported + * @return {module:ol/coordinate~Coordinate|undefined} The current position of the device reported * in the current projection. * @observable * @api */ Geolocation.prototype.getPosition = function() { - return /** @type {module:ol/types~Coordinate|undefined} */ (this.get(GeolocationProperty.POSITION)); + return /** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(GeolocationProperty.POSITION)); }; @@ -308,7 +308,7 @@ Geolocation.prototype.getTrackingOptions = function() { /** * Set the projection to use for transforming the coordinates. - * @param {module:ol/types~ProjectionLike} projection The projection the position is + * @param {module:ol/proj~ProjectionLike} projection The projection the position is * reported in. * @observable * @api diff --git a/src/ol/Graticule.js b/src/ol/Graticule.js index abb4c37c9b..ba9518d977 100644 --- a/src/ol/Graticule.js +++ b/src/ol/Graticule.js @@ -122,7 +122,7 @@ const Graticule = function(opt_options) { this.map_ = null; /** - * @type {?module:ol/types~EventsKey} + * @type {?module:ol/events~EventsKey} * @private */ this.postcomposeListenerKey_ = null; @@ -211,19 +211,19 @@ const Graticule = function(opt_options) { this.strokeStyle_ = options.strokeStyle !== undefined ? options.strokeStyle : DEFAULT_STROKE_STYLE; /** - * @type {module:ol/types~TransformFunction|undefined} + * @type {module:ol/proj~TransformFunction|undefined} * @private */ this.fromLonLatTransform_ = undefined; /** - * @type {module:ol/types~TransformFunction|undefined} + * @type {module:ol/proj~TransformFunction|undefined} * @private */ this.toLonLatTransform_ = undefined; /** - * @type {module:ol/types~Coordinate} + * @type {module:ol/coordinate~Coordinate} * @private */ this.projectionCenterLonLat_ = null; @@ -322,7 +322,7 @@ const Graticule = function(opt_options) { * @param {number} minLat Minimal latitude. * @param {number} maxLat Maximal latitude. * @param {number} squaredTolerance Squared tolerance. - * @param {module:ol/types~Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} index Index. * @return {number} Index. * @private @@ -344,7 +344,7 @@ Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredToleranc /** * @param {module:ol/geom/LineString~LineString} lineString Meridian - * @param {module:ol/types~Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} index Index. * @return {module:ol/geom/Point~Point} Meridian point. * @private @@ -369,7 +369,7 @@ Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) { * @param {number} minLon Minimal longitude. * @param {number} maxLon Maximal longitude. * @param {number} squaredTolerance Squared tolerance. - * @param {module:ol/types~Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} index Index. * @return {number} Index. * @private @@ -392,7 +392,7 @@ Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredToleranc /** * @param {module:ol/geom/LineString~LineString} lineString Parallels. - * @param {module:ol/types~Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} index Index. * @return {module:ol/geom/Point~Point} Parallel point. * @private @@ -413,8 +413,8 @@ Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) { /** - * @param {module:ol/types~Extent} extent Extent. - * @param {module:ol/types~Coordinate} center Center. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} squaredTolerance Squared tolerance. * @private diff --git a/src/ol/Image.js b/src/ol/Image.js index 1f97188232..d55426a6cd 100644 --- a/src/ol/Image.js +++ b/src/ol/Image.js @@ -8,15 +8,35 @@ import {listenOnce, unlistenByKey} from './events.js'; import EventType from './events/EventType.js'; import {getHeight} from './extent.js'; + +/** + * A function that takes an {@link module:ol/Image~Image} for the image and a + * `{string}` for the src as arguments. It is supposed to make it so the + * underlying image {@link module:ol/Image~Image#getImage} is assigned the + * content specified by the src. If not specified, the default is + * + * function(image, src) { + * image.getImage().src = src; + * } + * + * Providing a custom `imageLoadFunction` can be useful to load images with + * post requests or - in general - through XHR requests, where the src of the + * image element would be set to a data URI when the content is loaded. + * + * @typedef {function(module:ol/Image~Image, string)} LoadFunction + * @api + */ + + /** * @constructor - * @extends {ol.ImageBase} - * @param {ol.Extent} extent Extent. + * @extends {module:ol/ImageBase~ImageBase} + * @param {module:ol/extent~Extent} extent Extent. * @param {number|undefined} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {string} src Image source URI. * @param {?string} crossOrigin Cross origin. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. + * @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function. */ const ImageWrapper = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) { @@ -39,19 +59,19 @@ const ImageWrapper = function(extent, resolution, pixelRatio, src, crossOrigin, /** * @private - * @type {Array.} + * @type {Array.} */ this.imageListenerKeys_ = null; /** * @protected - * @type {ol.ImageState} + * @type {module:ol/ImageState~ImageState} */ this.state = ImageState.IDLE; /** * @private - * @type {ol.ImageLoadFunctionType} + * @type {module:ol/Image~LoadFunction} */ this.imageLoadFunction_ = imageLoadFunction; diff --git a/src/ol/ImageBase.js b/src/ol/ImageBase.js index d4bb8f1e88..272f9f879b 100644 --- a/src/ol/ImageBase.js +++ b/src/ol/ImageBase.js @@ -8,11 +8,11 @@ import EventType from './events/EventType.js'; /** * @constructor * @abstract - * @extends {ol.events.EventTarget} - * @param {ol.Extent} extent Extent. + * @extends {module:ol/events/EventTarget~EventTarget} + * @param {module:ol/extent~Extent} extent Extent. * @param {number|undefined} resolution Resolution. * @param {number} pixelRatio Pixel ratio. - * @param {ol.ImageState} state State. + * @param {module:ol/ImageState~ImageState} state State. */ const ImageBase = function(extent, resolution, pixelRatio, state) { @@ -20,7 +20,7 @@ const ImageBase = function(extent, resolution, pixelRatio, state) { /** * @protected - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent = extent; @@ -38,7 +38,7 @@ const ImageBase = function(extent, resolution, pixelRatio, state) { /** * @protected - * @type {ol.ImageState} + * @type {module:ol/ImageState~ImageState} */ this.state = state; @@ -56,7 +56,7 @@ ImageBase.prototype.changed = function() { /** - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. */ ImageBase.prototype.getExtent = function() { return this.extent; @@ -87,7 +87,7 @@ ImageBase.prototype.getResolution = function() { /** - * @return {ol.ImageState} State. + * @return {module:ol/ImageState~ImageState} State. */ ImageBase.prototype.getState = function() { return this.state; diff --git a/src/ol/ImageCanvas.js b/src/ol/ImageCanvas.js index 457caaaeff..a975d3640d 100644 --- a/src/ol/ImageCanvas.js +++ b/src/ol/ImageCanvas.js @@ -5,21 +5,32 @@ import {inherits} from './index.js'; import ImageBase from './ImageBase.js'; import ImageState from './ImageState.js'; + +/** + * A function that is called to trigger asynchronous canvas drawing. It is + * called with a "done" callback that should be called when drawing is done. + * If any error occurs during drawing, the "done" callback should be called with + * that error. + * + * @typedef {function(function(Error))} Loader + */ + + /** * @constructor - * @extends {ol.ImageBase} - * @param {ol.Extent} extent Extent. + * @extends {module:ol/ImageBase~ImageBase} + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {HTMLCanvasElement} canvas Canvas. - * @param {ol.ImageCanvasLoader=} opt_loader Optional loader function to + * @param {module:ol/ImageCanvas~Loader=} opt_loader Optional loader function to * support asynchronous canvas drawing. */ const ImageCanvas = function(extent, resolution, pixelRatio, canvas, opt_loader) { /** * Optional canvas loader function. - * @type {?ol.ImageCanvasLoader} + * @type {?module:ol/ImageCanvas~Loader} * @private */ this.loader_ = opt_loader !== undefined ? opt_loader : null; diff --git a/src/ol/ImageTile.js b/src/ol/ImageTile.js index e22719a3f1..4449738e0f 100644 --- a/src/ol/ImageTile.js +++ b/src/ol/ImageTile.js @@ -10,13 +10,13 @@ import EventType from './events/EventType.js'; /** * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. + * @extends {module:ol/Tile~Tile} + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/TileState~TileState} state State. * @param {string} src Image source URI. * @param {?string} crossOrigin Cross origin. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - * @param {olx.TileOptions=} opt_options Tile options. + * @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function. + * @param {module:ol/Tile~Options=} opt_options Tile options. */ const ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { @@ -47,13 +47,13 @@ const ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction, /** * @private - * @type {Array.} + * @type {Array.} */ this.imageListenerKeys_ = null; /** * @private - * @type {ol.TileLoadFunctionType} + * @type {module:ol/Tile~LoadFunction} */ this.tileLoadFunction_ = tileLoadFunction; diff --git a/src/ol/Map.js b/src/ol/Map.js index 50035aeb57..09c5197f2b 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -41,47 +41,53 @@ registerMultiple(PluginType.LAYER_RENDERER, [ * The map is the core component of OpenLayers. For a map to render, a view, * one or more layers, and a target container are needed: * + * import Map from 'ol/Map'; + * import View from 'ol/View'; + * import TileLayer from 'ol/layer/Tile'; + * import OSM from 'ol/source/OSM'; + * * var map = new Map({ - * view: new ol.View({ + * view: new View({ * center: [0, 0], * zoom: 1 * }), * layers: [ - * new ol.layer.Tile({ - * source: new ol.source.OSM() + * new TileLayer({ + * source: new OSM() * }) * ], * target: 'map' * }); * - * The above snippet creates a map using a {@link ol.layer.Tile} to display - * {@link ol.source.OSM} OSM data and render it to a DOM element with the - * id `map`. + * The above snippet creates a map using a {@link module:ol/layer/Tile~Tile} to + * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM + * element with the id `map`. * * The constructor places a viewport container (with CSS class name * `ol-viewport`) in the target element (see `getViewport()`), and then two * further elements within the viewport: one with CSS class name * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent` - * option of {@link ol.Overlay} for the difference). The map itself is placed in - * a further element within the viewport. + * option of {@link module:ol/Overlay~Overlay} for the difference). The map + * itself is placed in a further element within the viewport. * - * Layers are stored as a `ol.Collection` in layerGroups. A top-level group is - * provided by the library. This is what is accessed by `getLayerGroup` and - * `setLayerGroup`. Layers entered in the options are added to this group, and - * `addLayer` and `removeLayer` change the layer collection in the group. - * `getLayers` is a convenience function for `getLayerGroup().getLayers()`. - * Note that `ol.layer.Group` is a subclass of `ol.layer.Base`, so layers - * entered in the options or added with `addLayer` can be groups, which can - * contain further groups, and so on. + * Layers are stored as a {@link module:ol/Collection~Collection} in + * layerGroups. A top-level group is provided by the library. This is what is + * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the + * options are added to this group, and `addLayer` and `removeLayer` change the + * layer collection in the group. `getLayers` is a convenience function for + * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~Group} + * is a subclass of {@link module:ol/layer/Base~Base}, so layers entered in the + * options or added with `addLayer` can be groups, which can contain further + * groups, and so on. * * @constructor - * @extends {ol.PluggableMap} - * @param {olx.MapOptions} options Map options. - * @fires ol.MapBrowserEvent - * @fires ol.MapEvent - * @fires ol.render.Event#postcompose - * @fires ol.render.Event#precompose + * @extends {module:ol/PluggableMap~PluggableMap} + * @param {module:ol/PluggableMap~MapOptions} options Map options. + * @fires module:ol/MapBrowserEvent~MapBrowserEvent + * @fires module:ol/MapEvent~MapEvent + * @fires module:ol/render/Event~Event#postcompose + * @fires module:ol/render/Event~Event#precompose * @api */ const Map = function(options) { diff --git a/src/ol/MapBrowserEvent.js b/src/ol/MapBrowserEvent.js index bc8d7ce8b8..39c8a7abd7 100644 --- a/src/ol/MapBrowserEvent.js +++ b/src/ol/MapBrowserEvent.js @@ -7,13 +7,13 @@ import MapEvent from './MapEvent.js'; /** * @classdesc * Events emitted as map browser events are instances of this type. - * See {@link ol.Map} for which events trigger a map browser event. + * See {@link module:ol/Map~Map} for which events trigger a map browser event. * * @constructor - * @extends {ol.MapEvent} + * @extends {module:ol/MapEvent~MapEvent} * @implements {oli.MapBrowserEvent} * @param {string} type Event type. - * @param {ol.PluggableMap} map Map. + * @param {module:ol/PluggableMap~PluggableMap} map Map. * @param {Event} browserEvent Browser event. * @param {boolean=} opt_dragging Is the map currently being dragged? * @param {?olx.FrameState=} opt_frameState Frame state. @@ -32,14 +32,14 @@ const MapBrowserEvent = function(type, map, browserEvent, opt_dragging, opt_fram /** * The map pixel relative to the viewport corresponding to the original browser event. - * @type {ol.Pixel} + * @type {module:ol~Pixel} * @api */ this.pixel = map.getEventPixel(browserEvent); /** * The coordinate in view projection corresponding to the original browser event. - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} * @api */ this.coordinate = map.getCoordinateFromPixel(this.pixel); diff --git a/src/ol/MapBrowserEventHandler.js b/src/ol/MapBrowserEventHandler.js index aaf905c765..289c01afb0 100644 --- a/src/ol/MapBrowserEventHandler.js +++ b/src/ol/MapBrowserEventHandler.js @@ -11,10 +11,12 @@ import PointerEventType from './pointer/EventType.js'; import PointerEventHandler from './pointer/PointerEventHandler.js'; /** - * @param {ol.PluggableMap} map The map with the viewport to listen to events on. - * @param {number|undefined} moveTolerance The minimal distance the pointer must travel to trigger a move. + * @param {module:ol/PluggableMap~PluggableMap} map The map with the viewport to + * listen to events on. + * @param {number=} moveTolerance The minimal distance the pointer must travel + * to trigger a move. * @constructor - * @extends {ol.events.EventTarget} + * @extends {module:ol/events/EventTarget~EventTarget} */ const MapBrowserEventHandler = function(map, moveTolerance) { @@ -22,7 +24,7 @@ const MapBrowserEventHandler = function(map, moveTolerance) { /** * This is the element that we will listen to the real events on. - * @type {ol.PluggableMap} + * @type {module:ol/PluggableMap~PluggableMap} * @private */ this.map_ = map; @@ -40,7 +42,7 @@ const MapBrowserEventHandler = function(map, moveTolerance) { this.dragging_ = false; /** - * @type {!Array.} + * @type {!Array.} * @private */ this.dragListenerKeys_ = []; @@ -55,7 +57,7 @@ const MapBrowserEventHandler = function(map, moveTolerance) { /** * The most recent "down" type event (or null if none have occurred). * Set on pointerdown. - * @type {ol.pointer.PointerEvent} + * @type {module:ol/pointer/PointerEvent~PointerEvent} * @private */ this.down_ = null; @@ -78,7 +80,7 @@ const MapBrowserEventHandler = function(map, moveTolerance) { * Event handler which generates pointer events for * the viewport element. * - * @type {ol.pointer.PointerEventHandler} + * @type {module:ol/pointer/PointerEventHandler~PointerEventHandler} * @private */ this.pointerEventHandler_ = new PointerEventHandler(element); @@ -87,13 +89,13 @@ const MapBrowserEventHandler = function(map, moveTolerance) { * Event handler which generates pointer events for * the document (used when dragging). * - * @type {ol.pointer.PointerEventHandler} + * @type {module:ol/pointer/PointerEventHandler~PointerEventHandler} * @private */ this.documentPointerEventHandler_ = null; /** - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} * @private */ this.pointerdownListenerKey_ = listen(this.pointerEventHandler_, @@ -101,7 +103,7 @@ const MapBrowserEventHandler = function(map, moveTolerance) { this.handlePointerDown_, this); /** - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} * @private */ this.relayedListenerKey_ = listen(this.pointerEventHandler_, @@ -114,7 +116,8 @@ inherits(MapBrowserEventHandler, EventTarget); /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @private */ MapBrowserEventHandler.prototype.emulateClick_ = function(pointerEvent) { @@ -143,7 +146,8 @@ MapBrowserEventHandler.prototype.emulateClick_ = function(pointerEvent) { /** * Keeps track on how many pointers are currently active. * - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @private */ MapBrowserEventHandler.prototype.updateActivePointers_ = function(pointerEvent) { @@ -160,7 +164,8 @@ MapBrowserEventHandler.prototype.updateActivePointers_ = function(pointerEvent) /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @private */ MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) { @@ -191,7 +196,8 @@ MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) { /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @return {boolean} If the left mouse button was pressed. * @private */ @@ -201,7 +207,8 @@ MapBrowserEventHandler.prototype.isMouseActionButton_ = function(pointerEvent) { /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @private */ MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent) { @@ -249,7 +256,8 @@ MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent) { /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @private */ MapBrowserEventHandler.prototype.handlePointerMove_ = function(pointerEvent) { @@ -275,7 +283,8 @@ MapBrowserEventHandler.prototype.handlePointerMove_ = function(pointerEvent) { /** * Wrap and relay a pointer event. Note that this requires that the type * string for the MapBrowserPointerEvent matches the PointerEvent type. - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @private */ MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) { @@ -286,7 +295,8 @@ MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) { /** - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @return {boolean} Is moving. * @private */ diff --git a/src/ol/MapBrowserEventType.js b/src/ol/MapBrowserEventType.js index 546572ea71..75e0d84c21 100644 --- a/src/ol/MapBrowserEventType.js +++ b/src/ol/MapBrowserEventType.js @@ -12,28 +12,28 @@ export default { /** * A true single click with no dragging and no double click. Note that this * event is delayed by 250 ms to ensure that it is not a double click. - * @event ol.MapBrowserEvent#singleclick + * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick * @api */ SINGLECLICK: 'singleclick', /** * A click with no dragging. A double click will fire two of this. - * @event ol.MapBrowserEvent#click + * @event module:ol/MapBrowserEvent~MapBrowserEvent#click * @api */ CLICK: EventType.CLICK, /** * A true double click, with no dragging. - * @event ol.MapBrowserEvent#dblclick + * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick * @api */ DBLCLICK: EventType.DBLCLICK, /** * Triggered when a pointer is dragged. - * @event ol.MapBrowserEvent#pointerdrag + * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag * @api */ POINTERDRAG: 'pointerdrag', @@ -41,7 +41,7 @@ export default { /** * Triggered when a pointer is moved. Note that on touch devices this is * triggered when the map is panned, so is not the same as mousemove. - * @event ol.MapBrowserEvent#pointermove + * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove * @api */ POINTERMOVE: 'pointermove', diff --git a/src/ol/MapBrowserPointerEvent.js b/src/ol/MapBrowserPointerEvent.js index e5a4a97bce..f11219e044 100644 --- a/src/ol/MapBrowserPointerEvent.js +++ b/src/ol/MapBrowserPointerEvent.js @@ -6,12 +6,13 @@ import MapBrowserEvent from './MapBrowserEvent.js'; /** * @constructor - * @extends {ol.MapBrowserEvent} + * @extends {module:ol/MapBrowserEvent~MapBrowserEvent} * @param {string} type Event type. - * @param {ol.PluggableMap} map Map. - * @param {ol.pointer.PointerEvent} pointerEvent Pointer event. + * @param {module:ol/PluggableMap~PluggableMap} map Map. + * @param {module:ol/pointer/PointerEvent~PointerEvent} pointerEvent Pointer + * event. * @param {boolean=} opt_dragging Is the map currently being dragged? - * @param {?olx.FrameState=} opt_frameState Frame state. + * @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state. */ const MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging, opt_frameState) { @@ -21,7 +22,7 @@ const MapBrowserPointerEvent = function(type, map, pointerEvent, opt_dragging, /** * @const - * @type {ol.pointer.PointerEvent} + * @type {module:ol/pointer/PointerEvent~PointerEvent} */ this.pointerEvent = pointerEvent; diff --git a/src/ol/MapEvent.js b/src/ol/MapEvent.js index af64662b1b..5aac317f48 100644 --- a/src/ol/MapEvent.js +++ b/src/ol/MapEvent.js @@ -7,14 +7,14 @@ import Event from './events/Event.js'; /** * @classdesc * Events emitted as map events are instances of this type. - * See {@link ol.Map} for which events trigger a map event. + * See {@link module:ol/Map~Map} for which events trigger a map event. * * @constructor - * @extends {ol.events.Event} + * @extends {module:ol/events/Event~Event} * @implements {oli.MapEvent} * @param {string} type Event type. - * @param {ol.PluggableMap} map Map. - * @param {?olx.FrameState=} opt_frameState Frame state. + * @param {module:ol/PluggableMap~PluggableMap} map Map. + * @param {?module:ol/PluggableMap~FrameState=} opt_frameState Frame state. */ const MapEvent = function(type, map, opt_frameState) { @@ -22,14 +22,14 @@ const MapEvent = function(type, map, opt_frameState) { /** * The map where the event occurred. - * @type {ol.PluggableMap} + * @type {module:ol/PluggableMap~PluggableMap} * @api */ this.map = map; /** * The frame state at the time of the event. - * @type {?olx.FrameState} + * @type {?module:ol/PluggableMap~FrameState} * @api */ this.frameState = opt_frameState !== undefined ? opt_frameState : null; diff --git a/src/ol/MapEventType.js b/src/ol/MapEventType.js index 8667a2cb58..0f25adf5b9 100644 --- a/src/ol/MapEventType.js +++ b/src/ol/MapEventType.js @@ -9,21 +9,21 @@ export default { /** * Triggered after a map frame is rendered. - * @event ol.MapEvent#postrender + * @event module:ol/MapEvent~MapEvent#postrender * @api */ POSTRENDER: 'postrender', /** * Triggered when the map starts moving. - * @event ol.MapEvent#movestart + * @event module:ol/MapEvent~MapEvent#movestart * @api */ MOVESTART: 'movestart', /** * Triggered after the map is moved. - * @event ol.MapEvent#moveend + * @event module:ol/MapEvent~MapEvent#moveend * @api */ MOVEEND: 'moveend' diff --git a/src/ol/Object.js b/src/ol/Object.js index 2a51192d43..f76e0632a9 100644 --- a/src/ol/Object.js +++ b/src/ol/Object.js @@ -10,16 +10,17 @@ import {assign} from './obj.js'; /** * @classdesc - * Events emitted by {@link ol.Object} instances are instances of this type. + * Events emitted by {@link module:ol/Object~Object} instances are instances of + * this type. * * @param {string} type The event type. * @param {string} key The property name. * @param {*} oldValue The old value for `key`. - * @extends {ol.events.Event} + * @extends {module:ol/events/Event~Event} * @implements {oli.Object.Event} * @constructor */ -const BaseObjectEvent = function(type, key, oldValue) { +const ObjectEvent = function(type, key, oldValue) { Event.call(this, type); /** @@ -38,7 +39,7 @@ const BaseObjectEvent = function(type, key, oldValue) { this.oldValue = oldValue; }; -inherits(BaseObjectEvent, Event); +inherits(ObjectEvent, Event); /** @@ -47,29 +48,30 @@ inherits(BaseObjectEvent, Event); * instantiated in apps. * Most non-trivial classes inherit from this. * - * This extends {@link ol.Observable} with observable properties, where each - * property is observable as well as the object as a whole. + * This extends {@link module:ol/Observable~Observable} with observable + * properties, where each property is observable as well as the object as a + * whole. * * Classes that inherit from this have pre-defined properties, to which you can * add your owns. The pre-defined properties are listed in this documentation as * 'Observable Properties', and have their own accessors; for example, - * {@link ol.Map} has a `target` property, accessed with `getTarget()` and - * changed with `setTarget()`. Not all properties are however settable. There - * are also general-purpose accessors `get()` and `set()`. For example, - * `get('target')` is equivalent to `getTarget()`. + * {@link module:ol/Map~Map} has a `target` property, accessed with + * `getTarget()` and changed with `setTarget()`. Not all properties are however + * settable. There are also general-purpose accessors `get()` and `set()`. For + * example, `get('target')` is equivalent to `getTarget()`. * * The `set` accessors trigger a change event, and you can monitor this by - * registering a listener. For example, {@link ol.View} has a `center` - * property, so `view.on('change:center', function(evt) {...});` would call the - * function whenever the value of the center property changes. Within the - * function, `evt.target` would be the view, so `evt.target.getCenter()` would - * return the new center. + * registering a listener. For example, {@link module:ol/View~View} has a + * `center` property, so `view.on('change:center', function(evt) {...});` would + * call the function whenever the value of the center property changes. Within + * the function, `evt.target` would be the view, so `evt.target.getCenter()` + * would return the new center. * * You can add your own observable properties with * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`. * You can listen for changes on that property value with * `object.on('change:prop', listener)`. You can get a list of all - * properties with {@link ol.Object#getProperties object.getProperties()}. + * properties with {@link module:ol/Object~Object#getProperties}. * * Note that the observable properties are separate from standard JS properties. * You can, for example, give your map object a title with @@ -81,18 +83,18 @@ inherits(BaseObjectEvent, Event); * object.unset('foo'). * * @constructor - * @extends {ol.Observable} + * @extends {module:ol/Observable~Observable} * @param {Object.=} opt_values An object with key-value pairs. - * @fires ol.Object.Event + * @fires module:ol/Object~ObjectEvent * @api */ const BaseObject = function(opt_values) { Observable.call(this); - // Call ol.getUid to ensure that the order of objects' ids is the same as - // the order in which they were created. This also helps to ensure that - // object properties are always added in the same order, which helps many - // JavaScript engines generate faster code. + // Call {@link module:ol~getUid} to ensure that the order of objects' ids is + // the same as the order in which they were created. This also helps to + // ensure that object properties are always added in the same order, which + // helps many JavaScript engines generate faster code. getUid(this); /** @@ -168,9 +170,9 @@ BaseObject.prototype.getProperties = function() { BaseObject.prototype.notify = function(key, oldValue) { let eventType; eventType = getChangeEventType(key); - this.dispatchEvent(new BaseObjectEvent(eventType, key, oldValue)); + this.dispatchEvent(new ObjectEvent(eventType, key, oldValue)); eventType = ObjectEventType.PROPERTYCHANGE; - this.dispatchEvent(new BaseObjectEvent(eventType, key, oldValue)); + this.dispatchEvent(new ObjectEvent(eventType, key, oldValue)); }; diff --git a/src/ol/ObjectEventType.js b/src/ol/ObjectEventType.js index 8ebcc9d293..2fc546c02b 100644 --- a/src/ol/ObjectEventType.js +++ b/src/ol/ObjectEventType.js @@ -8,7 +8,7 @@ export default { /** * Triggered when a property is changed. - * @event ol.Object.Event#propertychange + * @event module:ol/Object~Event#propertychange * @api */ PROPERTYCHANGE: 'propertychange' diff --git a/src/ol/Observable.js b/src/ol/Observable.js index 596ea0788e..caaeb99b7c 100644 --- a/src/ol/Observable.js +++ b/src/ol/Observable.js @@ -12,11 +12,11 @@ import EventType from './events/EventType.js'; * instantiated in apps. * An event target providing convenient methods for listener registration * and unregistration. A generic `change` event is always available through - * {@link ol.Observable#changed}. + * {@link module:ol/Observable~Observable#changed}. * * @constructor - * @extends {ol.events.EventTarget} - * @fires ol.events.Event + * @extends {module:ol/events/EventTarget~EventTarget} + * @fires module:ol/events/Event~Event * @struct * @api */ @@ -37,7 +37,7 @@ inherits(Observable, EventTarget); /** * Removes an event listener using the key returned by `on()` or `once()`. - * @param {ol.EventsKey|Array.} key The key returned by `on()` + * @param {module:ol/events~EventsKey|Array.} key The key returned by `on()` * or `once()` (or an array of keys). * @api */ @@ -47,7 +47,7 @@ export function unByKey(key) { unlistenByKey(key[i]); } } else { - unlistenByKey(/** @type {ol.EventsKey} */ (key)); + unlistenByKey(/** @type {module:ol/events~EventsKey} */ (key)); } } @@ -68,8 +68,8 @@ Observable.prototype.changed = function() { * Object with a `type` property. * * @param {{type: string, - * target: (EventTarget|ol.events.EventTarget|undefined)}|ol.events.Event| - * string} event Event object. + * target: (EventTarget|module:ol/events/EventTarget~EventTarget|undefined)}| + * module:ol/events/Event~Event|string} event Event object. * @function * @api */ @@ -91,7 +91,7 @@ Observable.prototype.getRevision = function() { * Listen for a certain type of event. * @param {string|Array.} type The event type or array of event types. * @param {function(?): ?} listener The listener function. - * @return {ol.EventsKey|Array.} Unique key for the listener. If + * @return {module:ol/events~EventsKey|Array.} Unique key for the listener. If * called with an array of event types as the first argument, the return * will be an array of keys. * @api @@ -114,7 +114,7 @@ Observable.prototype.on = function(type, listener) { * Listen once for a certain type of event. * @param {string|Array.} type The event type or array of event types. * @param {function(?): ?} listener The listener function. - * @return {ol.EventsKey|Array.} Unique key for the listener. If + * @return {module:ol/events~EventsKey|Array.} Unique key for the listener. If * called with an array of event types as the first argument, the return * will be an array of keys. * @api diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index b739ae480b..9f56dfd969 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -11,6 +11,57 @@ import {listen, unlistenByKey} from './events.js'; import {containsExtent} from './extent.js'; +/** + * @typedef {Object} OverlayOptions + * @property {number|string} [id] Set the overlay id. The overlay id can be used + * with the {@link module:ol/Map~Map#getOverlayById} method. + * @property {Element} [element] The overlay element. + * @property {Array.} [offset=[0, 0]] Offsets in pixels used when positioning + * the overlay. The first element in the + * array is the horizontal offset. A positive value shifts the overlay right. + * The second element in the array is the vertical offset. A positive value + * shifts the overlay down. + * @property {module:ol/coordinate~Coordinate~Coordinate} [position] The overlay position + * in map projection. + * @property {module:ol/OverlayPositioning~OverlayPositioning} [positioning='top-left'] Defines how + * the overlay is actually positioned with respect to its `position` property. + * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`, + * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`, + * `'top-center'`, and `'top-right'`. + * @property {boolean} [stopEvent=true] Whether event propagation to the map + * viewport should be stopped. If `true` the overlay is placed in the same + * container as that of the controls (CSS class name + * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container + * with CSS class name `ol-overlaycontainer`. + * @property {boolean} [insertFirst=true] Whether the overlay is inserted first + * in the overlay container, or appended. If the overlay is placed in the same + * container as that of the controls (see the `stopEvent` option) you will + * probably set `insertFirst` to `true` so the overlay is displayed below the + * controls. + * @property {boolean} [autoPan=false] If set to `true` the map is panned when + * calling `setPosition`, so that the overlay is entirely visible in the current + * viewport. + * @property {module:ol/Overlay~OverlayPanOptions} [autoPanAnimation] The + * animation options used to pan the overlay into view. This animation is only + * used when `autoPan` is enabled. A `duration` and `easing` may be provided to + * customize the animation. + * @property {number} [autoPanMargin=20] The margin (in pixels) between the + * overlay and the borders of the map when autopanning. + * @property {string} [className='ol-overlay-container ol-selectable'] CSS class + * name. + */ + + +/** + * @typedef {Object} OverlayPanOptions + * @property {number} [duration=1000] The duration of the animation in + * milliseconds. + * @property {function(number):number} [easing] The easing function to use. Can + * be one from {@link module:ol/easing} or a custom function. + * Default is {@link module:ol/easing~inAndOut}. + */ + + /** * @enum {string} * @protected @@ -27,21 +78,23 @@ const Property = { /** * @classdesc * An element to be displayed over the map and attached to a single map - * location. Like {@link ol.control.Control}, Overlays are visible widgets. - * Unlike Controls, they are not in a fixed position on the screen, but are tied - * to a geographical coordinate, so panning the map will move an Overlay but not - * a Control. + * location. Like {@link module:ol/control/Control~Control}, Overlays are + * visible widgets. Unlike Controls, they are not in a fixed position on the + * screen, but are tied to a geographical coordinate, so panning the map will + * move an Overlay but not a Control. * * Example: * - * var popup = new ol.Overlay({ + * import Overlay from 'ol/Overlay'; + * + * var popup = new Overlay({ * element: document.getElementById('popup') * }); * popup.setPosition(coordinate); * map.addOverlay(popup); * * @constructor - * @extends {ol.Object} + * @extends {module:ol/Object~Object} * @param {olx.OverlayOptions} options Overlay options. * @api */ @@ -121,7 +174,7 @@ const Overlay = function(options) { /** * @protected - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} */ this.mapPostrenderListenerKey = null; @@ -152,7 +205,7 @@ const Overlay = function(options) { this.setOffset(options.offset !== undefined ? options.offset : [0, 0]); this.setPositioning(options.positioning !== undefined ? - /** @type {ol.OverlayPositioning} */ (options.positioning) : + /** @type {module:ol/OverlayPositioning~OverlayPositioning} */ (options.positioning) : OverlayPositioning.TOP_LEFT); if (options.position !== undefined) { @@ -187,12 +240,13 @@ Overlay.prototype.getId = function() { /** * Get the map associated with this overlay. - * @return {ol.PluggableMap|undefined} The map that the overlay is part of. + * @return {module:ol/PluggableMap~PluggableMap|undefined} The map that the + * overlay is part of. * @observable * @api */ Overlay.prototype.getMap = function() { - return /** @type {ol.PluggableMap|undefined} */ (this.get(Property.MAP)); + return /** @type {module:ol/PluggableMap~PluggableMap|undefined} */ (this.get(Property.MAP)); }; @@ -209,25 +263,25 @@ Overlay.prototype.getOffset = function() { /** * Get the current position of this overlay. - * @return {ol.Coordinate|undefined} The spatial point that the overlay is + * @return {module:ol/coordinate~Coordinate|undefined} The spatial point that the overlay is * anchored at. * @observable * @api */ Overlay.prototype.getPosition = function() { - return /** @type {ol.Coordinate|undefined} */ (this.get(Property.POSITION)); + return /** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(Property.POSITION)); }; /** * Get the current positioning of this overlay. - * @return {ol.OverlayPositioning} How the overlay is positioned + * @return {module:ol/OverlayPositioning~OverlayPositioning} How the overlay is positioned * relative to its point on the map. * @observable * @api */ Overlay.prototype.getPositioning = function() { - return /** @type {ol.OverlayPositioning} */ (this.get(Property.POSITIONING)); + return /** @type {module:ol/OverlayPositioning~OverlayPositioning} */ (this.get(Property.POSITIONING)); }; @@ -316,7 +370,8 @@ Overlay.prototype.setElement = function(element) { /** * Set the map to be associated with this overlay. - * @param {ol.PluggableMap|undefined} map The map that the overlay is part of. + * @param {module:ol/PluggableMap~PluggableMap|undefined} map The map that the + * overlay is part of. * @observable * @api */ @@ -339,7 +394,7 @@ Overlay.prototype.setOffset = function(offset) { /** * Set the position for this overlay. If the position is `undefined` the * overlay is hidden. - * @param {ol.Coordinate|undefined} position The spatial point that the overlay + * @param {module:ol/coordinate~Coordinate|undefined} position The spatial point that the overlay * is anchored at. * @observable * @api @@ -390,7 +445,7 @@ Overlay.prototype.panIntoView = function() { } if (delta[0] !== 0 || delta[1] !== 0) { - const center = /** @type {ol.Coordinate} */ (map.getView().getCenter()); + const center = /** @type {module:ol/coordinate~Coordinate} */ (map.getView().getCenter()); const centerPx = map.getPixelFromCoordinate(center); const newCenterPx = [ centerPx[0] + delta[0], @@ -410,8 +465,8 @@ Overlay.prototype.panIntoView = function() { /** * Get the extent of an element relative to the document * @param {Element|undefined} element The element. - * @param {ol.Size|undefined} size The size of the element. - * @return {ol.Extent} The extent. + * @param {module:ol/size~Size|undefined} size The size of the element. + * @return {module:ol/extent~Extent} The extent. * @protected */ Overlay.prototype.getRect = function(element, size) { @@ -429,7 +484,7 @@ Overlay.prototype.getRect = function(element, size) { /** * Set the positioning for this overlay. - * @param {ol.OverlayPositioning} positioning how the overlay is + * @param {module:ol/OverlayPositioning~OverlayPositioning} positioning how the overlay is * positioned relative to its point on the map. * @observable * @api @@ -471,8 +526,8 @@ Overlay.prototype.updatePixelPosition = function() { /** - * @param {ol.Pixel} pixel The pixel location. - * @param {ol.Size|undefined} mapSize The map size. + * @param {module:ol~Pixel} pixel The pixel location. + * @param {module:ol/size~Size|undefined} mapSize The map size. * @protected */ Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) { diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index f5f3a6c37f..3617503080 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -31,6 +31,36 @@ import {DROP} from './structs/PriorityQueue.js'; import {create as createTransform, apply as applyTransform} from './transform.js'; +/** + * State of the current frame. Only `pixelRatio`, `time` and `viewState` should + * be used in applications. + * @typedef {Object} FrameState + * @property {number} pixelRatio The pixel ratio of the frame. + * @property {number} time The time when rendering of the frame was requested. + * @property {olx.ViewState} viewState The state of the current view. + * @property {boolean} animate + * @property {module:ol/transform~Transform} coordinateToPixelTransform + * @property {null|module:ol/extent~Extent} extent + * @property {module:ol/coordinate~Coordinate} focus + * @property {number} index + * @property {Object.} layerStates + * @property {Array.} postRenderFunctions + * @property {module:ol/size~Size} size + * @property {!Object.} skippedFeatureUids + * @property {module:ol/TileQueue~TileQueue} tileQueue + * @property {Object.>} usedTiles + * @property {Array.} viewHints + * @property {!Object.>} wantedTiles + */ + + +/** + * @typedef {function(module:ol/PluggableMap~PluggableMap, ?olx.FrameState): boolean} PostRenderFunction + */ + + /** * @typedef {Object} MapOptionsInternal * @property {module:ol/Collection~Collection.} [controls] @@ -45,7 +75,7 @@ import {create as createTransform, apply as applyTransform} from './transform.js /** * Object literal with config options for the map. * @typedef {Object} MapOptions - * @property {module:ol/Collection~Collectiion.|Array.} [controls] + * @property {module:ol/Collection~Collection.|Array.} [controls] * Controls initially added to the map. If not specified, * {@link module:ol/control~defaults} is used. * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between @@ -157,13 +187,13 @@ const PluggableMap = function(options) { /** * @private - * @type {module:ol/types~Transform} + * @type {module:ol/transform~Transform} */ this.coordinateToPixelTransform_ = createTransform(); /** * @private - * @type {module:ol/types~Transform} + * @type {module:ol/transform~Transform} */ this.pixelToCoordinateTransform_ = createTransform(); @@ -182,25 +212,25 @@ const PluggableMap = function(options) { /** * The extent at the previous 'moveend' event. * @private - * @type {module:ol/types~Extent} + * @type {module:ol/extent~Extent} */ this.previousExtent_ = null; /** * @private - * @type {?module:ol/types~EventsKey} + * @type {?module:ol/events~EventsKey} */ this.viewPropertyListenerKey_ = null; /** * @private - * @type {?module:ol/types~EventsKey} + * @type {?module:ol/events~EventsKey} */ this.viewChangeListenerKey_ = null; /** * @private - * @type {Array.} + * @type {Array.} */ this.layerGroupPropertyListenerKeys_ = null; @@ -265,7 +295,7 @@ const PluggableMap = function(options) { /** * @private - * @type {Array.} + * @type {Array.} */ this.keyHandlerKeys_ = null; @@ -315,13 +345,13 @@ const PluggableMap = function(options) { /** * @private - * @type {module:ol/types~Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.focus_ = null; /** * @private - * @type {!Array.} + * @type {!Array.} */ this.postRenderFunctions_ = []; @@ -515,7 +545,7 @@ PluggableMap.prototype.disposeInternal = function() { * Detect features that intersect a pixel on the viewport, and execute a * callback with each intersecting feature. Layers included in the detection can * be configured through the `layerFilter` option in `opt_options`. - * @param {module:ol/types~Pixel} pixel Pixel. + * @param {module:ol~Pixel} pixel Pixel. * @param {function(this: S, (module:ol/Feature~Feature|module:ol/render/Feature~Feature), * module:ol/layer/Layer~Layer): T} callback Feature callback. The callback will be * called with two arguments. The first argument is one @@ -548,7 +578,7 @@ PluggableMap.prototype.forEachFeatureAtPixel = function(pixel, callback, opt_opt /** * Get all features that intersect a pixel on the viewport. - * @param {module:ol/types~Pixel} pixel Pixel. + * @param {module:ol~Pixel} pixel Pixel. * @param {olx.AtPixelOptions=} opt_options Optional options. * @return {Array.} The detected features or * `null` if none were found. @@ -569,7 +599,7 @@ PluggableMap.prototype.getFeaturesAtPixel = function(pixel, opt_options) { * Detect layers that have a color value at a pixel on the viewport, and * execute a callback with each matching layer. Layers included in the * detection can be configured through `opt_layerFilter`. - * @param {module:ol/types~Pixel} pixel Pixel. + * @param {module:ol~Pixel} pixel Pixel. * @param {function(this: S, module:ol/layer/Layer~Layer, (Uint8ClampedArray|Uint8Array)): T} callback * Layer callback. This callback will receive two arguments: first is the * {@link module:ol/layer/Layer~Layer layer}, second argument is an array representing @@ -605,7 +635,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/types~Pixel} pixel Pixel. + * @param {module:ol~Pixel} pixel Pixel. * @param {olx.AtPixelOptions=} opt_options Optional options. * @return {boolean} Is there a feature at the given pixel? * @template U @@ -628,7 +658,7 @@ PluggableMap.prototype.hasFeatureAtPixel = function(pixel, opt_options) { /** * Returns the coordinate in view projection for a browser event. * @param {Event} event Event. - * @return {module:ol/types~Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. * @api */ PluggableMap.prototype.getEventCoordinate = function(event) { @@ -639,7 +669,7 @@ PluggableMap.prototype.getEventCoordinate = function(event) { /** * Returns the map pixel position for a browser event relative to the viewport. * @param {Event} event Event. - * @return {module:ol/types~Pixel} Pixel. + * @return {module:ol~Pixel} Pixel. * @api */ PluggableMap.prototype.getEventPixel = function(event) { @@ -686,8 +716,8 @@ PluggableMap.prototype.getTargetElement = function() { /** * Get the coordinate for a given pixel. This returns a coordinate in the * map view projection. - * @param {module:ol/types~Pixel} pixel Pixel position in the map viewport. - * @return {module:ol/types~Coordinate} The coordinate for the pixel position. + * @param {module:ol~Pixel} pixel Pixel position in the map viewport. + * @return {module:ol/coordinate~Coordinate} The coordinate for the pixel position. * @api */ PluggableMap.prototype.getCoordinateFromPixel = function(pixel) { @@ -774,8 +804,8 @@ PluggableMap.prototype.getLayers = function() { /** * Get the pixel for a coordinate. This takes a coordinate in the map view * projection and returns the corresponding pixel. - * @param {module:ol/types~Coordinate} coordinate A map coordinate. - * @return {module:ol/types~Pixel} A pixel position in the map viewport. + * @param {module:ol/coordinate~Coordinate} coordinate A map coordinate. + * @return {module:ol~Pixel} A pixel position in the map viewport. * @api */ PluggableMap.prototype.getPixelFromCoordinate = function(coordinate) { @@ -799,12 +829,12 @@ PluggableMap.prototype.getRenderer = function() { /** * Get the size of this map. - * @return {module:ol/types~Size|undefined} The size in pixels of the map in the DOM. + * @return {module:ol/size~Size|undefined} The size in pixels of the map in the DOM. * @observable * @api */ PluggableMap.prototype.getSize = function() { - return /** @type {module:ol/types~Size|undefined} */ (this.get(MapProperty.SIZE)); + return /** @type {module:ol/size~Size|undefined} */ (this.get(MapProperty.SIZE)); }; @@ -857,7 +887,7 @@ PluggableMap.prototype.getOverlayContainerStopEvent = function() { /** * @param {module:ol/Tile~Tile} tile Tile. * @param {string} tileSourceKey Tile source key. - * @param {module:ol/types~Coordinate} tileCenter Tile center. + * @param {module:ol/coordinate~Coordinate} tileCenter Tile center. * @param {number} tileResolution Tile resolution. * @return {number} Tile priority. */ @@ -1277,7 +1307,7 @@ PluggableMap.prototype.setLayerGroup = function(layerGroup) { /** * Set the size of this map. - * @param {module:ol/types~Size|undefined} size The size in pixels of the map in the DOM. + * @param {module:ol/size~Size|undefined} size The size in pixels of the map in the DOM. * @observable * @api */ diff --git a/src/ol/Tile.js b/src/ol/Tile.js index 7399ccd868..a132a9c55b 100644 --- a/src/ol/Tile.js +++ b/src/ol/Tile.js @@ -7,16 +7,52 @@ import {easeIn} from './easing.js'; import EventTarget from './events/EventTarget.js'; import EventType from './events/EventType.js'; + +/** + * A function that takes an {@link module:ol/Tile~Tile} for the tile and a + * `{string}` for the url as arguments. + * + * @typedef {function(module:ol/Tile~Tile, string)} LoadFunction + * @api + */ + + +/** + * {@link module:ol/source/Tile~Tile} sources use a function of this type to get + * the url that provides a tile for a given tile coordinate. + * + * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile + * coordinate, a `{number}` representing the pixel ratio and a + * {@link module:ol/proj/Projection~Projection} for the projection as arguments + * and returns a `{string}` representing the tile URL, or undefined if no tile + * should be requested for the passed tile coordinate. + * + * @typedef {function(module:ol/tilecoord~TileCoord, number, + * module:ol/proj/Projection~Projection): (string|undefined)} Type + * @api + */ + + +/** + * @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. + * @api + */ + + /** * @classdesc * Base class for tiles. * * @constructor * @abstract - * @extends {ol.events.EventTarget} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. - * @param {olx.TileOptions=} opt_options Tile options. + * @extends {module:ol/events/EventTarget~EventTarget} + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/TileState~TileState} state State. + * @param {module:ol/Tile~Options=} opt_options Tile options. */ const Tile = function(tileCoord, state, opt_options) { EventTarget.call(this); @@ -24,13 +60,13 @@ const Tile = function(tileCoord, state, opt_options) { const options = opt_options ? opt_options : {}; /** - * @type {ol.TileCoord} + * @type {module:ol/tilecoord~TileCoord} */ this.tileCoord = tileCoord; /** * @protected - * @type {ol.TileState} + * @type {module:ol/TileState~TileState} */ this.state = state; @@ -38,7 +74,7 @@ const Tile = function(tileCoord, state, opt_options) { * An "interim" tile for this tile. The interim tile may be used while this * one is loading, for "smooth" transitions when changing params/dimensions * on the source. - * @type {ol.Tile} + * @type {module:ol/Tile~Tile} */ this.interimTile = null; @@ -88,7 +124,7 @@ Tile.prototype.getKey = function() { * Get the interim tile most suitable for rendering using the chain of interim * tiles. This corresponds to the most recent tile that has been loaded, if no * such tile exists, the original tile is returned. - * @return {!ol.Tile} Best tile for rendering. + * @return {!module:ol/Tile~Tile} Best tile for rendering. */ Tile.prototype.getInterimTile = function() { if (!this.interimTile) { @@ -148,7 +184,7 @@ Tile.prototype.refreshInterimChain = function() { /** * Get the tile coordinate for this tile. - * @return {ol.TileCoord} The tile coordinate. + * @return {module:ol/tilecoord~TileCoord} The tile coordinate. * @api */ Tile.prototype.getTileCoord = function() { @@ -157,14 +193,14 @@ Tile.prototype.getTileCoord = function() { /** - * @return {ol.TileState} State. + * @return {module:ol/TileState~TileState} State. */ Tile.prototype.getState = function() { return this.state; }; /** - * @param {ol.TileState} state State. + * @param {module:ol/TileState~TileState} state State. */ Tile.prototype.setState = function(state) { this.state = state; diff --git a/src/ol/TileCache.js b/src/ol/TileCache.js index 4c9ef844c4..d670733ed9 100644 --- a/src/ol/TileCache.js +++ b/src/ol/TileCache.js @@ -7,7 +7,7 @@ import {fromKey, getKey} from './tilecoord.js'; /** * @constructor - * @extends {ol.structs.LRUCache.} + * @extends {module:ol/structs/LRUCache~LRUCache.} * @param {number=} opt_highWaterMark High water mark. * @struct */ @@ -21,7 +21,7 @@ inherits(TileCache, LRUCache); /** - * @param {!Object.} usedTiles Used tiles. + * @param {!Object.} usedTiles Used tiles. */ TileCache.prototype.expireCache = function(usedTiles) { while (this.canExpireCache()) { diff --git a/src/ol/TileQueue.js b/src/ol/TileQueue.js index c5fe6a7eef..17ce82139d 100644 --- a/src/ol/TileQueue.js +++ b/src/ol/TileQueue.js @@ -7,10 +7,16 @@ import {listen, unlisten} from './events.js'; import EventType from './events/EventType.js'; import PriorityQueue from './structs/PriorityQueue.js'; + +/** + * @typedef {function(module:ol/Tile~Tile, string, module:ol/coordinate~Coordinate, number): number} PriorityFunction + */ + + /** * @constructor - * @extends {ol.structs.PriorityQueue.} - * @param {ol.TilePriorityFunction} tilePriorityFunction + * @extends {module:ol/structs/PriorityQueue~PriorityQueue.} + * @param {module:ol/TileQueue~PriorityFunction} tilePriorityFunction * Tile priority function. * @param {function(): ?} tileChangeCallback * Function called on each tile change event. @@ -32,7 +38,7 @@ const TileQueue = function(tilePriorityFunction, tileChangeCallback) { * @return {string} Key. */ function(element) { - return /** @type {ol.Tile} */ (element[0]).getKey(); + return /** @type {module:ol/Tile~Tile} */ (element[0]).getKey(); }); /** @@ -81,11 +87,11 @@ TileQueue.prototype.getTilesLoading = function() { /** - * @param {ol.events.Event} event Event. + * @param {module:ol/events/Event~Event} event Event. * @protected */ TileQueue.prototype.handleTileChange = function(event) { - const tile = /** @type {ol.Tile} */ (event.target); + const tile = /** @type {module:ol/Tile~Tile} */ (event.target); const state = tile.getState(); if (state === TileState.LOADED || state === TileState.ERROR || state === TileState.EMPTY || state === TileState.ABORT) { @@ -111,7 +117,7 @@ TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) { let state, tile, tileKey; while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads && this.getCount() > 0) { - tile = /** @type {ol.Tile} */ (this.dequeue()[0]); + tile = /** @type {module:ol/Tile~Tile} */ (this.dequeue()[0]); tileKey = tile.getKey(); state = tile.getState(); if (state === TileState.ABORT) { diff --git a/src/ol/TileRange.js b/src/ol/TileRange.js index 8aaabaf6f4..7e203238d1 100644 --- a/src/ol/TileRange.js +++ b/src/ol/TileRange.js @@ -42,8 +42,8 @@ const TileRange = function(minX, maxX, minY, maxY) { * @param {number} maxX Maximum X. * @param {number} minY Minimum Y. * @param {number} maxY Maximum Y. - * @param {ol.TileRange|undefined} tileRange TileRange. - * @return {ol.TileRange} Tile range. + * @param {module:ol/TileRange~TileRange=} tileRange TileRange. + * @return {module:ol/TileRange~TileRange} Tile range. */ export function createOrUpdate(minX, maxX, minY, maxY, tileRange) { if (tileRange !== undefined) { @@ -59,7 +59,7 @@ export function createOrUpdate(minX, maxX, minY, maxY, tileRange) { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @return {boolean} Contains tile coordinate. */ TileRange.prototype.contains = function(tileCoord) { @@ -68,7 +68,7 @@ TileRange.prototype.contains = function(tileCoord) { /** - * @param {ol.TileRange} tileRange Tile range. + * @param {module:ol/TileRange~TileRange} tileRange Tile range. * @return {boolean} Contains. */ TileRange.prototype.containsTileRange = function(tileRange) { @@ -88,7 +88,7 @@ TileRange.prototype.containsXY = function(x, y) { /** - * @param {ol.TileRange} tileRange Tile range. + * @param {module:ol/TileRange~TileRange} tileRange Tile range. * @return {boolean} Equals. */ TileRange.prototype.equals = function(tileRange) { @@ -98,7 +98,7 @@ TileRange.prototype.equals = function(tileRange) { /** - * @param {ol.TileRange} tileRange Tile range. + * @param {module:ol/TileRange~TileRange} tileRange Tile range. */ TileRange.prototype.extend = function(tileRange) { if (tileRange.minX < this.minX) { @@ -125,7 +125,7 @@ TileRange.prototype.getHeight = function() { /** - * @return {ol.Size} Size. + * @return {module:ol/size~Size} Size. */ TileRange.prototype.getSize = function() { return [this.getWidth(), this.getHeight()]; @@ -141,7 +141,7 @@ TileRange.prototype.getWidth = function() { /** - * @param {ol.TileRange} tileRange Tile range. + * @param {module:ol/TileRange~TileRange} tileRange Tile range. * @return {boolean} Intersects. */ TileRange.prototype.intersects = function(tileRange) { diff --git a/src/ol/VectorImageTile.js b/src/ol/VectorImageTile.js index 053beecdab..2fee0f23f2 100644 --- a/src/ol/VectorImageTile.js +++ b/src/ol/VectorImageTile.js @@ -10,27 +10,37 @@ import {getHeight, getIntersection, getWidth} from './extent.js'; import EventType from './events/EventType.js'; import {loadFeaturesXhr} from './featureloader.js'; + +/** + * @typedef {Object} ReplayState + * @property {boolean} dirty + * @property {null|module:ol/render~OrderFunction} renderedRenderOrder + * @property {number} renderedTileRevision + * @property {number} renderedRevision + */ + + /** * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. + * @extends {module:ol/Tile~Tile} + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/TileState~TileState} state State. * @param {number} sourceRevision Source revision. - * @param {ol.format.Feature} format Feature format. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - * @param {ol.TileCoord} urlTileCoord Wrapped tile coordinate for source urls. - * @param {ol.TileUrlFunctionType} tileUrlFunction Tile url function. - * @param {ol.tilegrid.TileGrid} sourceTileGrid Tile grid of the source. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid of the renderer. - * @param {Object.} sourceTiles Source tiles. + * @param {module:ol/format/Feature~Feature} format Feature format. + * @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function. + * @param {module:ol/tilecoord~TileCoord} urlTileCoord Wrapped tile coordinate for source urls. + * @param {module:ol/Tile~UrlFunction} tileUrlFunction Tile url function. + * @param {module:ol/tilegrid/TileGrid~TileGrid} sourceTileGrid Tile grid of the source. + * @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid of the renderer. + * @param {Object.} sourceTiles Source tiles. * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. - * @param {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string, - * ol.format.Feature, ol.TileLoadFunctionType)} tileClass Class to + * @param {module:ol/proj/Projection~Projection} projection Projection. + * @param {function(new: module:ol/VectorTile~VectorTile, module:ol/tilecoord~TileCoord, module:ol/TileState~TileState, string, + * module:ol/format/Feature~Feature, module:ol/Tile~LoadFunction)} tileClass Class to * instantiate for source tiles. - * @param {function(this: ol.source.VectorTile, ol.events.Event)} handleTileChange + * @param {function(this: module:ol/source/VectorTile~VectorTile, module:ol/events/Event~Event)} handleTileChange * Function to call when a source tile's state changes. - * @param {olx.TileOptions=} opt_options Tile options. + * @param {module:ol/Tile~Options=} opt_options Tile options. */ const VectorImageTile = function(tileCoord, state, sourceRevision, format, tileLoadFunction, urlTileCoord, tileUrlFunction, sourceTileGrid, tileGrid, @@ -46,19 +56,19 @@ const VectorImageTile = function(tileCoord, state, sourceRevision, format, /** * @private - * @type {ol.FeatureLoader} + * @type {module:ol/featureloader~FeatureLoader} */ this.loader_; /** * @private - * @type {!Object.} + * @type {!Object.} */ this.replayState_ = {}; /** * @private - * @type {Object.} + * @type {Object.} */ this.sourceTiles_ = sourceTiles; @@ -74,17 +84,17 @@ const VectorImageTile = function(tileCoord, state, sourceRevision, format, this.sourceRevision_ = sourceRevision; /** - * @type {ol.TileCoord} + * @type {module:ol/tilecoord~TileCoord} */ this.wrappedTileCoord = urlTileCoord; /** - * @type {Array.} + * @type {Array.} */ this.loadListenerKeys_ = []; /** - * @type {Array.} + * @type {Array.} */ this.sourceTileListenerKeys_ = []; @@ -154,7 +164,7 @@ VectorImageTile.prototype.disposeInternal = function() { /** - * @param {ol.layer.Layer} layer Layer. + * @param {module:ol/layer/Layer~Layer} layer Layer. * @return {CanvasRenderingContext2D} The rendering context. */ VectorImageTile.prototype.getContext = function(layer) { @@ -168,7 +178,7 @@ VectorImageTile.prototype.getContext = function(layer) { /** * Get the Canvas for this tile. - * @param {ol.layer.Layer} layer Layer. + * @param {module:ol/layer/Layer~Layer} layer Layer. * @return {HTMLCanvasElement} Canvas. */ VectorImageTile.prototype.getImage = function(layer) { @@ -178,8 +188,8 @@ VectorImageTile.prototype.getImage = function(layer) { /** - * @param {ol.layer.Layer} layer Layer. - * @return {ol.TileReplayState} The replay state. + * @param {module:ol/layer/Layer~Layer} layer Layer. + * @return {module:ol/VectorImageTile~ReplayState} The replay state. */ VectorImageTile.prototype.getReplayState = function(layer) { const key = getUid(layer).toString(); @@ -205,7 +215,7 @@ VectorImageTile.prototype.getKey = function() { /** * @param {string} tileKey Key (tileCoord) of the source tile. - * @return {ol.VectorTile} Source tile. + * @return {module:ol/VectorTile~VectorTile} Source tile. */ VectorImageTile.prototype.getTile = function(tileKey) { return this.sourceTiles_[tileKey]; @@ -289,7 +299,7 @@ export default VectorImageTile; /** * Sets the loader for a tile. - * @param {ol.VectorTile} tile Vector tile. + * @param {module:ol/VectorTile~VectorTile} tile Vector tile. * @param {string} url URL. */ export function defaultLoadFunction(tile, url) { diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js index d15204ba54..eda9642ad7 100644 --- a/src/ol/VectorTile.js +++ b/src/ol/VectorTile.js @@ -7,13 +7,13 @@ import TileState from './TileState.js'; /** * @constructor - * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.TileState} state State. + * @extends {module:ol/Tile~Tile} + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/TileState~TileState} state State. * @param {string} src Data source url. - * @param {ol.format.Feature} format Feature format. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - * @param {olx.TileOptions=} opt_options Tile options. + * @param {module:ol/format/Feature~Feature} format Feature format. + * @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function. + * @param {module:ol/Tile~Options=} opt_options Tile options. */ const VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt_options) { @@ -26,44 +26,44 @@ const VectorTile = function(tileCoord, state, src, format, tileLoadFunction, opt /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = null; /** * @private - * @type {ol.format.Feature} + * @type {module:ol/format/Feature~Feature} */ this.format_ = format; /** * @private - * @type {Array.} + * @type {Array.} */ this.features_ = null; /** * @private - * @type {ol.FeatureLoader} + * @type {module:ol/featureloader~FeatureLoader} */ this.loader_; /** * Data projection * @private - * @type {ol.proj.Projection} + * @type {module:ol/proj/Projection~Projection} */ this.projection_; /** * @private - * @type {Object.} + * @type {Object.} */ this.replayGroups_ = {}; /** * @private - * @type {ol.TileLoadFunctionType} + * @type {module:ol/Tile~LoadFunction} */ this.tileLoadFunction_ = tileLoadFunction; @@ -79,7 +79,7 @@ inherits(VectorTile, Tile); /** * @const - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ const DEFAULT_EXTENT = [0, 0, 4096, 4096]; @@ -98,7 +98,7 @@ VectorTile.prototype.disposeInternal = function() { /** * Gets the extent of the vector tile. - * @return {ol.Extent} The extent. + * @return {module:ol/extent~Extent} The extent. * @api */ VectorTile.prototype.getExtent = function() { @@ -108,7 +108,7 @@ VectorTile.prototype.getExtent = function() { /** * Get the feature format assigned for reading this tile's features. - * @return {ol.format.Feature} Feature format. + * @return {module:ol/format/Feature~Feature} Feature format. * @api */ VectorTile.prototype.getFormat = function() { @@ -118,8 +118,8 @@ VectorTile.prototype.getFormat = function() { /** * Get the features for this tile. Geometries will be in the projection returned - * by {@link ol.VectorTile#getProjection}. - * @return {Array.} Features. + * by {@link module:ol/VectorTile~VectorTile#getProjection}. + * @return {Array.} Features. * @api */ VectorTile.prototype.getFeatures = function() { @@ -137,8 +137,8 @@ VectorTile.prototype.getKey = function() { /** * Get the feature projection of features returned by - * {@link ol.VectorTile#getFeatures}. - * @return {ol.proj.Projection} Feature projection. + * {@link module:ol/VectorTile~VectorTile#getFeatures}. + * @return {module:ol/proj/Projection~Projection} Feature projection. * @api */ VectorTile.prototype.getProjection = function() { @@ -147,9 +147,9 @@ VectorTile.prototype.getProjection = function() { /** - * @param {ol.layer.Layer} layer Layer. + * @param {module:ol/layer/Layer~Layer} layer Layer. * @param {string} key Key. - * @return {ol.render.ReplayGroup} Replay group. + * @return {module:ol/render/ReplayGroup~ReplayGroup} Replay group. */ VectorTile.prototype.getReplayGroup = function(layer, key) { return this.replayGroups_[getUid(layer) + ',' + key]; @@ -170,9 +170,9 @@ VectorTile.prototype.load = function() { /** * Handler for successful tile load. - * @param {Array.} features The loaded features. - * @param {ol.proj.Projection} dataProjection Data projection. - * @param {ol.Extent} extent Extent. + * @param {Array.} features The loaded features. + * @param {module:ol/proj/Projection~Projection} dataProjection Data projection. + * @param {module:ol/extent~Extent} extent Extent. */ VectorTile.prototype.onLoad = function(features, dataProjection, extent) { this.setProjection(dataProjection); @@ -190,15 +190,15 @@ VectorTile.prototype.onError = function() { /** - * Function for use in an {@link ol.source.VectorTile}'s `tileLoadFunction`. - * Sets the extent of the vector tile. This is only required for tiles in - * projections with `tile-pixels` as units. The extent should be set to - * `[0, 0, tilePixelSize, tilePixelSize]`, where `tilePixelSize` is calculated - * by multiplying the tile size with the tile pixel ratio. For sources using - * {@link ol.format.MVT} as feature format, the - * {@link ol.format.MVT#getLastExtent} method will return the correct extent. - * The default is `[0, 0, 4096, 4096]`. - * @param {ol.Extent} extent The extent. + * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s + * `tileLoadFunction`. Sets the extent of the vector tile. This is only required + * for tiles in projections with `tile-pixels` as units. The extent should be + * set to `[0, 0, tilePixelSize, tilePixelSize]`, where `tilePixelSize` is + * calculated by multiplying the tile size with the tile pixel ratio. For + * sources using {@link module:ol/format/MVT~MVT} as feature format, the + * {@link module:ol/format/MVT~MVT#getLastExtent} method will return the correct + * extent. The default is `[0, 0, 4096, 4096]`. + * @param {module:ol/extent~Extent} extent The extent. * @api */ VectorTile.prototype.setExtent = function(extent) { @@ -207,9 +207,9 @@ VectorTile.prototype.setExtent = function(extent) { /** - * Function for use in an {@link ol.source.VectorTile}'s `tileLoadFunction`. + * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`. * Sets the features for the tile. - * @param {Array.} features Features. + * @param {Array.} features Features. * @api */ VectorTile.prototype.setFeatures = function(features) { @@ -219,10 +219,10 @@ VectorTile.prototype.setFeatures = function(features) { /** - * Function for use in an {@link ol.source.VectorTile}'s `tileLoadFunction`. + * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`. * Sets the projection of the features that were added with - * {@link ol.VectorTile#setFeatures}. - * @param {ol.proj.Projection} projection Feature projection. + * {@link module:ol/VectorTile~VectorTile#setFeatures}. + * @param {module:ol/proj/Projection~Projection} projection Feature projection. * @api */ VectorTile.prototype.setProjection = function(projection) { @@ -231,9 +231,9 @@ VectorTile.prototype.setProjection = function(projection) { /** - * @param {ol.layer.Layer} layer Layer. + * @param {module:ol/layer/Layer~Layer} layer Layer. * @param {string} key Key. - * @param {ol.render.ReplayGroup} replayGroup Replay group. + * @param {module:ol/render/ReplayGroup~ReplayGroup} replayGroup Replay group. */ VectorTile.prototype.setReplayGroup = function(layer, key, replayGroup) { this.replayGroups_[getUid(layer) + ',' + key] = replayGroup; @@ -242,7 +242,7 @@ VectorTile.prototype.setReplayGroup = function(layer, key, replayGroup) { /** * Set the feature loader for reading this tile's features. - * @param {ol.FeatureLoader} loader Feature loader. + * @param {module:ol/featureloader~FeatureLoader} loader Feature loader. * @api */ VectorTile.prototype.setLoader = function(loader) { diff --git a/src/ol/View.js b/src/ol/View.js index 685fdffaf8..face844c5b 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -24,6 +24,116 @@ import {createProjection, METERS_PER_UNIT} from './proj.js'; import Units from './proj/Units.js'; +/** + * An animation configuration + * + * @typedef {Object} Animation + * @property {module:ol/coordinate~Coordinate} [sourceCenter] + * @property {module:ol/coordinate~Coordinate} [targetCenter] + * @property {number} [sourceResolution] + * @property {number} [targetResolution] + * @property {number} [sourceRotation] + * @property {number} [sourceRotation] + * @property {module:ol/coordinate~Coordinate} [anchor] + * @property {number} start + * @property {number} duration + * @property {boolean} complete + * @property {function(number):number} easing + * @property {function(boolean)} callback + */ + + +/** + * @typedef {Object} Constraints + * @property {module:ol/centerconstraint~Type} center + * @property {module:ol/resolutionconstraint~Type} resolution + * @property {module:ol/rotationconstraint~Type} rotation + */ + + +/** + * @typedef {Object} FitOptions + * @property {module:ol/size~Size} [size] The size in pixels of the box to fit + * the extent into. Default is the current size of the first map in the DOM that + * uses this view, or `[100, 100]` if no such map is found. + * @property {!Array.} [padding=[0, 0, 0, 0]] Padding (in pixels) to be + * cleared inside the view. Values in the array are top, right, bottom and left + * padding. + * @property {boolean} [constrainResolution=true] Constrain the resolution. + * @property {boolean} [nearest=false] If `constrainResolution` is `true`, get + * the nearest extent instead of the closest that actually fits the view. + * @property {number} [minResolution=0] Minimum resolution that we zoom to. + * @property {number} [maxZoom] Maximum zoom level that we zoom to. If + * `minResolution` is given, this property is ignored. + * @property {number} [duration] The duration of the animation in milliseconds. + * By default, there is no animation to the target extent. + * @property {function(number):number} [easing] The easing function used during + * the animation (defaults to {@link module: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. + * @property {function(boolean)} [callback] Function called when the view is in + * its final position. The callback will be called with `true` if the animation + * series completed on its own or `false` if it was cancelled. + */ + + +/** + * @typedef {Object} ViewOptions + * @property {module:ol/coordinate~Coordinate~Coordinate} [center] The initial center for + * the view. The coordinate system for the center is specified with the + * `projection` option. Layer sources will not be fetched if this is not set, + * but the center can be set later with {@link #setCenter}. + * @property {boolean|number} [constrainRotation=true] Rotation constraint. + * `false` means no constraint. `true` means no constraint, but snap to zero + * near zero. A number constrains the rotation to that number of values. For + * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees. + * @property {boolean} [enableRotation=true] Enable rotation. + * If `false`, a rotation constraint that always sets the rotation to zero is + * used. The `constrainRotation` option has no effect if `enableRotation` is + * `false`. + * @property {module:ol/extent~Extent} [extent] The extent that constrains the + * center, in other words, center cannot be set outside this extent. + * @property {number} [maxResolution] The maximum resolution used to determine + * the resolution constraint. It is used together with `minResolution` (or + * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way + * that the projection's validity extent fits in a 256x256 px tile. If the + * projection is Spherical Mercator (the default) then `maxResolution` defaults + * to `40075016.68557849 / 256 = 156543.03392804097`. + * @property {number} [minResolution] The minimum resolution used to determine + * the resolution constraint. It is used together with `maxResolution` (or + * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29 + * zoom levels (with a factor of 2). If the projection is Spherical Mercator + * (the default) then `minResolution` defaults to + * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`. + * @property {number} [maxZoom=28] The maximum zoom level used to determine the + * resolution constraint. It is used together with `minZoom` (or + * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also + * provided, it is given precedence over `maxZoom`. + * @property {number} [minZoom=0] The minimum zoom level used to determine the + * resolution constraint. It is used together with `maxZoom` (or + * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also + * provided, it is given precedence over `minZoom`. + * @property {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] The + * projection. The default is Spherical Mercator. + * @property {number} [resolution] The initial resolution for the view. The + * units are `projection` units per pixel (e.g. meters per pixel). An + * alternative to setting this is to set `zoom`. Layer sources will not be + * fetched if neither this nor `zoom` are defined, but they can be set later + * with {@link #setZoom} or {@link #setResolution}. + * @property {Array.} [resolutions] Resolutions to determine the + * resolution constraint. If set the `maxResolution`, `minResolution`, + * `minZoom`, `maxZoom`, and `zoomFactor` options are ignored. + * @property {number} [rotation=0] The initial rotation for the view in radians + * (positive rotation clockwise, 0 means North). + * @property {number} [zoom] Only used if `resolution` is not defined. Zoom + * level used to calculate the initial resolution for the view. The initial + * resolution is determined using the {@link #constrainResolution} method. + * @property {number} [zoomFactor=2] The zoom factor used to determine the + * resolution constraint. + */ + + /** * Default min zoom level for the map view. * @type {number} @@ -33,18 +143,18 @@ const DEFAULT_MIN_ZOOM = 0; /** * @classdesc - * An ol.View object represents a simple 2D view of the map. + * A View object represents a simple 2D view of the map. * * This is the object to act upon to change the center, resolution, * and rotation of the map. * * ### The view states * - * An `ol.View` is determined by three states: `center`, `resolution`, + * An View is determined by three states: `center`, `resolution`, * and `rotation`. Each state has a corresponding getter and setter, e.g. * `getCenter` and `setCenter` for the `center` state. * - * An `ol.View` has a `projection`. The projection determines the + * An View has a `projection`. The projection determines the * coordinate system of the center, and its units determine the units of the * resolution (projection units per pixel). The default projection is * Spherical Mercator (EPSG:3857). @@ -56,7 +166,7 @@ const DEFAULT_MIN_ZOOM = 0; * that is passed to a setter will effectively be the value set in the view, * and returned by the corresponding getter. * - * But an `ol.View` object also has a *resolution constraint*, a + * But a View object also has a *resolution constraint*, a * *rotation constraint* and a *center constraint*. * * As said above, no constraints are applied when the setters are used to set @@ -84,8 +194,8 @@ const DEFAULT_MIN_ZOOM = 0; * default the center is not constrained at all. * * @constructor - * @extends {ol.Object} - * @param {olx.ViewOptions=} opt_options View options. + * @extends {module:ol/Object~Object} + * @param {module:ol/View~ViewOptions=} opt_options View options. * @api */ const View = function(opt_options) { @@ -101,7 +211,7 @@ const View = function(opt_options) { /** * @private - * @type {Array.>} + * @type {Array.>} */ this.animations_ = []; @@ -116,7 +226,7 @@ const View = function(opt_options) { /** * @private * @const - * @type {ol.proj.Projection} + * @type {module:ol/proj/Projection~Projection} */ this.projection_ = createProjection(options.projection, 'EPSG:3857'); @@ -128,7 +238,7 @@ inherits(View, BaseObject); /** * Set up the view with the given options. - * @param {olx.ViewOptions} options View options. + * @param {module:ol/View~ViewOptions} options View options. */ View.prototype.applyOptions_ = function(options) { @@ -178,7 +288,7 @@ View.prototype.applyOptions_ = function(options) { /** * @private - * @type {ol.Constraints} + * @type {module:ol/View~Constraints} */ this.constraints_ = { center: centerConstraint, @@ -203,7 +313,7 @@ View.prototype.applyOptions_ = function(options) { /** * @private - * @type {olx.ViewOptions} + * @type {module:ol/View~ViewOptions} */ this.options_ = options; @@ -214,8 +324,8 @@ View.prototype.applyOptions_ = function(options) { * current resolution (or zoom), center, and rotation are applied to any stored * options. The provided options can be uesd to apply new min/max zoom or * resolution limits. - * @param {olx.ViewOptions} newOptions New options to be applied. - * @return {olx.ViewOptions} New options updated with the current view state. + * @param {module:ol/View~ViewOptions} newOptions New options to be applied. + * @return {module:ol/View~ViewOptions} New options updated with the current view state. */ View.prototype.getUpdatedOptions_ = function(newOptions) { const options = assign({}, this.options_); @@ -246,7 +356,7 @@ View.prototype.getUpdatedOptions_ = function(newOptions) { * * By default, the animation lasts one second and uses in-and-out easing. You * can customize this behavior by including `duration` (in milliseconds) and - * `easing` options (see {@link ol.easing}). + * `easing` options (see {@link module:ol/easing}). * * To chain together multiple animations, call the method with multiple * animation objects. For example, to first zoom and then pan: @@ -304,7 +414,7 @@ View.prototype.animate = function(var_args) { for (let i = 0; i < animationCount; ++i) { const options = /** @type {olx.AnimationOptions} */ (arguments[i]); - const animation = /** @type {ol.ViewAnimation} */ ({ + const animation = /** @type {module:ol/View~Animation} */ ({ start: start, complete: false, anchor: options.anchor, @@ -472,8 +582,8 @@ View.prototype.updateAnimations_ = function() { /** * @param {number} rotation Target rotation. - * @param {ol.Coordinate} anchor Rotation anchor. - * @return {ol.Coordinate|undefined} Center for rotation and anchor. + * @param {module:ol/coordinate~Coordinate} anchor Rotation anchor. + * @return {module:ol/coordinate~Coordinate|undefined} Center for rotation and anchor. */ View.prototype.calculateCenterRotate = function(rotation, anchor) { let center; @@ -489,8 +599,8 @@ View.prototype.calculateCenterRotate = function(rotation, anchor) { /** * @param {number} resolution Target resolution. - * @param {ol.Coordinate} anchor Zoom anchor. - * @return {ol.Coordinate|undefined} Center for resolution and anchor. + * @param {module:ol/coordinate~Coordinate} anchor Zoom anchor. + * @return {module:ol/coordinate~Coordinate|undefined} Center for resolution and anchor. */ View.prototype.calculateCenterZoom = function(resolution, anchor) { let center; @@ -509,7 +619,7 @@ View.prototype.calculateCenterZoom = function(resolution, anchor) { /** * @private - * @return {ol.Size} Viewport size or `[100, 100]` when no viewport is found. + * @return {module:ol/size~Size} Viewport size or `[100, 100]` when no viewport is found. */ View.prototype.getSizeFromViewport_ = function() { const size = [100, 100]; @@ -526,8 +636,8 @@ View.prototype.getSizeFromViewport_ = function() { /** * Get the constrained center of this view. - * @param {ol.Coordinate|undefined} center Center. - * @return {ol.Coordinate|undefined} Constrained center. + * @param {module:ol/coordinate~Coordinate|undefined} center Center. + * @return {module:ol/coordinate~Coordinate|undefined} Constrained center. * @api */ View.prototype.constrainCenter = function(center) { @@ -565,17 +675,17 @@ View.prototype.constrainRotation = function(rotation, opt_delta) { /** * Get the view center. - * @return {ol.Coordinate|undefined} The center of the view. + * @return {module:ol/coordinate~Coordinate|undefined} The center of the view. * @observable * @api */ View.prototype.getCenter = function() { - return /** @type {ol.Coordinate|undefined} */ (this.get(ViewProperty.CENTER)); + return /** @type {module:ol/coordinate~Coordinate|undefined} */ (this.get(ViewProperty.CENTER)); }; /** - * @return {ol.Constraints} Constraints. + * @return {module:ol/View~Constraints} Constraints. */ View.prototype.getConstraints = function() { return this.constraints_; @@ -602,14 +712,14 @@ View.prototype.getHints = function(opt_hints) { * The size is the pixel dimensions of the box into which the calculated extent * should fit. In most cases you want to get the extent of the entire map, * that is `map.getSize()`. - * @param {ol.Size=} opt_size Box pixel size. If not provided, the size of the + * @param {module:ol/size~Size=} opt_size Box pixel size. If not provided, the size of the * first map that uses this view will be used. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. * @api */ View.prototype.calculateExtent = function(opt_size) { const size = opt_size || this.getSizeFromViewport_(); - const center = /** @type {!ol.Coordinate} */ (this.getCenter()); + const center = /** @type {!module:ol/coordinate~Coordinate} */ (this.getCenter()); assert(center, 1); // The view center is not defined const resolution = /** @type {!number} */ (this.getResolution()); assert(resolution !== undefined, 2); // The view resolution is not defined @@ -682,7 +792,7 @@ View.prototype.setMinZoom = function(zoom) { /** * Get the view projection. - * @return {ol.proj.Projection} The projection of the view. + * @return {module:ol/proj/Projection~Projection} The projection of the view. * @api */ View.prototype.getProjection = function() { @@ -703,7 +813,7 @@ View.prototype.getResolution = function() { /** * Get the resolutions for the view. This returns the array of resolutions - * passed to the constructor of the {ol.View}, or undefined if none were given. + * passed to the constructor of the View, or undefined if none were given. * @return {Array.|undefined} The resolutions of the view. * @api */ @@ -714,8 +824,8 @@ View.prototype.getResolutions = function() { /** * Get the resolution for a provided extent (in map units) and size (in pixels). - * @param {ol.Extent} extent Extent. - * @param {ol.Size=} opt_size Box pixel size. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/size~Size=} opt_size Box pixel size. * @return {number} The resolution at which the provided extent will render at * the given size. * @api @@ -790,7 +900,7 @@ View.prototype.getValueForResolutionFunction = function(opt_power) { * @return {olx.ViewState} View state. */ View.prototype.getState = function() { - const center = /** @type {ol.Coordinate} */ (this.getCenter()); + const center = /** @type {module:ol/coordinate~Coordinate} */ (this.getCenter()); const projection = this.getProjection(); const resolution = /** @type {number} */ (this.getResolution()); const rotation = this.getRotation(); @@ -864,7 +974,7 @@ View.prototype.getResolutionForZoom = function(zoom) { * The size is pixel dimensions of the box to fit the extent into. * In most cases you will want to use the map size, that is `map.getSize()`. * Takes care of the map angle. - * @param {ol.geom.SimpleGeometry|ol.Extent} geometryOrExtent The geometry or + * @param {module:ol/geom/SimpleGeometry~SimpleGeometry|module:ol/extent~Extent} geometryOrExtent The geometry or * extent to fit the view to. * @param {olx.view.FitOptions=} opt_options Options. * @api @@ -875,7 +985,7 @@ View.prototype.fit = function(geometryOrExtent, opt_options) { if (!size) { size = this.getSizeFromViewport_(); } - /** @type {ol.geom.SimpleGeometry} */ + /** @type {module:ol/geom/SimpleGeometry~SimpleGeometry} */ let geometry; if (!(geometryOrExtent instanceof SimpleGeometry)) { assert(Array.isArray(geometryOrExtent), @@ -967,9 +1077,9 @@ View.prototype.fit = function(geometryOrExtent, opt_options) { /** * Center on coordinate and view position. - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Size} size Box pixel size. - * @param {ol.Pixel} position Position on the view to center on. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. + * @param {module:ol/size~Size} size Box pixel size. + * @param {module:ol~Pixel} position Position on the view to center on. * @api */ View.prototype.centerOn = function(coordinate, size, position) { @@ -1003,7 +1113,7 @@ View.prototype.isDef = function() { /** * Rotate the view around a given coordinate. * @param {number} rotation New rotation value for the view. - * @param {ol.Coordinate=} opt_anchor The rotation center. + * @param {module:ol/coordinate~Coordinate=} opt_anchor The rotation center. * @api */ View.prototype.rotate = function(rotation, opt_anchor) { @@ -1017,7 +1127,7 @@ View.prototype.rotate = function(rotation, opt_anchor) { /** * Set the center of the current view. - * @param {ol.Coordinate|undefined} center The center of the view. + * @param {module:ol/coordinate~Coordinate|undefined} center The center of the view. * @observable * @api */ @@ -1030,7 +1140,7 @@ View.prototype.setCenter = function(center) { /** - * @param {ol.ViewHint} hint Hint. + * @param {module:ol/ViewHint~ViewHint} hint Hint. * @param {number} delta Delta. * @return {number} New value. */ @@ -1080,8 +1190,8 @@ View.prototype.setZoom = function(zoom) { /** - * @param {olx.ViewOptions} options View options. - * @return {ol.CenterConstraintType} The constraint. + * @param {module:ol/View~ViewOptions} options View options. + * @return {module:ol/centerconstraint~Type} The constraint. */ export function createCenterConstraint(options) { if (options.extent !== undefined) { @@ -1093,8 +1203,8 @@ export function createCenterConstraint(options) { /** - * @param {olx.ViewOptions} options View options. - * @return {{constraint: ol.ResolutionConstraintType, maxResolution: number, + * @param {module:ol/View~ViewOptions} options View options. + * @return {{constraint: module:ol/resolutionconstraint~Type, maxResolution: number, * minResolution: number, zoomFactor: number}} The constraint. */ export function createResolutionConstraint(options) { @@ -1175,8 +1285,8 @@ export function createResolutionConstraint(options) { /** - * @param {olx.ViewOptions} options View options. - * @return {ol.RotationConstraintType} Rotation constraint. + * @param {module:ol/View~ViewOptions} options View options. + * @return {module:ol/rotationconstraint~Type} Rotation constraint. */ export function createRotationConstraint(options) { const enableRotation = options.enableRotation !== undefined ? @@ -1200,7 +1310,7 @@ export function createRotationConstraint(options) { /** * Determine if an animation involves no view change. - * @param {ol.ViewAnimation} animation The animation. + * @param {module:ol/View~Animation} animation The animation. * @return {boolean} The animation involves no view change. */ export function isNoopAnimation(animation) { diff --git a/src/ol/centerconstraint.js b/src/ol/centerconstraint.js index 3a800da38e..03a51e530d 100644 --- a/src/ol/centerconstraint.js +++ b/src/ol/centerconstraint.js @@ -5,14 +5,19 @@ import {clamp} from './math.js'; /** - * @param {ol.Extent} extent Extent. - * @return {ol.CenterConstraintType} The constraint. + * @typedef {function((module:ol/coordinate~Coordinate|undefined)): (module:ol/coordinate~Coordinate|undefined)} Type + */ + + +/** + * @param {module:ol/extent~Extent} extent Extent. + * @return {module:ol/centerconstraint~Type} The constraint. */ export function createExtent(extent) { return ( /** - * @param {ol.Coordinate|undefined} center Center. - * @return {ol.Coordinate|undefined} Center. + * @param {module:ol/coordinate~Coordinate=} center Center. + * @return {module:ol/coordinate~Coordinate|undefined} Center. */ function(center) { if (center) { @@ -29,8 +34,8 @@ export function createExtent(extent) { /** - * @param {ol.Coordinate|undefined} center Center. - * @return {ol.Coordinate|undefined} Center. + * @param {module:ol/coordinate~Coordinate=} center Center. + * @return {module:ol/coordinate~Coordinate|undefined} Center. */ export function none(center) { return center; diff --git a/src/ol/color.js b/src/ol/color.js index 900eba70dd..e96b5a99a4 100644 --- a/src/ol/color.js +++ b/src/ol/color.js @@ -5,6 +5,16 @@ import {assert} from './asserts.js'; import {clamp} from './math.js'; +/** + * A color represented as a short array [red, green, blue, alpha]. + * red, green, and blue should be integers in the range 0..255 inclusive. + * alpha should be a float in the range 0..1 inclusive. If no alpha value is + * given then `1` will be used. + * @typedef {Array.} Color + * @api + */ + + /** * This RegExp matches # followed by 3, 4, 6, or 8 hex digits. * @const @@ -25,7 +35,7 @@ const NAMED_COLOR_RE_ = /^([a-z]*)$/i; /** * Return the color as an rgba string. - * @param {ol.Color|string} color Color. + * @param {module:ol/color~Color|string} color Color. * @return {string} Rgba string. * @api */ @@ -58,7 +68,7 @@ function fromNamed(color) { /** * @param {string} s String. - * @return {ol.Color} Color. + * @return {module:ol/color~Color} Color. */ export const fromString = ( function() { @@ -74,7 +84,7 @@ export const fromString = ( const MAX_CACHE_SIZE = 1024; /** - * @type {Object.} + * @type {Object.} */ const cache = {}; @@ -86,7 +96,7 @@ export const fromString = ( return ( /** * @param {string} s String. - * @return {ol.Color} Color. + * @return {module:ol/color~Color} Color. */ function(s) { let color; @@ -115,8 +125,8 @@ export const fromString = ( /** * Return the color as an array. This function maintains a cache of calculated * arrays which means the result should not be modified. - * @param {ol.Color|string} color Color. - * @return {ol.Color} Color. + * @param {module:ol/color~Color|string} color Color. + * @return {module:ol/color~Color} Color. * @api */ export function asArray(color) { @@ -130,7 +140,7 @@ export function asArray(color) { /** * @param {string} s String. * @private - * @return {ol.Color} Color. + * @return {module:ol/color~Color} Color. */ function fromStringInternal_(s) { let r, g, b, a, color; @@ -175,14 +185,14 @@ function fromStringInternal_(s) { } else { assert(false, 14); // Invalid color } - return /** @type {ol.Color} */ (color); + return /** @type {module:ol/color~Color} */ (color); } /** * TODO this function is only used in the test, we probably shouldn't export it - * @param {ol.Color} color Color. - * @return {ol.Color} Clamped color. + * @param {module:ol/color~Color} color Color. + * @return {module:ol/color~Color} Clamped color. */ export function normalize(color) { color[0] = clamp((color[0] + 0.5) | 0, 0, 255); @@ -194,7 +204,7 @@ export function normalize(color) { /** - * @param {ol.Color} color Color. + * @param {module:ol/color~Color} color Color. * @return {string} String. */ export function toString(color) { diff --git a/src/ol/color.jsdoc b/src/ol/color.jsdoc deleted file mode 100644 index 569033933c..0000000000 --- a/src/ol/color.jsdoc +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Colors can be defined as a {@link ol.Color} array, or as strings in - * `rgb(r,g,b)` or `rgba(r,g,b,a)` format, or in hex `#rrggbb` or `#rgb` format. - * Color names, like 'red', 'blue' or 'green', may also be used with the - * Canvas renderer. - * - * @namespace ol.color - */ diff --git a/src/ol/colorlike.js b/src/ol/colorlike.js index ede1fd0b17..80c23e67fa 100644 --- a/src/ol/colorlike.js +++ b/src/ol/colorlike.js @@ -5,22 +5,34 @@ import {toString} from './color.js'; /** - * @param {ol.Color|ol.ColorLike} color Color. - * @return {ol.ColorLike} The color as an ol.ColorLike + * A type accepted by CanvasRenderingContext2D.fillStyle + * or CanvasRenderingContext2D.strokeStyle. + * Represents a color, pattern, or gradient. The origin for patterns and + * gradients as fill style is the top-left corner of the extent of the geometry + * being filled. + * + * @typedef {string|CanvasPattern|CanvasGradient} ColorLike + * @api + */ + + +/** + * @param {module:ol/color~Color|module:ol/colorlike~ColorLike} color Color. + * @return {module:ol/color~ColorLike} The color as an {@link ol/color~ColorLike}. * @api */ export function asColorLike(color) { if (isColorLike(color)) { return /** @type {string|CanvasPattern|CanvasGradient} */ (color); } else { - return toString(/** @type {ol.Color} */ (color)); + return toString(/** @type {module:ol/color~Color} */ (color)); } } /** - * @param {?} color The value that is potentially an ol.ColorLike - * @return {boolean} Whether the color is an ol.ColorLike + * @param {?} color The value that is potentially an {@link ol/color~ColorLike}. + * @return {boolean} The color is an {@link ol/color~ColorLike}. */ export function isColorLike(color) { return ( diff --git a/src/ol/colorlike.jsdoc b/src/ol/colorlike.jsdoc deleted file mode 100644 index c6e0c31397..0000000000 --- a/src/ol/colorlike.jsdoc +++ /dev/null @@ -1,5 +0,0 @@ -/** - * An {@link ol.ColorLike} can be a color, gradient or pattern accepted by - * [CanvasRenderingContext2D.fillStyle](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle). - * @namespace ol.colorlike - */ diff --git a/src/ol/control.js b/src/ol/control.js index cc7d3eadf0..9db378f6e5 100644 --- a/src/ol/control.js +++ b/src/ol/control.js @@ -7,16 +7,35 @@ import Rotate from './control/Rotate.js'; import Zoom from './control/Zoom.js'; +/** + * @typedef {Object} DefaultsOptions + * @property {boolean|undefined} [attribution=true] Include + * {@link module:ol/control/Attribution~Attribution}. + * @property {module:ol/control/Attribution~AttributionOptions} [attributionOptions] + * Options for {@link module:ol/control/Attribution~Attribution}. + * @property {boolean} [rotate=true] Include + * {@link module:ol/control/Rotate~Rotate}. + * @property {module:ol/control/Rotate~RotateOptions} [rotateOptions] Options + * for {@link module:ol/control/Rotate~Rotate}. + * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}. + * @property {module:ol/control/Zoom~ZoomOptions} [zoomOptions] Options for + * {@link module:ol/control/Zoom~Zoom}. + * @api + */ + + /** * Set of controls included in maps by default. Unless configured otherwise, * this returns a collection containing an instance of each of the following * controls: - * * {@link ol.control.Zoom} - * * {@link ol.control.Rotate} - * * {@link ol.control.Attribution} + * * {@link module:ol/control/Zoom~Zoom} + * * {@link module:ol/control/Rotate~Rotate} + * * {@link module:ol/control/Attribution~Attribution} * - * @param {olx.control.DefaultsOptions=} opt_options Defaults options. - * @return {ol.Collection.} Controls. + * @param {module:ol/control~DefaultsOptions~DefaultsOptions=} opt_options + * Defaults options. + * @return {module:ol/Collection~Collection.} + * Controls. * @api */ export function defaults(opt_options) { diff --git a/src/ol/control/Control.js b/src/ol/control/Control.js index adfaa865ec..92e35f208e 100644 --- a/src/ol/control/Control.js +++ b/src/ol/control/Control.js @@ -61,7 +61,7 @@ const Control = function(options) { /** * @protected - * @type {!Array.} + * @type {!Array.} */ this.listenerKeys = []; diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index 65e62beca1..0909395070 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -78,13 +78,13 @@ const MousePosition = function(opt_options) { /** * @private - * @type {?ol.TransformFunction} + * @type {?module:ol/proj~TransformFunction} */ this.transform_ = null; /** * @private - * @type {ol.Pixel} + * @type {module:ol~Pixel} */ this.lastMouseMovePixel_ = null; @@ -124,13 +124,13 @@ MousePosition.prototype.handleProjectionChanged_ = function() { /** * Return the coordinate format type used to render the current position or * undefined. - * @return {ol.CoordinateFormatType|undefined} The format to render the current + * @return {module:ol/coordinate~CoordinateFormat|undefined} The format to render the current * position in. * @observable * @api */ MousePosition.prototype.getCoordinateFormat = function() { - return /** @type {ol.CoordinateFormatType|undefined} */ (this.get(COORDINATE_FORMAT)); + return /** @type {module:ol/coordinate~CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT)); }; @@ -187,7 +187,7 @@ MousePosition.prototype.setMap = function(map) { /** * Set the coordinate format type used to render the current position. - * @param {ol.CoordinateFormatType} format The format to render the current + * @param {module:ol/coordinate~CoordinateFormat} format The format to render the current * position in. * @observable * @api @@ -199,7 +199,7 @@ MousePosition.prototype.setCoordinateFormat = function(format) { /** * Set the projection that is used to report the mouse position. - * @param {ol.ProjectionLike} projection The projection to report mouse + * @param {module:ol/proj~ProjectionLike} projection The projection to report mouse * position in. * @observable * @api @@ -210,7 +210,7 @@ MousePosition.prototype.setProjection = function(projection) { /** - * @param {?ol.Pixel} pixel Pixel. + * @param {?module:ol~Pixel} pixel Pixel. * @private */ MousePosition.prototype.updateHTML_ = function(pixel) { diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index d0ac6ebaaa..80f870fc0e 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -329,12 +329,12 @@ OverviewMap.prototype.validateExtent_ = function() { return; } - const mapSize = /** @type {ol.Size} */ (map.getSize()); + const mapSize = /** @type {module:ol/size~Size} */ (map.getSize()); const view = map.getView(); const extent = view.calculateExtent(mapSize); - const ovmapSize = /** @type {ol.Size} */ (ovmap.getSize()); + const ovmapSize = /** @type {module:ol/size~Size} */ (ovmap.getSize()); const ovview = ovmap.getView(); const ovextent = ovview.calculateExtent(ovmapSize); @@ -374,7 +374,7 @@ OverviewMap.prototype.resetExtent_ = function() { const map = this.getMap(); const ovmap = this.ovmap_; - const mapSize = /** @type {ol.Size} */ (map.getSize()); + const mapSize = /** @type {module:ol/size~Size} */ (map.getSize()); const view = map.getView(); const extent = view.calculateExtent(mapSize); @@ -421,7 +421,7 @@ OverviewMap.prototype.updateBox_ = function() { return; } - const mapSize = /** @type {ol.Size} */ (map.getSize()); + const mapSize = /** @type {module:ol/size~Size} */ (map.getSize()); const view = map.getView(); @@ -450,8 +450,8 @@ OverviewMap.prototype.updateBox_ = function() { /** * @param {number} rotation Target rotation. - * @param {ol.Coordinate} coordinate Coordinate. - * @return {ol.Coordinate|undefined} Coordinate for rotation and center anchor. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. + * @return {module:ol/coordinate~Coordinate|undefined} Coordinate for rotation and center anchor. * @private */ OverviewMap.prototype.calculateCoordinateRotate_ = function( diff --git a/src/ol/control/ZoomSlider.js b/src/ol/control/ZoomSlider.js index b5b2ff460e..2685b7abf1 100644 --- a/src/ol/control/ZoomSlider.js +++ b/src/ol/control/ZoomSlider.js @@ -92,7 +92,7 @@ const ZoomSlider = function(opt_options) { /** * The calculated thumb size (border box plus margins). Set when initSlider_ * is called. - * @type {ol.Size} + * @type {module:ol/size~Size} * @private */ this.thumbSize_ = null; diff --git a/src/ol/control/ZoomToExtent.js b/src/ol/control/ZoomToExtent.js index 23eee1703a..022021c202 100644 --- a/src/ol/control/ZoomToExtent.js +++ b/src/ol/control/ZoomToExtent.js @@ -21,7 +21,7 @@ const ZoomToExtent = function(opt_options) { const options = opt_options ? opt_options : {}; /** - * @type {ol.Extent} + * @type {module:ol/extent~Extent} * @protected */ this.extent = options.extent ? options.extent : null; diff --git a/src/ol/coordinate.js b/src/ol/coordinate.js index d4bde5cfcb..7d55aed45e 100644 --- a/src/ol/coordinate.js +++ b/src/ol/coordinate.js @@ -5,19 +5,38 @@ import {modulo} from './math.js'; import {padNumber} from './string.js'; +/** + * An array of numbers representing an xy coordinate. Example: `[16, 48]`. + * @typedef {Array.} Coordinate + * @api + */ + + +/** + * A function that takes a {@link module:ol/coordinate~Coordinate} and + * transforms it into a `{string}`. + * + * @typedef {function((module:ol/coordinate~CoordinateFormat|undefined)): string} CoordinateFormat + * @api + */ + + /** * Add `delta` to `coordinate`. `coordinate` is modified in place and returned * by the function. * * Example: * + * import {add} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * ol.coordinate.add(coord, [-2, 4]); + * add(coord, [-2, 4]); * // coord is now [5.85, 51.983333] * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Coordinate} delta Delta. - * @return {ol.Coordinate} The input coordinate adjusted by the given delta. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} delta Delta. + * @return {module:ol/coordinate~Coordinate} The input coordinate adjusted by + * the given delta. * @api */ export function add(coordinate, delta) { @@ -30,9 +49,9 @@ export function add(coordinate, delta) { /** * Calculates the point closest to the passed coordinate on the passed circle. * - * @param {ol.Coordinate} coordinate The coordinate. - * @param {ol.geom.Circle} circle The circle. - * @return {ol.Coordinate} Closest point on the circumference + * @param {module:ol/coordinate~Coordinate} coordinate The coordinate. + * @param {module:ol/geom/Circle~Circle} circle The circle. + * @return {module:ol/coordinate~Coordinate} Closest point on the circumference. */ export function closestOnCircle(coordinate, circle) { const r = circle.getRadius(); @@ -62,10 +81,11 @@ export function closestOnCircle(coordinate, circle) { * the foot is on the segment, or the closest segment coordinate when the foot * is outside the segment. * - * @param {ol.Coordinate} coordinate The coordinate. - * @param {Array.} segment The two coordinates of the segment. - * @return {ol.Coordinate} The foot of the perpendicular of the coordinate to - * the segment. + * @param {module:ol/coordinate~Coordinate} coordinate The coordinate. + * @param {Array.} segment The two coordinates + * of the segment. + * @return {module:ol/coordinate~Coordinate} The foot of the perpendicular of + * the coordinate to the segment. */ export function closestOnSegment(coordinate, segment) { const x0 = coordinate[0]; @@ -96,32 +116,37 @@ export function closestOnSegment(coordinate, segment) { /** - * Returns a {@link ol.CoordinateFormatType} function that can be used to format - * a {ol.Coordinate} to a string. + * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be + * used to format + * a {module:ol/coordinate~Coordinate} to a string. * * Example without specifying the fractional digits: * + * import {createStringXY} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * var stringifyFunc = ol.coordinate.createStringXY(); + * var stringifyFunc = createStringXY(); * var out = stringifyFunc(coord); * // out is now '8, 48' * * Example with explicitly specifying 2 fractional digits: * + * import {createStringXY} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * var stringifyFunc = ol.coordinate.createStringXY(2); + * var stringifyFunc = createStringXY(2); * var out = stringifyFunc(coord); * // out is now '7.85, 47.98' * * @param {number=} opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. - * @return {ol.CoordinateFormatType} Coordinate format. + * @return {module:ol/coordinate~CoordinateFormat} Coordinate format. * @api */ export function createStringXY(opt_fractionDigits) { return ( /** - * @param {ol.Coordinate|undefined} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @return {string} String XY. */ function(coordinate) { @@ -166,25 +191,29 @@ export function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) { /** - * Transforms the given {@link ol.Coordinate} to a string using the given string - * template. The strings `{x}` and `{y}` in the template will be replaced with - * the first and second coordinate values respectively. + * Transforms the given {@link module:ol/coordinate~Coordinate} to a string + * using the given string template. The strings `{x}` and `{y}` in the template + * will be replaced with the first and second coordinate values respectively. * * Example without specifying the fractional digits: * + * import {format} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; * var template = 'Coordinate is ({x}|{y}).'; - * var out = ol.coordinate.format(coord, template); + * var out = format(coord, template); * // out is now 'Coordinate is (8|48).' * * Example explicitly specifying the fractional digits: * + * import {format} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; * var template = 'Coordinate is ({x}|{y}).'; - * var out = ol.coordinate.format(coord, template, 2); + * var out = format(coord, template, 2); * // out is now 'Coordinate is (7.85|47.98).' * - * @param {ol.Coordinate|undefined} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {string} template A template string with `{x}` and `{y}` placeholders * that will be replaced by first and second coordinate values. * @param {number=} opt_fractionDigits The number of digits to include @@ -204,8 +233,8 @@ export function format(coordinate, template, opt_fractionDigits) { /** - * @param {ol.Coordinate} coordinate1 First coordinate. - * @param {ol.Coordinate} coordinate2 Second coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate1 First coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate2 Second coordinate. * @return {boolean} The two coordinates are equal. */ export function equals(coordinate1, coordinate2) { @@ -226,14 +255,16 @@ export function equals(coordinate1, coordinate2) { * * Example: * + * import {rotate} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; * var rotateRadians = Math.PI / 2; // 90 degrees - * ol.coordinate.rotate(coord, rotateRadians); + * rotate(coord, rotateRadians); * // coord is now [-47.983333, 7.85] * - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} angle Angle in radian. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. * @api */ export function rotate(coordinate, angle) { @@ -253,14 +284,16 @@ export function rotate(coordinate, angle) { * * Example: * + * import {scale as scaleCoordinate} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; * var scale = 1.2; - * ol.coordinate.scale(coord, scale); + * scaleCoordinate(coord, scale); * // coord is now [9.42, 57.5799996] * - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} scale Scale factor. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. */ export function scale(coordinate, scale) { coordinate[0] *= scale; @@ -270,8 +303,8 @@ export function scale(coordinate, scale) { /** - * @param {ol.Coordinate} coord1 First coordinate. - * @param {ol.Coordinate} coord2 Second coordinate. + * @param {module:ol/coordinate~Coordinate} coord1 First coordinate. + * @param {module:ol/coordinate~Coordinate} coord2 Second coordinate. * @return {number} Squared distance between coord1 and coord2. */ export function squaredDistance(coord1, coord2) { @@ -282,8 +315,8 @@ export function squaredDistance(coord1, coord2) { /** - * @param {ol.Coordinate} coord1 First coordinate. - * @param {ol.Coordinate} coord2 Second coordinate. + * @param {module:ol/coordinate~Coordinate} coord1 First coordinate. + * @param {module:ol/coordinate~Coordinate} coord2 Second coordinate. * @return {number} Distance between coord1 and coord2. */ export function distance(coord1, coord2) { @@ -294,8 +327,9 @@ export function distance(coord1, coord2) { /** * Calculate the squared distance from a coordinate to a line segment. * - * @param {ol.Coordinate} coordinate Coordinate of the point. - * @param {Array.} segment Line segment (2 coordinates). + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate of the point. + * @param {Array.} segment Line segment (2 + * coordinates). * @return {number} Squared distance from the point to the line segment. */ export function squaredDistanceToSegment(coordinate, segment) { @@ -310,17 +344,21 @@ export function squaredDistanceToSegment(coordinate, segment) { * * Example without specifying fractional digits: * + * import {toStringHDMS} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringHDMS(coord); + * var out = toStringHDMS(coord); * // out is now '47° 58′ 60″ N 7° 50′ 60″ E' * * Example explicitly specifying 1 fractional digit: * + * import {toStringHDMS} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringHDMS(coord, 1); + * var out = toStringHDMS(coord, 1); * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E' * - * @param {ol.Coordinate|undefined} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number=} opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. * @return {string} Hemisphere, degrees, minutes and seconds. @@ -341,17 +379,21 @@ export function toStringHDMS(coordinate, opt_fractionDigits) { * * Example without specifying fractional digits: * + * import {toStringXY} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringXY(coord); + * var out = toStringXY(coord); * // out is now '8, 48' * * Example explicitly specifying 1 fractional digit: * + * import {toStringXY} from 'ol/coordinate'; + * * var coord = [7.85, 47.983333]; - * var out = ol.coordinate.toStringXY(coord, 1); + * var out = toStringXY(coord, 1); * // out is now '7.8, 48.0' * - * @param {ol.Coordinate|undefined} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number=} opt_fractionDigits The number of digits to include * after the decimal point. Default is `0`. * @return {string} XY. diff --git a/src/ol/coordinate.jsdoc b/src/ol/coordinate.jsdoc deleted file mode 100644 index 282f35ac87..0000000000 --- a/src/ol/coordinate.jsdoc +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @namespace ol.coordinate - */ diff --git a/src/ol/easing.js b/src/ol/easing.js index aebd94a886..7a64d450e9 100644 --- a/src/ol/easing.js +++ b/src/ol/easing.js @@ -49,8 +49,8 @@ export function linear(t) { /** * Start slow, speed up, and at the very end slow down again. This has the - * same general behavior as {@link ol.easing.inAndOut}, but the final slowdown - * is delayed. + * same general behavior as {@link module:ol/easing~inAndOut}, but the final + * slowdown is delayed. * @param {number} t Input between 0 and 1. * @return {number} Output between 0 and 1. * @api diff --git a/src/ol/easing.jsdoc b/src/ol/easing.jsdoc deleted file mode 100644 index 1a3dad223e..0000000000 --- a/src/ol/easing.jsdoc +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Easing functions for {@link ol.View#animate}. - * @namespace ol.easing - */ diff --git a/src/ol/events.js b/src/ol/events.js index 7763e1c3d4..720c0386d1 100644 --- a/src/ol/events.js +++ b/src/ol/events.js @@ -5,8 +5,31 @@ import {clear} from './obj.js'; /** - * @param {ol.EventsKey} listenerObj Listener object. - * @return {ol.EventsListenerFunctionType} Bound listener. + * Key to use with {@link module:ol/Observable~Observable#unByKey}. + * @typedef {Object} EventsKey + * @property {Object} [bindTo] + * @property {module:ol/events~ListenerFunction} [boundListener] + * @property {boolean} callOnce + * @property {number} [deleteIndex] + * @property {module:ol/events~ListenerFunction} listener + * @property {EventTarget|module:ol/events/EventTarget~EventTarget} target + * @property {string} type + * @api + */ + + +/** + * Listener function. This function is called with an event object as argument. + * When the function returns `false`, event propagation will stop. + * + * @typedef {function(module:ol/events/Event~Event)|function(module:ol/events/Event~Event): boolean} ListenerFunction + * @api + */ + + +/** + * @param {module:ol/events~EventsKey} listenerObj Listener object. + * @return {module:ol/events~ListenerFunction} Bound listener. */ export function bindListener(listenerObj) { const boundListener = function(evt) { @@ -23,15 +46,15 @@ export function bindListener(listenerObj) { /** - * Finds the matching {@link ol.EventsKey} in the given listener + * Finds the matching {@link module:ol/events~EventsKey} in the given listener * array. * - * @param {!Array} listeners Array of listeners. + * @param {!Array} listeners Array of listeners. * @param {!Function} listener The listener function. * @param {Object=} opt_this The `this` value inside the listener. * @param {boolean=} opt_setDeleteIndex Set the deleteIndex on the matching - * listener, for {@link ol.events.unlistenByKey}. - * @return {ol.EventsKey|undefined} The matching listener object. + * listener, for {@link module:ol/events~unlistenByKey}. + * @return {module:ol/events~EventsKey|undefined} The matching listener object. */ export function findListener(listeners, listener, opt_this, opt_setDeleteIndex) { let listenerObj; @@ -50,9 +73,9 @@ export function findListener(listeners, listener, opt_this, opt_setDeleteIndex) /** - * @param {ol.EventTargetLike} target Target. + * @param {module:ol/events/EventTarget~EventTargetLike} target Target. * @param {string} type Type. - * @return {Array.|undefined} Listeners. + * @return {Array.|undefined} Listeners. */ export function getListeners(target, type) { const listenerMap = target.ol_lm; @@ -63,8 +86,8 @@ export function getListeners(target, type) { /** * Get the lookup of listeners. If one does not exist on the target, it is * created. - * @param {ol.EventTargetLike} target Target. - * @return {!Object.>} Map of + * @param {module:ol/events/EventTarget~EventTargetLike} target Target. + * @return {!Object.>} Map of * listeners by event type. */ function getListenerMap(target) { @@ -80,7 +103,7 @@ function getListenerMap(target) { * Clean up all listener objects of the given type. All properties on the * listener objects will be removed, and if no listeners remain in the listener * map, it will be removed from the target. - * @param {ol.EventTargetLike} target Target. + * @param {module:ol/events/EventTarget~EventTargetLike} target Target. * @param {string} type Type. */ function removeListeners(target, type) { @@ -107,15 +130,15 @@ function removeListeners(target, type) { * {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html} * * This function efficiently binds a `listener` to a `this` object, and returns - * a key for use with {@link ol.events.unlistenByKey}. + * a key for use with {@link module:ol/events~unlistenByKey}. * - * @param {ol.EventTargetLike} target Event target. + * @param {module:ol/events/EventTarget~EventTargetLike} target Event target. * @param {string} type Event type. - * @param {ol.EventsListenerFunctionType} listener Listener. + * @param {module:ol/events~ListenerFunction} listener Listener. * @param {Object=} opt_this Object referenced by the `this` keyword in the * listener. Default is the `target`. * @param {boolean=} opt_once If true, add the listener as one-off listener. - * @return {ol.EventsKey} Unique key for the listener. + * @return {module:ol/events~EventsKey} Unique key for the listener. */ export function listen(target, type, listener, opt_this, opt_once) { const listenerMap = getListenerMap(target); @@ -130,7 +153,7 @@ export function listen(target, type, listener, opt_this, opt_once) { listenerObj.callOnce = false; } } else { - listenerObj = /** @type {ol.EventsKey} */ ({ + listenerObj = /** @type {module:ol/events~EventsKey} */ ({ bindTo: opt_this, callOnce: !!opt_once, listener: listener, @@ -151,19 +174,19 @@ export function listen(target, type, listener, opt_this, opt_once) { * * This function efficiently binds a `listener` as self-unregistering listener * to a `this` object, and returns a key for use with - * {@link ol.events.unlistenByKey} in case the listener needs to be unregistered - * before it is called. + * {@link module:ol/events~unlistenByKey} in case the listener needs to be + * unregistered before it is called. * - * When {@link ol.events.listen} is called with the same arguments after this + * When {@link module:ol/events~listen} is called with the same arguments after this * function, the self-unregistering listener will be turned into a permanent * listener. * - * @param {ol.EventTargetLike} target Event target. + * @param {module:ol/events/EventTarget~EventTargetLike} target Event target. * @param {string} type Event type. - * @param {ol.EventsListenerFunctionType} listener Listener. + * @param {module:ol/events~ListenerFunction} listener Listener. * @param {Object=} opt_this Object referenced by the `this` keyword in the * listener. Default is the `target`. - * @return {ol.EventsKey} Key for unlistenByKey. + * @return {module:ol/events~EventsKey} Key for unlistenByKey. */ export function listenOnce(target, type, listener, opt_this) { return listen(target, type, listener, opt_this, true); @@ -175,11 +198,11 @@ export function listenOnce(target, type, listener, opt_this) { * {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html} * * To return a listener, this function needs to be called with the exact same - * arguments that were used for a previous {@link ol.events.listen} call. + * arguments that were used for a previous {@link module:ol/events~listen} call. * - * @param {ol.EventTargetLike} target Event target. + * @param {module:ol/events/EventTarget~EventTargetLike} target Event target. * @param {string} type Event type. - * @param {ol.EventsListenerFunctionType} listener Listener. + * @param {module:ol/events~ListenerFunction} listener Listener. * @param {Object=} opt_this Object referenced by the `this` keyword in the * listener. Default is the `target`. */ @@ -199,9 +222,9 @@ export function unlisten(target, type, listener, opt_this) { * {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html} * * The argument passed to this function is the key returned from - * {@link ol.events.listen} or {@link ol.events.listenOnce}. + * {@link module:ol/events~listen} or {@link module:ol/events~listenOnce}. * - * @param {ol.EventsKey} key The key. + * @param {module:ol/events~EventsKey} key The key. */ export function unlistenByKey(key) { if (key && key.target) { @@ -225,7 +248,7 @@ export function unlistenByKey(key) { * Unregisters all event listeners on an event target. Inspired by * {@link https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html} * - * @param {ol.EventTargetLike} target Target. + * @param {module:ol/events/EventTarget~EventTargetLike} target Target. */ export function unlistenAll(target) { const listenerMap = getListenerMap(target); diff --git a/src/ol/events/Event.js b/src/ol/events/Event.js index d998e624d1..d55528270b 100644 --- a/src/ol/events/Event.js +++ b/src/ol/events/Event.js @@ -9,7 +9,7 @@ * This implementation only provides `type` and `target` properties, and * `stopPropagation` and `preventDefault` methods. It is meant as base class * for higher level events defined in the library, and works with - * {@link ol.events.EventTarget}. + * {@link module:ol/events/EventTarget~EventTarget}. * * @constructor * @implements {oli.events.Event} diff --git a/src/ol/events/EventTarget.js b/src/ol/events/EventTarget.js index 1823574e9d..fdfd1ac684 100644 --- a/src/ol/events/EventTarget.js +++ b/src/ol/events/EventTarget.js @@ -7,6 +7,12 @@ import {unlistenAll} from '../events.js'; import {UNDEFINED} from '../functions.js'; import Event from '../events/Event.js'; + +/** + * @typedef {EventTarget|module:ol/events/EventTarget~EventTarget} EventTargetLike + */ + + /** * @classdesc * A simplified implementation of the W3C DOM Level 2 EventTarget interface. @@ -43,7 +49,7 @@ const EventTarget = function() { /** * @private - * @type {!Object.>} + * @type {!Object.>} */ this.listeners_ = {}; @@ -54,7 +60,7 @@ inherits(EventTarget, Disposable); /** * @param {string} type Type. - * @param {ol.EventsListenerFunctionType} listener Listener. + * @param {module:ol/events~ListenerFunction} listener Listener. */ EventTarget.prototype.addEventListener = function(type, listener) { let listeners = this.listeners_[type]; @@ -69,7 +75,7 @@ EventTarget.prototype.addEventListener = function(type, listener) { /** * @param {{type: string, - * target: (EventTarget|ol.events.EventTarget|undefined)}|ol.events.Event| + * target: (EventTarget|module:ol/events/EventTarget~EventTarget|undefined)}|ol.events.Event| * string} event Event or event type. * @return {boolean|undefined} `false` if anyone called preventDefault on the * event object or if any of the listeners returned false. @@ -119,7 +125,7 @@ EventTarget.prototype.disposeInternal = function() { * order that they will be called in. * * @param {string} type Type. - * @return {Array.} Listeners. + * @return {Array.} Listeners. */ EventTarget.prototype.getListeners = function(type) { return this.listeners_[type]; @@ -140,7 +146,7 @@ EventTarget.prototype.hasListener = function(opt_type) { /** * @param {string} type Type. - * @param {ol.EventsListenerFunctionType} listener Listener. + * @param {module:ol/events~ListenerFunction} listener Listener. */ EventTarget.prototype.removeEventListener = function(type, listener) { const listeners = this.listeners_[type]; diff --git a/src/ol/extent.js b/src/ol/extent.js index 53567b6765..0a6c5c2fbd 100644 --- a/src/ol/extent.js +++ b/src/ol/extent.js @@ -6,11 +6,17 @@ import Corner from './extent/Corner.js'; import Relationship from './extent/Relationship.js'; +/** + * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. + * @typedef {Array.} Extent + * @api + */ + /** * Build an extent that includes all given coordinates. * - * @param {Array.} coordinates Coordinates. - * @return {ol.Extent} Bounding extent. + * @param {Array.} coordinates Coordinates. + * @return {module:ol/extent~Extent} Bounding extent. * @api */ export function boundingExtent(coordinates) { @@ -25,9 +31,9 @@ export function boundingExtent(coordinates) { /** * @param {Array.} xs Xs. * @param {Array.} ys Ys. - * @param {ol.Extent=} opt_extent Destination extent. + * @param {module:ol/extent~Extent=} opt_extent Destination extent. * @private - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. */ function _boundingExtentXYs(xs, ys, opt_extent) { const minX = Math.min.apply(null, xs); @@ -40,10 +46,10 @@ function _boundingExtentXYs(xs, ys, opt_extent) { /** * Return extent increased by the provided value. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} value The amount by which the extent should be buffered. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. * @api */ export function buffer(extent, value, opt_extent) { @@ -67,9 +73,9 @@ export function buffer(extent, value, opt_extent) { /** * Creates a clone of an extent. * - * @param {ol.Extent} extent Extent to clone. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} The clone. + * @param {module:ol/extent~Extent} extent Extent to clone. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} The clone. */ export function clone(extent, opt_extent) { if (opt_extent) { @@ -85,7 +91,7 @@ export function clone(extent, opt_extent) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} x X. * @param {number} y Y. * @return {number} Closest squared distance. @@ -113,8 +119,8 @@ export function closestSquaredDistanceXY(extent, x, y) { /** * Check if the passed coordinate is contained or on the edge of the extent. * - * @param {ol.Extent} extent Extent. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @return {boolean} The coordinate is contained in the extent. * @api */ @@ -129,8 +135,8 @@ export function containsCoordinate(extent, coordinate) { * An extent is deemed contained if it lies completely within the other extent, * including if they share one or more edges. * - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. + * @param {module:ol/extent~Extent} extent1 Extent 1. + * @param {module:ol/extent~Extent} extent2 Extent 2. * @return {boolean} The second extent is contained by or on the edge of the * first. * @api @@ -144,7 +150,7 @@ export function containsExtent(extent1, extent2) { /** * Check if the passed coordinate is contained or on the edge of the extent. * - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} x X coordinate. * @param {number} y Y coordinate. * @return {boolean} The x, y values are contained in the extent. @@ -157,10 +163,10 @@ export function containsXY(extent, x, y) { /** * Get the relationship between a coordinate and extent. - * @param {ol.Extent} extent The extent. - * @param {ol.Coordinate} coordinate The coordinate. + * @param {module:ol/extent~Extent} extent The extent. + * @param {module:ol/coordinate~Coordinate} coordinate The coordinate. * @return {number} The relationship (bitwise compare with - * ol.extent.Relationship). + * module:ol/extent~Extent.Relationship). */ export function coordinateRelationship(extent, coordinate) { const minX = extent[0]; @@ -189,7 +195,7 @@ export function coordinateRelationship(extent, coordinate) { /** * Create an empty extent. - * @return {ol.Extent} Empty extent. + * @return {module:ol/extent~Extent} Empty extent. * @api */ export function createEmpty() { @@ -203,8 +209,8 @@ export function createEmpty() { * @param {number} minY Minimum Y. * @param {number} maxX Maximum X. * @param {number} maxY Maximum Y. - * @param {ol.Extent=} opt_extent Destination extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent=} opt_extent Destination extent. + * @return {module:ol/extent~Extent} Extent. */ export function createOrUpdate(minX, minY, maxX, maxY, opt_extent) { if (opt_extent) { @@ -221,8 +227,8 @@ export function createOrUpdate(minX, minY, maxX, maxY, opt_extent) { /** * Create a new empty extent or make the provided one empty. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ export function createOrUpdateEmpty(opt_extent) { return createOrUpdate( @@ -231,9 +237,9 @@ export function createOrUpdateEmpty(opt_extent) { /** - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ export function createOrUpdateFromCoordinate(coordinate, opt_extent) { const x = coordinate[0]; @@ -243,9 +249,9 @@ export function createOrUpdateFromCoordinate(coordinate, opt_extent) { /** - * @param {Array.} coordinates Coordinates. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {Array.} coordinates Coordinates. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ export function createOrUpdateFromCoordinates(coordinates, opt_extent) { const extent = createOrUpdateEmpty(opt_extent); @@ -258,8 +264,8 @@ export function createOrUpdateFromCoordinates(coordinates, opt_extent) { * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ export function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) { const extent = createOrUpdateEmpty(opt_extent); @@ -267,9 +273,9 @@ export function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, } /** - * @param {Array.>} rings Rings. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {Array.>} rings Rings. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ export function createOrUpdateFromRings(rings, opt_extent) { const extent = createOrUpdateEmpty(opt_extent); @@ -279,8 +285,8 @@ export function createOrUpdateFromRings(rings, opt_extent) { /** * Determine if two extents are equivalent. - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. + * @param {module:ol/extent~Extent} extent1 Extent 1. + * @param {module:ol/extent~Extent} extent2 Extent 2. * @return {boolean} The two extents are equivalent. * @api */ @@ -292,9 +298,9 @@ export function equals(extent1, extent2) { /** * Modify an extent to include another extent. - * @param {ol.Extent} extent1 The extent to be modified. - * @param {ol.Extent} extent2 The extent that will be included in the first. - * @return {ol.Extent} A reference to the first (extended) extent. + * @param {module:ol/extent~Extent} extent1 The extent to be modified. + * @param {module:ol/extent~Extent} extent2 The extent that will be included in the first. + * @return {module:ol/extent~Extent} A reference to the first (extended) extent. * @api */ export function extend(extent1, extent2) { @@ -315,8 +321,8 @@ export function extend(extent1, extent2) { /** - * @param {ol.Extent} extent Extent. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. */ export function extendCoordinate(extent, coordinate) { if (coordinate[0] < extent[0]) { @@ -335,9 +341,9 @@ export function extendCoordinate(extent, coordinate) { /** - * @param {ol.Extent} extent Extent. - * @param {Array.} coordinates Coordinates. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent} extent Extent. + * @param {Array.} coordinates Coordinates. + * @return {module:ol/extent~Extent} Extent. */ export function extendCoordinates(extent, coordinates) { for (let i = 0, ii = coordinates.length; i < ii; ++i) { @@ -348,12 +354,12 @@ export function extendCoordinates(extent, coordinates) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {Array.} flatCoordinates Flat coordinates. * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. */ export function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) { for (; offset < end; offset += stride) { @@ -364,9 +370,9 @@ export function extendFlatCoordinates(extent, flatCoordinates, offset, end, stri /** - * @param {ol.Extent} extent Extent. - * @param {Array.>} rings Rings. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent} extent Extent. + * @param {Array.>} rings Rings. + * @return {module:ol/extent~Extent} Extent. */ export function extendRings(extent, rings) { for (let i = 0, ii = rings.length; i < ii; ++i) { @@ -377,7 +383,7 @@ export function extendRings(extent, rings) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} x X. * @param {number} y Y. */ @@ -393,8 +399,8 @@ export function extendXY(extent, x, y) { * This function calls `callback` for each corner of the extent. If the * callback returns a truthy value the function returns that value * immediately. Otherwise the function returns `false`. - * @param {ol.Extent} extent Extent. - * @param {function(this:T, ol.Coordinate): S} callback Callback. + * @param {module:ol/extent~Extent} extent Extent. + * @param {function(this:T, module:ol/coordinate~Coordinate): S} callback Callback. * @param {T=} opt_this Value to use as `this` when executing `callback`. * @return {S|boolean} Value. * @template S, T @@ -423,7 +429,7 @@ export function forEachCorner(extent, callback, opt_this) { /** * Get the size of an extent. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {number} Area. * @api */ @@ -438,8 +444,8 @@ export function getArea(extent) { /** * Get the bottom left coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Bottom left coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @return {module:ol/coordinate~Coordinate} Bottom left coordinate. * @api */ export function getBottomLeft(extent) { @@ -449,8 +455,8 @@ export function getBottomLeft(extent) { /** * Get the bottom right coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Bottom right coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @return {module:ol/coordinate~Coordinate} Bottom right coordinate. * @api */ export function getBottomRight(extent) { @@ -460,8 +466,8 @@ export function getBottomRight(extent) { /** * Get the center coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Center. + * @param {module:ol/extent~Extent} extent Extent. + * @return {module:ol/coordinate~Coordinate} Center. * @api */ export function getCenter(extent) { @@ -471,9 +477,9 @@ export function getCenter(extent) { /** * Get a corner coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @param {ol.extent.Corner} corner Corner. - * @return {ol.Coordinate} Corner coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/extent~Extent.Corner} corner Corner. + * @return {module:ol/coordinate~Coordinate} Corner coordinate. */ export function getCorner(extent, corner) { let coordinate; @@ -488,13 +494,13 @@ export function getCorner(extent, corner) { } else { assert(false, 13); // Invalid corner } - return /** @type {!ol.Coordinate} */ (coordinate); + return /** @type {!module:ol/coordinate~Coordinate} */ (coordinate); } /** - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. + * @param {module:ol/extent~Extent} extent1 Extent 1. + * @param {module:ol/extent~Extent} extent2 Extent 2. * @return {number} Enlarged area. */ export function getEnlargedArea(extent1, extent2) { @@ -507,12 +513,12 @@ export function getEnlargedArea(extent1, extent2) { /** - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {ol.Extent=} opt_extent Destination extent. - * @return {ol.Extent} Extent. + * @param {module:ol/size~Size} size Size. + * @param {module:ol/extent~Extent=} opt_extent Destination extent. + * @return {module:ol/extent~Extent} Extent. */ export function getForViewAndSize(center, resolution, rotation, size, opt_extent) { const dx = resolution * size[0] / 2; @@ -542,7 +548,7 @@ export function getForViewAndSize(center, resolution, rotation, size, opt_extent /** * Get the height of an extent. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {number} Height. * @api */ @@ -552,8 +558,8 @@ export function getHeight(extent) { /** - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. + * @param {module:ol/extent~Extent} extent1 Extent 1. + * @param {module:ol/extent~Extent} extent2 Extent 2. * @return {number} Intersection area. */ export function getIntersectionArea(extent1, extent2) { @@ -564,10 +570,10 @@ export function getIntersectionArea(extent1, extent2) { /** * Get the intersection of two extents. - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent 2. - * @param {ol.Extent=} opt_extent Optional extent to populate with intersection. - * @return {ol.Extent} Intersecting extent. + * @param {module:ol/extent~Extent} extent1 Extent 1. + * @param {module:ol/extent~Extent} extent2 Extent 2. + * @param {module:ol/extent~Extent=} opt_extent Optional extent to populate with intersection. + * @return {module:ol/extent~Extent} Intersecting extent. * @api */ export function getIntersection(extent1, extent2, opt_extent) { @@ -601,7 +607,7 @@ export function getIntersection(extent1, extent2, opt_extent) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {number} Margin. */ export function getMargin(extent) { @@ -611,8 +617,8 @@ export function getMargin(extent) { /** * Get the size (width, height) of an extent. - * @param {ol.Extent} extent The extent. - * @return {ol.Size} The extent size. + * @param {module:ol/extent~Extent} extent The extent. + * @return {module:ol/size~Size} The extent size. * @api */ export function getSize(extent) { @@ -622,8 +628,8 @@ export function getSize(extent) { /** * Get the top left coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Top left coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @return {module:ol/coordinate~Coordinate} Top left coordinate. * @api */ export function getTopLeft(extent) { @@ -633,8 +639,8 @@ export function getTopLeft(extent) { /** * Get the top right coordinate of an extent. - * @param {ol.Extent} extent Extent. - * @return {ol.Coordinate} Top right coordinate. + * @param {module:ol/extent~Extent} extent Extent. + * @return {module:ol/coordinate~Coordinate} Top right coordinate. * @api */ export function getTopRight(extent) { @@ -644,7 +650,7 @@ export function getTopRight(extent) { /** * Get the width of an extent. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {number} Width. * @api */ @@ -655,8 +661,8 @@ export function getWidth(extent) { /** * Determine if one extent intersects another. - * @param {ol.Extent} extent1 Extent 1. - * @param {ol.Extent} extent2 Extent. + * @param {module:ol/extent~Extent} extent1 Extent 1. + * @param {module:ol/extent~Extent} extent2 Extent. * @return {boolean} The two extents intersect. * @api */ @@ -670,7 +676,7 @@ export function intersects(extent1, extent2) { /** * Determine if an extent is empty. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} Is empty. * @api */ @@ -680,9 +686,9 @@ export function isEmpty(extent) { /** - * @param {ol.Extent} extent Extent. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ export function returnOrUpdate(extent, opt_extent) { if (opt_extent) { @@ -698,7 +704,7 @@ export function returnOrUpdate(extent, opt_extent) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} value Value. */ export function scaleFromCenter(extent, value) { @@ -714,9 +720,9 @@ export function scaleFromCenter(extent, value) { /** * Determine if the segment between two coordinates intersects (crosses, * touches, or is contained by) the provided extent. - * @param {ol.Extent} extent The extent. - * @param {ol.Coordinate} start Segment start coordinate. - * @param {ol.Coordinate} end Segment end coordinate. + * @param {module:ol/extent~Extent} extent The extent. + * @param {module:ol/coordinate~Coordinate} start Segment start coordinate. + * @param {module:ol/coordinate~Coordinate} end Segment end coordinate. * @return {boolean} The segment intersects the extent. */ export function intersectsSegment(extent, start, end) { @@ -769,11 +775,11 @@ export function intersectsSegment(extent, start, end) { /** * Apply a transform function to the extent. - * @param {ol.Extent} extent Extent. - * @param {ol.TransformFunction} transformFn Transform function. Called with - * [minX, minY, maxX, maxY] extent coordinates. - * @param {ol.Extent=} opt_extent Destination extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/proj~TransformFunction} transformFn Transform function. + * Called with `[minX, minY, maxX, maxY]` extent coordinates. + * @param {module:ol/extent~Extent=} opt_extent Destination extent. + * @return {module:ol/extent~Extent} Extent. * @api */ export function applyTransform(extent, transformFn, opt_extent) { diff --git a/src/ol/extent.jsdoc b/src/ol/extent.jsdoc deleted file mode 100644 index 4af9963e3c..0000000000 --- a/src/ol/extent.jsdoc +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @namespace ol.extent - */ diff --git a/src/ol/featureloader.js b/src/ol/featureloader.js index 9c557c1d91..0e8742c80c 100644 --- a/src/ol/featureloader.js +++ b/src/ol/featureloader.js @@ -6,23 +6,54 @@ import FormatType from './format/FormatType.js'; /** - * @param {string|ol.FeatureUrlFunction} url Feature URL service. - * @param {ol.format.Feature} format Feature format. - * @param {function(this:ol.VectorTile, Array., ol.proj.Projection, ol.Extent)|function(this:ol.source.Vector, Array.)} success + * {@link module:ol/source/Vector~Vector} sources use a function of this type to + * load features. + * + * This function takes an {@link module:ol/extent~Extent} representing the area to be loaded, + * a `{number}` representing the resolution (map units per pixel) and an + * {@link module:ol/proj/Projection~Projection} for the projection as + * arguments. `this` within the function is bound to the + * {@link module:ol/source/Vector~Vector} it's called from. + * + * The function is responsible for loading the features and adding them to the + * source. + * @typedef {function(this:module:ol/source/Vector~Vector, module:ol/extent~Extent, number, + * module:ol/proj/Projection~Projection)} FeatureLoader + * @api + */ + + +/** + * {@link module:ol/source/Vector~Vector} sources use a function of this type to + * get the url to load features from. + * + * This function takes an {@link module:ol/extent~Extent} representing the area + * to be loaded, a `{number}` representing the resolution (map units per pixel) + * and an {@link module:ol/proj/Projection~Projection} for the projection as + * arguments and returns a `{string}` representing the URL. + * @typedef {function(module:ol/extent~Extent, number, module:ol/proj/Projection~Projection): string} FeatureUrlFunction + * @api + */ + + +/** + * @param {string|module:ol/featureloader~FeatureUrlFunction} url Feature URL service. + * @param {module:ol/format/Feature~Feature} format Feature format. + * @param {function(this:module:ol/VectorTile~VectorTile, Array., module:ol/proj/Projection~Projection, module:ol/extent~Extent)|function(this:module:ol/source/Vector~Vector, Array.)} success * Function called with the loaded features and optionally with the data * projection. Called with the vector tile or source as `this`. - * @param {function(this:ol.VectorTile)|function(this:ol.source.Vector)} failure + * @param {function(this:module:ol/VectorTile~VectorTile)|function(this:module:ol/source/Vector~Vector)} failure * Function called when loading failed. Called with the vector tile or * source as `this`. - * @return {ol.FeatureLoader} The feature loader. + * @return {module:ol/featureloader~FeatureLoader} The feature loader. */ export function loadFeaturesXhr(url, format, success, failure) { return ( /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. - * @param {ol.proj.Projection} projection Projection. - * @this {ol.source.Vector|ol.VectorTile} + * @param {module:ol/proj/Projection~Projection} projection Projection. + * @this {module:ol/source/Vector~Vector|module:ol/VectorTile~VectorTile} */ function(extent, resolution, projection) { const xhr = new XMLHttpRequest(); @@ -79,17 +110,18 @@ export function loadFeaturesXhr(url, format, success, failure) { * Create an XHR feature loader for a `url` and `format`. The feature loader * loads features (with XHR), parses the features, and adds them to the * vector source. - * @param {string|ol.FeatureUrlFunction} url Feature URL service. - * @param {ol.format.Feature} format Feature format. - * @return {ol.FeatureLoader} The feature loader. + * @param {string|module:ol/featureloader~FeatureUrlFunction} url Feature URL service. + * @param {module:ol/format/Feature~Feature} format Feature format. + * @return {module:ol/featureloader~FeatureLoader} The feature loader. * @api */ export function xhr(url, format) { return loadFeaturesXhr(url, format, /** - * @param {Array.} features The loaded features. - * @param {ol.proj.Projection} dataProjection Data projection. - * @this {ol.source.Vector} + * @param {Array.} features The loaded features. + * @param {module:ol/proj/Projection~Projection} dataProjection Data + * projection. + * @this {module:ol/source/Vector~Vector} */ function(features, dataProjection) { this.addFeatures(features); diff --git a/src/ol/featureloader.jsdoc b/src/ol/featureloader.jsdoc deleted file mode 100644 index 8942ced5ba..0000000000 --- a/src/ol/featureloader.jsdoc +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Loading mechanisms for vector data. - * @namespace ol.featureloader - */ diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index af12784f1b..b28acc098d 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -74,7 +74,7 @@ FeatureFormat.prototype.adaptOptions = function(options) { /** * Get the extent from the source of the last {@link readFeatures} call. - * @return {ol.Extent} Tile extent. + * @return {module:ol/extent~Extent} Tile extent. */ FeatureFormat.prototype.getLastExtent = function() { return null; @@ -166,11 +166,11 @@ FeatureFormat.prototype.writeGeometry = function(geometry, opt_options) {}; export default FeatureFormat; /** - * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. + * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {boolean} write Set to true for writing, false for reading. * @param {(olx.format.WriteOptions|olx.format.ReadOptions)=} opt_options * Options. - * @return {ol.geom.Geometry|ol.Extent} Transformed geometry. + * @return {ol.geom.Geometry|module:ol/extent~Extent} Transformed geometry. */ export function transformWithOptions(geometry, write, opt_options) { const featureProjection = opt_options ? @@ -178,7 +178,7 @@ export function transformWithOptions(geometry, write, opt_options) { const dataProjection = opt_options ? getProjection(opt_options.dataProjection) : null; /** - * @type {ol.geom.Geometry|ol.Extent} + * @type {ol.geom.Geometry|module:ol/extent~Extent} */ let transformed; if (featureProjection && dataProjection && diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index a3f5c83b08..0d1b58a6c0 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -59,7 +59,7 @@ inherits(GML2, GMLBase); */ GML2.prototype.readFlatCoordinates_ = function(node, objectStack) { const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); - const context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]); + const context = /** @type {module:ol/xml~NodeStackItem} */ (objectStack[0]); const containerSrs = context['srsName']; let axisOrientation = 'enu'; if (containerSrs) { @@ -89,7 +89,7 @@ GML2.prototype.readFlatCoordinates_ = function(node, objectStack) { * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. * @private - * @return {ol.Extent|undefined} Envelope. + * @return {module:ol/extent~Extent|undefined} Envelope. */ GML2.prototype.readBox_ = function(node, objectStack) { /** @type {Array.} */ @@ -205,7 +205,7 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) { } const item = assign({}, context); item.node = node; - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ (item), context.serializers, makeSimpleNodeFactory(undefined, featureNS), values, @@ -278,7 +278,7 @@ GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta /** * @param {Node} node Node. - * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. + * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {Array.<*>} objectStack Node stack. */ GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) { @@ -296,7 +296,7 @@ GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) { } else { value = transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); } - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ (item), this.GEOMETRY_SERIALIZERS_, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this); @@ -565,7 +565,7 @@ GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStac /** * @param {Node} node Node. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {Array.<*>} objectStack Node stack. * @private */ @@ -577,7 +577,7 @@ GML2.prototype.writeEnvelope = function(node, extent, objectStack) { } const keys = ['lowerCorner', 'upperCorner']; const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ ({node: node}), this.ENVELOPE_SERIALIZERS_, OBJECT_PROPERTY_NODE_FACTORY, values, @@ -614,7 +614,7 @@ GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { @@ -626,7 +626,7 @@ GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { @@ -639,7 +639,7 @@ GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.BOX_PARSERS_ = { @@ -652,7 +652,7 @@ GML2.prototype.BOX_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.GEOMETRY_PARSERS_ = { @@ -676,7 +676,7 @@ GML2.prototype.GEOMETRY_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.GEOMETRY_SERIALIZERS_ = { @@ -709,7 +709,7 @@ GML2.prototype.GEOMETRY_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { @@ -723,7 +723,7 @@ GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.RING_SERIALIZERS_ = { @@ -735,7 +735,7 @@ GML2.prototype.RING_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.POINTMEMBER_SERIALIZERS_ = { @@ -748,7 +748,7 @@ GML2.prototype.POINTMEMBER_SERIALIZERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { @@ -762,7 +762,7 @@ GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML2.prototype.ENVELOPE_SERIALIZERS_ = { diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index 6bf34d470e..de128fb730 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -288,7 +288,7 @@ GML3.prototype.readCurve_ = function(node, objectStack) { * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. * @private - * @return {ol.Extent|undefined} Envelope. + * @return {module:ol/extent~Extent|undefined} Envelope. */ GML3.prototype.readEnvelope_ = function(node, objectStack) { /** @type {Array.} */ @@ -395,7 +395,7 @@ GML3.prototype.readFlatPosList_ = function(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { @@ -408,7 +408,7 @@ GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { @@ -421,7 +421,7 @@ GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.GEOMETRY_PARSERS_ = { @@ -451,7 +451,7 @@ GML3.prototype.GEOMETRY_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.MULTICURVE_PARSERS_ = { @@ -466,7 +466,7 @@ GML3.prototype.MULTICURVE_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.MULTISURFACE_PARSERS_ = { @@ -481,7 +481,7 @@ GML3.prototype.MULTISURFACE_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.CURVEMEMBER_PARSERS_ = { @@ -495,7 +495,7 @@ GML3.prototype.CURVEMEMBER_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.SURFACEMEMBER_PARSERS_ = { @@ -508,7 +508,7 @@ GML3.prototype.SURFACEMEMBER_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.SURFACE_PARSERS_ = { @@ -520,7 +520,7 @@ GML3.prototype.SURFACE_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.CURVE_PARSERS_ = { @@ -532,7 +532,7 @@ GML3.prototype.CURVE_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.ENVELOPE_PARSERS_ = { @@ -547,7 +547,7 @@ GML3.prototype.ENVELOPE_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.PATCHES_PARSERS_ = { @@ -560,7 +560,7 @@ GML3.prototype.PATCHES_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.SEGMENTS_PARSERS_ = { @@ -674,7 +674,7 @@ GML3.prototype.writePoint_ = function(node, geometry, objectStack) { /** * @param {Node} node Node. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {Array.<*>} objectStack Node stack. */ GML3.prototype.writeEnvelope = function(node, extent, objectStack) { @@ -685,7 +685,7 @@ GML3.prototype.writeEnvelope = function(node, extent, objectStack) { } const keys = ['lowerCorner', 'upperCorner']; const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ ({node: node}), this.ENVELOPE_SERIALIZERS_, OBJECT_PROPERTY_NODE_FACTORY, values, @@ -936,7 +936,7 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) { /** * @param {Node} node Node. - * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. + * @param {ol.geom.Geometry|module:ol/extent~Extent} geometry Geometry. * @param {Array.<*>} objectStack Node stack. */ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) { @@ -954,7 +954,7 @@ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) { } else { value = transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); } - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ (item), this.GEOMETRY_SERIALIZERS_, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this); @@ -1000,7 +1000,7 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) { } const item = assign({}, context); item.node = node; - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ (item), context.serializers, makeSimpleNodeFactory(undefined, featureNS), values, @@ -1024,7 +1024,7 @@ GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) { this.writeFeatureElement, this); const item = assign({}, context); item.node = node; - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ (item), serializers, makeSimpleNodeFactory(featureType, featureNS), features, @@ -1162,7 +1162,7 @@ GML3.prototype.writeFeaturesNode = function(features, opt_options) { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.RING_SERIALIZERS_ = { @@ -1174,7 +1174,7 @@ GML3.prototype.RING_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.ENVELOPE_SERIALIZERS_ = { @@ -1186,7 +1186,7 @@ GML3.prototype.ENVELOPE_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { @@ -1200,7 +1200,7 @@ GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.POINTMEMBER_SERIALIZERS_ = { @@ -1212,7 +1212,7 @@ GML3.prototype.POINTMEMBER_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { @@ -1226,7 +1226,7 @@ GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { /** - * @type {Object.>} + * @type {Object.>} * @private */ GML3.prototype.GEOMETRY_SERIALIZERS_ = { diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index 1ebd849982..ccee933ae3 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -440,7 +440,7 @@ GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GMLBase.prototype.MULTIPOINT_PARSERS_ = { @@ -453,7 +453,7 @@ GMLBase.prototype.MULTIPOINT_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GMLBase.prototype.MULTILINESTRING_PARSERS_ = { @@ -466,7 +466,7 @@ GMLBase.prototype.MULTILINESTRING_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GMLBase.prototype.MULTIPOLYGON_PARSERS_ = { @@ -479,7 +479,7 @@ GMLBase.prototype.MULTIPOLYGON_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GMLBase.prototype.POINTMEMBER_PARSERS_ = { @@ -491,7 +491,7 @@ GMLBase.prototype.POINTMEMBER_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = { @@ -503,7 +503,7 @@ GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @private */ GMLBase.prototype.POLYGONMEMBER_PARSERS_ = { @@ -515,7 +515,7 @@ GMLBase.prototype.POLYGONMEMBER_PARSERS_ = { /** * @const - * @type {Object.>} + * @type {Object.>} * @protected */ GMLBase.prototype.RING_PARSERS = { diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index d674b21e5a..d363cfc62d 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -79,7 +79,7 @@ const FEATURE_READER = { /** * @const - * @type {Object.>} + * @type {Object.>} */ const GPX_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -91,7 +91,7 @@ const GPX_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const LINK_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -102,7 +102,7 @@ const LINK_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const RTE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -120,7 +120,7 @@ const RTE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const RTEPT_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -131,7 +131,7 @@ const RTEPT_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRK_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -149,7 +149,7 @@ const TRK_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRKSEG_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -159,7 +159,7 @@ const TRKSEG_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRKPT_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -170,7 +170,7 @@ const TRKPT_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const WPT_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -205,7 +205,7 @@ const LINK_SEQUENCE = ['text', 'type']; /** * @const - * @type {Object.>} + * @type {Object.>} */ const LINK_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -226,7 +226,7 @@ const RTE_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const RTE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -263,7 +263,7 @@ const TRK_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRK_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -287,7 +287,7 @@ const TRKSEG_NODE_FACTORY = makeSimpleNodeFactory('trkpt'); /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRKSEG_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -309,7 +309,7 @@ const WPT_TYPE_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const WPT_TYPE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -365,7 +365,7 @@ function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const GPX_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -712,7 +712,7 @@ function writeLink(node, value, objectStack) { properties['linkText'], properties['linkType'] ]; - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}), + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ ({node: node}), LINK_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, link, objectStack, LINK_SEQUENCE); } @@ -720,7 +720,7 @@ function writeLink(node, value, objectStack) { /** * @param {Node} node Node. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {Array.<*>} objectStack Object stack. */ function writeWptType(node, coordinate, objectStack) { @@ -755,7 +755,7 @@ function writeWptType(node, coordinate, objectStack) { RTEPT_TYPE_SEQUENCE[namespaceURI] : WPT_TYPE_SEQUENCE[namespaceURI]; const values = makeSequence(properties, orderedKeys); - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ ({node: node, 'properties': properties}), WPT_TYPE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); @@ -794,7 +794,7 @@ function writeRte(node, feature, objectStack) { function writeTrk(node, feature, objectStack) { const options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); const properties = feature.getProperties(); - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const context = {node: node, 'properties': properties}; let geometry = feature.getGeometry(); if (geometry) { @@ -817,7 +817,7 @@ function writeTrk(node, feature, objectStack) { * @param {Array.<*>} objectStack Object stack. */ function writeTrkSeg(node, lineString, objectStack) { - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const context = {node: node, 'geometryLayout': lineString.getLayout(), 'properties': {}}; pushSerializeAndPop(context, @@ -881,7 +881,7 @@ GPX.prototype.writeFeaturesNode = function(features, opt_options) { gpx.setAttribute('version', '1.1'); gpx.setAttribute('creator', 'OpenLayers'); - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ ({node: gpx}), GPX_SERIALIZERS, GPX_NODE_FACTORY, features, [opt_options]); return gpx; }; diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 14c357e1ac..10ff2878eb 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -53,7 +53,7 @@ export function getDefaultFillStyle() { } /** - * @type {ol.Size} + * @type {module:ol/size~Size} */ let DEFAULT_IMAGE_STYLE_ANCHOR; @@ -68,7 +68,7 @@ let DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; let DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; /** - * @type {ol.Size} + * @type {module:ol/size~Size} */ let DEFAULT_IMAGE_STYLE_SIZE; @@ -386,7 +386,7 @@ function createNameStyleFunction(foundStyle, name) { * @param {Array.} defaultStyle Default style. * @param {!Object.|string)>} sharedStyles Shared styles. * @param {boolean|undefined} showPointNames true to show names for point placemarks. - * @return {ol.StyleFunction} Feature style function. + * @return {module:ol/style~StyleFunction} Feature style function. */ function createFeatureStyleFunction(style, styleUrl, defaultStyle, sharedStyles, showPointNames) { @@ -573,7 +573,7 @@ function readScale(node) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const STYLE_MAP_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -594,7 +594,7 @@ function readStyleMapValue(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const ICON_STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -710,7 +710,7 @@ function iconStyleParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const LABEL_STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -745,7 +745,7 @@ function labelStyleParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const LINE_STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -781,7 +781,7 @@ function lineStyleParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const POLY_STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -822,7 +822,7 @@ function polyStyleParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const FLAT_LINEAR_RING_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -866,7 +866,7 @@ function gxCoordParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const GX_MULTITRACK_GEOMETRY_PARSERS = makeStructureNS( GX_NAMESPACE_URIS, { @@ -893,7 +893,7 @@ function readGxMultiTrack(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const GX_TRACK_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -931,7 +931,7 @@ function readGxTrack(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const ICON_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -963,7 +963,7 @@ function readIcon(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const GEOMETRY_FLAT_COORDINATES_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -984,7 +984,7 @@ function readFlatCoordinatesFromNode(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const EXTRUDE_AND_ALTITUDE_MODE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1041,7 +1041,7 @@ function readLinearRing(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const MULTI_GEOMETRY_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1137,7 +1137,7 @@ function readPoint(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const FLAT_LINEAR_RINGS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1176,7 +1176,7 @@ function readPolygon(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1269,7 +1269,7 @@ function setCommonGeometryProperties(multiGeometry, geometries) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const DATA_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1297,7 +1297,7 @@ function dataParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const EXTENDED_DATA_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1316,7 +1316,7 @@ function extendedDataParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const REGION_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1335,7 +1335,7 @@ function regionParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const PAIR_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1394,7 +1394,7 @@ function placemarkStyleMapParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const SCHEMA_DATA_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1428,7 +1428,7 @@ function simpleDataParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const LAT_LON_ALT_BOX_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1467,7 +1467,7 @@ function latLonAltBoxParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const LOD_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1497,7 +1497,7 @@ function lodParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const INNER_BOUNDARY_IS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1523,7 +1523,7 @@ function innerBoundaryIsParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const OUTER_BOUNDARY_IS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1549,7 +1549,7 @@ function outerBoundaryIsParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const NETWORK_LINK_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1567,7 +1567,7 @@ const NETWORK_LINK_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const LINK_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -1600,7 +1600,7 @@ function whenParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const PLACEMARK_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -2112,7 +2112,7 @@ function writeCoordinatesTextNode(node, coordinates, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const EXTENDEDDATA_NODE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2129,7 +2129,7 @@ const EXTENDEDDATA_NODE_SERIALIZERS = makeStructureNS( */ function writeDataNode(node, pair, objectStack) { node.setAttribute('name', pair.name); - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const value = pair.value; if (typeof value == 'object') { @@ -2169,7 +2169,7 @@ function writeDataNodeValue(node, value) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const DOCUMENT_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2197,7 +2197,7 @@ const DOCUMENT_NODE_FACTORY = function(value, objectStack, opt_nodeName) { * @this {ol.format.KML} */ function writeDocument(node, features, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; pushSerializeAndPop(context, DOCUMENT_SERIALIZERS, DOCUMENT_NODE_FACTORY, features, objectStack, undefined, this); @@ -2218,7 +2218,7 @@ const DATA_NODE_FACTORY = makeSimpleNodeFactory('Data'); * @param {Array.<*>} objectStack Object stack. */ function writeExtendedData(node, namesAndValues, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const names = namesAndValues.names; const values = namesAndValues.values; const length = names.length; @@ -2245,7 +2245,7 @@ const ICON_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const ICON_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2278,7 +2278,7 @@ const GX_NODE_FACTORY = function(value, objectStack, opt_nodeName) { * @param {Array.<*>} objectStack Object stack. */ function writeIcon(node, icon, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const parentNode = objectStack[objectStack.length - 1].node; let orderedKeys = ICON_SEQUENCE[parentNode.namespaceURI]; let values = makeSequence(icon, orderedKeys); @@ -2305,7 +2305,7 @@ const ICON_STYLE_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const ICON_STYLE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2322,7 +2322,7 @@ const ICON_STYLE_SERIALIZERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function writeIconStyle(node, style, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const properties = {}; const src = style.getSrc(); const size = style.getSize(); @@ -2385,7 +2385,7 @@ const LABEL_STYLE_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const LABEL_STYLE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2400,7 +2400,7 @@ const LABEL_STYLE_SERIALIZERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function writeLabelStyle(node, style, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const properties = {}; const fill = style.getFill(); if (fill) { @@ -2431,7 +2431,7 @@ const LINE_STYLE_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const LINE_STYLE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2446,7 +2446,7 @@ const LINE_STYLE_SERIALIZERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function writeLineStyle(node, style, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const properties = { 'color': style.getColor(), 'width': style.getWidth() @@ -2525,7 +2525,7 @@ const POLYGON_NODE_FACTORY = makeSimpleNodeFactory('Polygon'); /** * @const - * @type {Object.>} + * @type {Object.>} */ const MULTI_GEOMETRY_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2545,7 +2545,7 @@ const MULTI_GEOMETRY_SERIALIZERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function writeMultiGeometry(node, geometry, objectStack) { - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const context = {node: node}; const type = geometry.getType(); /** @type {Array.} */ @@ -2577,7 +2577,7 @@ function writeMultiGeometry(node, geometry, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const BOUNDARY_IS_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2592,7 +2592,7 @@ const BOUNDARY_IS_SERIALIZERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function writeBoundaryIs(node, linearRing, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; pushSerializeAndPop(context, BOUNDARY_IS_SERIALIZERS, LINEAR_RING_NODE_FACTORY, [linearRing], objectStack); @@ -2601,7 +2601,7 @@ function writeBoundaryIs(node, linearRing, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const PLACEMARK_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2650,7 +2650,7 @@ const EXTENDEDDATA_NODE_FACTORY = makeSimpleNodeFactory('ExtendedData'); * @this {ol.format.KML} */ function writePlacemark(node, feature, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; // set id if (feature.getId()) { @@ -2720,7 +2720,7 @@ const PRIMITIVE_GEOMETRY_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const PRIMITIVE_GEOMETRY_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2738,7 +2738,7 @@ const PRIMITIVE_GEOMETRY_SERIALIZERS = makeStructureNS( */ function writePrimitiveGeometry(node, geometry, objectStack) { const flatCoordinates = geometry.getFlatCoordinates(); - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; context['layout'] = geometry.getLayout(); context['stride'] = geometry.getStride(); @@ -2756,7 +2756,7 @@ function writePrimitiveGeometry(node, geometry, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const POLYGON_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2791,7 +2791,7 @@ const OUTER_BOUNDARY_NODE_FACTORY = makeSimpleNodeFactory('outerBoundaryIs'); function writePolygon(node, polygon, objectStack) { const linearRings = polygon.getLinearRings(); const outerRing = linearRings.shift(); - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; // inner rings pushSerializeAndPop(context, POLYGON_SERIALIZERS, @@ -2807,7 +2807,7 @@ function writePolygon(node, polygon, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const POLY_STYLE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2829,7 +2829,7 @@ const COLOR_NODE_FACTORY = makeSimpleNodeFactory('color'); * @param {Array.<*>} objectStack Object stack. */ function writePolyStyle(node, style, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; pushSerializeAndPop(context, POLY_STYLE_SERIALIZERS, COLOR_NODE_FACTORY, [style.getColor()], objectStack); } @@ -2858,7 +2858,7 @@ const STYLE_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const STYLE_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2875,7 +2875,7 @@ const STYLE_SERIALIZERS = makeStructureNS( * @param {Array.<*>} objectStack Object stack. */ function writeStyle(node, style, objectStack) { - const /** @type {ol.XmlNodeStackItem} */ context = {node: node}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: node}; const properties = {}; const fillStyle = style.getFill(); const strokeStyle = style.getStroke(); @@ -2925,7 +2925,7 @@ const KML_SEQUENCE = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const KML_SERIALIZERS = makeStructureNS( NAMESPACE_URIS, { @@ -2968,7 +2968,7 @@ KML.prototype.writeFeaturesNode = function(features, opt_options) { setAttributeNS(kml, xmlSchemaInstanceUri, 'xsi:schemaLocation', SCHEMA_LOCATION); - const /** @type {ol.XmlNodeStackItem} */ context = {node: kml}; + const /** @type {module:ol/xml~NodeStackItem} */ context = {node: kml}; const properties = {}; if (features.length > 1) { properties['Document'] = features; diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index 9c9c82f9ae..9047aa2d09 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -73,7 +73,7 @@ const MVT = function(opt_options) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = null; diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index ee35408b86..0469f03563 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -45,7 +45,7 @@ const NAMESPACE_URIS = [null]; /** * @const - * @type {Object.>} + * @type {Object.>} */ const WAY_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -56,7 +56,7 @@ const WAY_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -67,7 +67,7 @@ const PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const NODE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -83,7 +83,7 @@ function readNode(node, objectStack) { const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); const state = /** @type {Object} */ (objectStack[objectStack.length - 1]); const id = node.getAttribute('id'); - /** @type {ol.Coordinate} */ + /** @type {module:ol/coordinate~Coordinate} */ const coordinates = [ parseFloat(node.getAttribute('lon')), parseFloat(node.getAttribute('lat')) diff --git a/src/ol/format/OWS.js b/src/ol/format/OWS.js index 2055c0ed6b..5720d881c0 100644 --- a/src/ol/format/OWS.js +++ b/src/ol/format/OWS.js @@ -27,7 +27,7 @@ const NAMESPACE_URIS = [null, 'http://www.opengis.net/ows/1.1']; /** * @const - * @type {Object.>} + * @type {Object.>} */ const PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -39,7 +39,7 @@ const PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const ADDRESS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -54,7 +54,7 @@ const ADDRESS_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const ALLOWED_VALUES_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -64,7 +64,7 @@ const ALLOWED_VALUES_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CONSTRAINT_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -74,7 +74,7 @@ const CONSTRAINT_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CONTACT_INFO_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -85,7 +85,7 @@ const CONTACT_INFO_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const DCP_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -95,7 +95,7 @@ const DCP_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const HTTP_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -106,7 +106,7 @@ const HTTP_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const OPERATION_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -116,7 +116,7 @@ const OPERATION_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const OPERATIONS_METADATA_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -126,7 +126,7 @@ const OPERATIONS_METADATA_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const PHONE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -137,7 +137,7 @@ const PHONE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const REQUEST_METHOD_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -147,7 +147,7 @@ const REQUEST_METHOD_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const SERVICE_CONTACT_PARSERS = makeStructureNS( @@ -160,7 +160,7 @@ const SERVICE_CONTACT_PARSERS = /** * @const - * @type {Object.>} + * @type {Object.>} */ const SERVICE_IDENTIFICATION_PARSERS = makeStructureNS( @@ -176,7 +176,7 @@ const SERVICE_IDENTIFICATION_PARSERS = /** * @const - * @type {Object.>} + * @type {Object.>} */ const SERVICE_PROVIDER_PARSERS = makeStructureNS( diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index 53df71e8eb..f061718d04 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -70,12 +70,12 @@ const GEOMETRY_READERS = { * Concatenate arcs into a coordinate array. * @param {Array.} indices Indices of arcs to concatenate. Negative * values indicate arcs need to be reversed. - * @param {Array.>} arcs Array of arcs (already + * @param {Array.>} arcs Array of arcs (already * transformed). - * @return {Array.} Coordinates array. + * @return {Array.} Coordinates array. */ function concatenateArcs(indices, arcs) { - /** @type {Array.} */ + /** @type {Array.} */ const coordinates = []; let index, arc; for (let i = 0, ii = indices.length; i < ii; ++i) { @@ -141,7 +141,7 @@ function readMultiPointGeometry(object, scale, translate) { * Create a linestring from a TopoJSON geometry object. * * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @return {ol.geom.LineString} Geometry. */ function readLineStringGeometry(object, arcs) { @@ -154,7 +154,7 @@ function readLineStringGeometry(object, arcs) { * Create a multi-linestring from a TopoJSON geometry object. * * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @return {ol.geom.MultiLineString} Geometry. */ function readMultiLineStringGeometry(object, arcs) { @@ -170,7 +170,7 @@ function readMultiLineStringGeometry(object, arcs) { * Create a polygon from a TopoJSON geometry object. * * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @return {ol.geom.Polygon} Geometry. */ function readPolygonGeometry(object, arcs) { @@ -186,7 +186,7 @@ function readPolygonGeometry(object, arcs) { * Create a multi-polygon from a TopoJSON geometry object. * * @param {TopoJSONGeometry} object TopoJSON object. - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @return {ol.geom.MultiPolygon} Geometry. */ function readMultiPolygonGeometry(object, arcs) { @@ -210,7 +210,7 @@ function readMultiPolygonGeometry(object, arcs) { * * @param {TopoJSONGeometryCollection} collection TopoJSON Geometry * object. - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @param {Array.} scale Scale for each dimension. * @param {Array.} translate Translation for each dimension. * @param {string|undefined} property Property to set the `GeometryCollection`'s parent @@ -234,7 +234,7 @@ function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, * Create a feature from a TopoJSON geometry object. * * @param {TopoJSONGeometry} object TopoJSON geometry object. - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @param {Array.} scale Scale for each dimension. * @param {Array.} translate Translation for each dimension. * @param {string|undefined} property Property to set the `GeometryCollection`'s parent @@ -329,7 +329,7 @@ TopoJSON.prototype.readFeaturesFromObject = function(object, opt_options) { * Apply a linear transform to array of arcs. The provided array of arcs is * modified in place. * - * @param {Array.>} arcs Array of arcs. + * @param {Array.>} arcs Array of arcs. * @param {Array.} scale Scale for each dimension. * @param {Array.} translate Translation for each dimension. */ @@ -343,7 +343,7 @@ function transformArcs(arcs, scale, translate) { /** * Apply a linear transform to an arc. The provided arc is modified in place. * - * @param {Array.} arc Arc. + * @param {Array.} arc Arc. * @param {Array.} scale Scale for each dimension. * @param {Array.} translate Translation for each dimension. */ @@ -365,7 +365,7 @@ function transformArc(arc, scale, translate) { * Apply a linear transform to a vertex. The provided vertex is modified in * place. * - * @param {ol.Coordinate} vertex Vertex. + * @param {module:ol/coordinate~Coordinate} vertex Vertex. * @param {Array.} scale Scale for each dimension. * @param {Array.} translate Translation for each dimension. */ diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 391d0c15df..30dafcbf97 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -143,7 +143,7 @@ WFS.prototype.readFeatures; * @inheritDoc */ WFS.prototype.readFeaturesFromNode = function(node, opt_options) { - const context = /** @type {ol.XmlNodeStackItem} */ ({ + const context = /** @type {module:ol/xml~NodeStackItem} */ ({ 'featureType': this.featureType_, 'featureNS': this.featureNS_ }); @@ -225,7 +225,7 @@ WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const FEATURE_COLLECTION_PARSERS = { 'http://www.opengis.net/gml': { @@ -253,7 +253,7 @@ WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRANSACTION_SUMMARY_PARSERS = { 'http://www.opengis.net/wfs': { @@ -277,7 +277,7 @@ function readTransactionSummary(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const OGC_FID_PARSERS = { 'http://www.opengis.net/ogc': { @@ -299,7 +299,7 @@ function fidParser(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const INSERT_RESULTS_PARSERS = { 'http://www.opengis.net/wfs': { @@ -321,7 +321,7 @@ function readInsertResults(node, objectStack) { /** * @const - * @type {Object.>} + * @type {Object.>} */ const TRANSACTION_RESPONSE_PARSERS = { 'http://www.opengis.net/wfs': { @@ -359,7 +359,7 @@ WFS.prototype.readTransactionResponseFromNode = function(node) { /** - * @type {Object.>} + * @type {Object.>} */ const QUERY_SERIALIZERS = { 'http://www.opengis.net/wfs': { @@ -441,7 +441,7 @@ function writeDelete(node, feature, objectStack) { /** - * @type {Object.>} + * @type {Object.>} */ const TRANSACTION_SERIALIZERS = { 'http://www.opengis.net/wfs': { @@ -483,7 +483,7 @@ function writeUpdate(node, feature, objectStack) { values.push({name: name, value: value}); } } - pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ( + pushSerializeAndPop(/** @type {module:ol/xml~NodeStackItem} */ ( {'gmlVersion': context['gmlVersion'], node: node, 'hasZ': context['hasZ'], 'srsName': context['srsName']}), TRANSACTION_SERIALIZERS, @@ -543,7 +543,7 @@ function writeNative(node, nativeElement, objectStack) { /** - * @type {Object.>} + * @type {Object.>} */ const GETFEATURE_SERIALIZERS = { 'http://www.opengis.net/wfs': { @@ -596,7 +596,7 @@ function writeQuery(node, featureType, objectStack) { if (featureNS) { setAttributeNS(node, XMLNS, 'xmlns:' + featurePrefix, featureNS); } - const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context)); + const item = /** @type {module:ol/xml~NodeStackItem} */ (assign({}, context)); item.node = node; pushSerializeAndPop(item, QUERY_SERIALIZERS, @@ -617,7 +617,7 @@ function writeQuery(node, featureType, objectStack) { * @param {Array.<*>} objectStack Node stack. */ function writeFilterCondition(node, filter, objectStack) { - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const item = {node: node}; pushSerializeAndPop(item, GETFEATURE_SERIALIZERS, @@ -713,7 +713,7 @@ function writeDuringFilter(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. */ function writeLogicalFilter(node, filter, objectStack) { - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const item = {node: node}; const conditions = filter.conditions; for (let i = 0, ii = conditions.length; i < ii; ++i) { @@ -732,7 +732,7 @@ function writeLogicalFilter(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. */ function writeNotFilter(node, filter, objectStack) { - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const item = {node: node}; const condition = filter.condition; pushSerializeAndPop(item, @@ -866,7 +866,7 @@ export function writeFilter(filter) { */ function writeGetFeature(node, featureTypes, objectStack) { const context = /** @type {Object} */ (objectStack[objectStack.length - 1]); - const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context)); + const item = /** @type {module:ol/xml~NodeStackItem} */ (assign({}, context)); item.node = node; pushSerializeAndPop(item, GETFEATURE_SERIALIZERS, @@ -922,7 +922,7 @@ WFS.prototype.writeGetFeature = function(options) { } setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', this.schemaLocation_); - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ const context = { node: node, 'srsName': options.srsName, @@ -957,7 +957,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes, options) { node.setAttribute('service', 'WFS'); node.setAttribute('version', version); let baseObj; - /** @type {ol.XmlNodeStackItem} */ + /** @type {module:ol/xml~NodeStackItem} */ let obj; if (options) { baseObj = options.gmlOptions ? options.gmlOptions : {}; diff --git a/src/ol/format/WMSCapabilities.js b/src/ol/format/WMSCapabilities.js index 0b9fcfccd1..9712dd1469 100644 --- a/src/ol/format/WMSCapabilities.js +++ b/src/ol/format/WMSCapabilities.js @@ -42,7 +42,7 @@ const NAMESPACE_URIS = [ /** * @const - * @type {Object.>} + * @type {Object.>} */ const PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -53,7 +53,7 @@ const PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CAPABILITY_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -65,7 +65,7 @@ const CAPABILITY_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const SERVICE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -85,7 +85,7 @@ const SERVICE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CONTACT_INFORMATION_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -100,7 +100,7 @@ const CONTACT_INFORMATION_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CONTACT_PERSON_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -111,7 +111,7 @@ const CONTACT_PERSON_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CONTACT_ADDRESS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -126,7 +126,7 @@ const CONTACT_ADDRESS_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const EXCEPTION_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -136,7 +136,7 @@ const EXCEPTION_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const LAYER_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -163,7 +163,7 @@ const LAYER_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const ATTRIBUTION_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -175,7 +175,7 @@ const ATTRIBUTION_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS = makeStructureNS(NAMESPACE_URIS, { @@ -188,7 +188,7 @@ const EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS = /** * @const - * @type {Object.>} + * @type {Object.>} */ const REQUEST_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -200,7 +200,7 @@ const REQUEST_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const OPERATIONTYPE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -211,7 +211,7 @@ const OPERATIONTYPE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const DCPTYPE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -221,7 +221,7 @@ const DCPTYPE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const HTTP_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -232,7 +232,7 @@ const HTTP_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -247,7 +247,7 @@ const STYLE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const FORMAT_ONLINERESOURCE_PARSERS = makeStructureNS(NAMESPACE_URIS, { @@ -258,7 +258,7 @@ const FORMAT_ONLINERESOURCE_PARSERS = /** * @const - * @type {Object.>} + * @type {Object.>} */ const KEYWORDLIST_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -341,7 +341,7 @@ function readBoundingBox(node, objectStack) { /** * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. - * @return {ol.Extent|undefined} Bounding box object. + * @return {module:ol/extent~Extent|undefined} Bounding box object. */ function readEXGeographicBoundingBox(node, objectStack) { const geographicBoundingBox = pushParseAndPop( diff --git a/src/ol/format/WMTSCapabilities.js b/src/ol/format/WMTSCapabilities.js index af8d0f86fa..c402a2b94c 100644 --- a/src/ol/format/WMTSCapabilities.js +++ b/src/ol/format/WMTSCapabilities.js @@ -53,7 +53,7 @@ const OWS_NAMESPACE_URIS = [ /** * @const - * @type {Object.>} + * @type {Object.>} */ const PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -63,7 +63,7 @@ const PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const CONTENTS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -74,7 +74,7 @@ const CONTENTS_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const LAYER_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -93,7 +93,7 @@ const LAYER_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const STYLE_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -106,7 +106,7 @@ const STYLE_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TMS_LINKS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -116,7 +116,7 @@ const TMS_LINKS_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TMS_LIMITS_LIST_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -126,7 +126,7 @@ const TMS_LIMITS_LIST_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TMS_LIMITS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -140,7 +140,7 @@ const TMS_LIMITS_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const DIMENSION_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -153,7 +153,7 @@ const DIMENSION_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const WGS84_BBOX_READERS = makeStructureNS( OWS_NAMESPACE_URIS, { @@ -164,7 +164,7 @@ const WGS84_BBOX_READERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TMS_PARSERS = makeStructureNS( NAMESPACE_URIS, { @@ -178,7 +178,7 @@ const TMS_PARSERS = makeStructureNS( /** * @const - * @type {Object.>} + * @type {Object.>} */ const TM_PARSERS = makeStructureNS( NAMESPACE_URIS, { diff --git a/src/ol/format/filter.js b/src/ol/format/filter.js index 125496b55c..cfd5b208df 100644 --- a/src/ol/format/filter.js +++ b/src/ol/format/filter.js @@ -63,7 +63,7 @@ export function not(condition) { * intersects a fixed bounding box * * @param {!string} geometryName Geometry name to use. - * @param {!ol.Extent} extent Extent. + * @param {!module:ol/extent~Extent} extent Extent. * @param {string=} opt_srsName SRS name. No srsName attribute will be * set on geometries when this is not provided. * @returns {!ol.format.filter.Bbox} `` operator. diff --git a/src/ol/format/filter/Bbox.js b/src/ol/format/filter/Bbox.js index cece19978c..49f66dccd6 100644 --- a/src/ol/format/filter/Bbox.js +++ b/src/ol/format/filter/Bbox.js @@ -11,7 +11,7 @@ import Filter from '../filter/Filter.js'; * * @constructor * @param {!string} geometryName Geometry name to use. - * @param {!ol.Extent} extent Extent. + * @param {!module:ol/extent~Extent} extent Extent. * @param {string=} opt_srsName SRS name. No srsName attribute will be * set on geometries when this is not provided. * @extends {ol.format.filter.Filter} @@ -29,7 +29,7 @@ const Bbox = function(geometryName, extent, opt_srsName) { /** * @public - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent = extent; diff --git a/src/ol/geom/Circle.js b/src/ol/geom/Circle.js index 4a4fd062f1..3226383f9c 100644 --- a/src/ol/geom/Circle.js +++ b/src/ol/geom/Circle.js @@ -14,7 +14,7 @@ import {deflateCoordinate} from '../geom/flat/deflate.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number=} opt_radius Radius. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api @@ -82,8 +82,8 @@ Circle.prototype.containsXY = function(x, y) { /** - * Return the center of the circle as {@link ol.Coordinate coordinate}. - * @return {ol.Coordinate} Center. + * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}. + * @return {module:ol/coordinate~Coordinate} Center. * @api */ Circle.prototype.getCenter = function() { @@ -158,8 +158,8 @@ Circle.prototype.intersectsExtent = function(extent) { /** - * Set the center of the circle as {@link ol.Coordinate coordinate}. - * @param {ol.Coordinate} center Center. + * Set the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}. + * @param {module:ol/coordinate~Coordinate} center Center. * @api */ Circle.prototype.setCenter = function(center) { @@ -175,9 +175,9 @@ Circle.prototype.setCenter = function(center) { /** - * Set the center (as {@link ol.Coordinate coordinate}) and the radius (as + * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as * number) of the circle. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} radius Radius. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api @@ -250,9 +250,9 @@ Circle.prototype.setRadius = function(radius) { * correspond to the shape that would be obtained by transforming every point * of the original circle. * - * @param {ol.ProjectionLike} source The current projection. Can be a + * @param {module:ol/proj~ProjectionLike} source The current projection. Can be a * string identifier or a {@link ol.proj.Projection} object. - * @param {ol.ProjectionLike} destination The desired projection. Can be a + * @param {module:ol/proj~ProjectionLike} destination The desired projection. Can be a * string identifier or a {@link ol.proj.Projection} object. * @return {ol.geom.Circle} This geometry. Note that original geometry is * modified in place. diff --git a/src/ol/geom/Geometry.js b/src/ol/geom/Geometry.js index 7dcec4dcd4..7c7d7b01ad 100644 --- a/src/ol/geom/Geometry.js +++ b/src/ol/geom/Geometry.js @@ -30,7 +30,7 @@ const Geometry = function() { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = createEmpty(); @@ -60,7 +60,7 @@ const Geometry = function() { /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.tmpTransform_ = createTransform(); @@ -81,7 +81,7 @@ Geometry.prototype.clone = function() {}; * @abstract * @param {number} x X. * @param {number} y Y. - * @param {ol.Coordinate} closestPoint Closest point. + * @param {module:ol/coordinate~Coordinate} closestPoint Closest point. * @param {number} minSquaredDistance Minimum squared distance. * @return {number} Minimum squared distance. */ @@ -90,10 +90,10 @@ Geometry.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDista /** * Return the closest point of the geometry to the passed point as - * {@link ol.Coordinate coordinate}. - * @param {ol.Coordinate} point Point. - * @param {ol.Coordinate=} opt_closestPoint Closest point. - * @return {ol.Coordinate} Closest point. + * {@link module:ol/coordinate~Coordinate coordinate}. + * @param {module:ol/coordinate~Coordinate} point Point. + * @param {module:ol/coordinate~Coordinate=} opt_closestPoint Closest point. + * @return {module:ol/coordinate~Coordinate} Closest point. * @api */ Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) { @@ -106,7 +106,7 @@ Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) { /** * Returns true if this geometry includes the specified coordinate. If the * coordinate is on the boundary of the geometry, returns false. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @return {boolean} Contains coordinate. * @api */ @@ -117,9 +117,9 @@ Geometry.prototype.intersectsCoordinate = function(coordinate) { /** * @abstract - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @protected - * @return {ol.Extent} extent Extent. + * @return {module:ol/extent~Extent} extent Extent. */ Geometry.prototype.computeExtent = function(extent) {}; @@ -134,8 +134,8 @@ Geometry.prototype.containsXY = FALSE; /** * Get the extent of the geometry. - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} extent Extent. * @api */ Geometry.prototype.getExtent = function(opt_extent) { @@ -152,7 +152,7 @@ Geometry.prototype.getExtent = function(opt_extent) { * coordinates in place. * @abstract * @param {number} angle Rotation angle in radians. - * @param {ol.Coordinate} anchor The rotation center. + * @param {module:ol/coordinate~Coordinate} anchor The rotation center. * @api */ Geometry.prototype.rotate = function(angle, anchor) {}; @@ -165,7 +165,7 @@ Geometry.prototype.rotate = function(angle, anchor) {}; * @param {number} sx The scaling factor in the x-direction. * @param {number=} opt_sy The scaling factor in the y-direction (defaults to * sx). - * @param {ol.Coordinate=} opt_anchor The scale origin (defaults to the center + * @param {module:ol/coordinate~Coordinate=} opt_anchor The scale origin (defaults to the center * of the geometry extent). * @api */ @@ -214,7 +214,7 @@ Geometry.prototype.getType = function() {}; * If you do not want the geometry modified in place, first `clone()` it and * then use this function on the clone. * @abstract - * @param {ol.TransformFunction} transformFn Transform. + * @param {module:ol/proj~TransformFunction} transformFn Transform. */ Geometry.prototype.applyTransform = function(transformFn) {}; @@ -222,7 +222,7 @@ Geometry.prototype.applyTransform = function(transformFn) {}; /** * Test if the geometry and the passed extent intersect. * @abstract - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} `true` if the geometry and the extent intersect. */ Geometry.prototype.intersectsExtent = function(extent) {}; @@ -245,9 +245,9 @@ Geometry.prototype.translate = function(deltaX, deltaY) {}; * If you do not want the geometry modified in place, first `clone()` it and * then use this function on the clone. * - * @param {ol.ProjectionLike} source The current projection. Can be a + * @param {module:ol/proj~ProjectionLike} source The current projection. Can be a * string identifier or a {@link ol.proj.Projection} object. - * @param {ol.ProjectionLike} destination The desired projection. Can be a + * @param {module:ol/proj~ProjectionLike} destination The desired projection. Can be a * string identifier or a {@link ol.proj.Projection} object. * @return {ol.geom.Geometry} This geometry. Note that original geometry is * modified in place. diff --git a/src/ol/geom/LineString.js b/src/ol/geom/LineString.js index 18d5c5ac2d..788d6398d1 100644 --- a/src/ol/geom/LineString.js +++ b/src/ol/geom/LineString.js @@ -22,7 +22,7 @@ import {douglasPeucker} from '../geom/flat/simplify.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api */ @@ -32,7 +32,7 @@ const LineString = function(coordinates, opt_layout) { /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.flatMidpoint_ = null; @@ -63,7 +63,7 @@ inherits(LineString, SimpleGeometry); /** * Append the passed coordinate to the coordinates of the linestring. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @api */ LineString.prototype.appendCoordinate = function(coordinate) { @@ -112,7 +112,7 @@ LineString.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDis * If the callback returns a truthy value the function returns that * value immediately. Otherwise the function returns `false`. * - * @param {function(this: S, ol.Coordinate, ol.Coordinate): T} callback Function + * @param {function(this: S, module:ol/coordinate~Coordinate, module:ol/coordinate~Coordinate): T} callback Function * called for each segment. * @return {T|boolean} Value. * @template T,S @@ -134,7 +134,7 @@ LineString.prototype.forEachSegment = function(callback) { * * @param {number} m M. * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. * @api */ LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) { @@ -150,7 +150,7 @@ LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) { /** * Return the coordinates of the linestring. - * @return {Array.} Coordinates. + * @return {Array.} Coordinates. * @override * @api */ @@ -165,9 +165,9 @@ LineString.prototype.getCoordinates = function() { * The `fraction` is a number between 0 and 1, where 0 is the start of the * linestring and 1 is the end. * @param {number} fraction Fraction. - * @param {ol.Coordinate=} opt_dest Optional coordinate whose values will + * @param {module:ol/coordinate~Coordinate=} opt_dest Optional coordinate whose values will * be modified. If not provided, a new coordinate will be returned. - * @return {ol.Coordinate} Coordinate of the interpolated point. + * @return {module:ol/coordinate~Coordinate} Coordinate of the interpolated point. * @api */ LineString.prototype.getCoordinateAt = function(fraction, opt_dest) { @@ -237,7 +237,7 @@ LineString.prototype.intersectsExtent = function(extent) { /** * Set the coordinates of the linestring. - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @override * @api diff --git a/src/ol/geom/LinearRing.js b/src/ol/geom/LinearRing.js index 00c2b8911f..e45385ecd0 100644 --- a/src/ol/geom/LinearRing.js +++ b/src/ol/geom/LinearRing.js @@ -19,7 +19,7 @@ import {douglasPeucker} from '../geom/flat/simplify.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api */ @@ -89,7 +89,7 @@ LinearRing.prototype.getArea = function() { /** * Return the coordinates of the linear ring. - * @return {Array.} Coordinates. + * @return {Array.} Coordinates. * @override * @api */ @@ -131,7 +131,7 @@ LinearRing.prototype.intersectsExtent = function(extent) {}; /** * Set the coordinates of the linear ring. - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @override * @api diff --git a/src/ol/geom/MultiLineString.js b/src/ol/geom/MultiLineString.js index 93bacc6f60..11eaab946a 100644 --- a/src/ol/geom/MultiLineString.js +++ b/src/ol/geom/MultiLineString.js @@ -21,7 +21,7 @@ import {douglasPeuckerArray} from '../geom/flat/simplify.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {Array.>} coordinates Coordinates. + * @param {Array.>} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api */ @@ -121,7 +121,7 @@ MultiLineString.prototype.closestPointXY = function(x, y, closestPoint, minSquar * @param {number} m M. * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`. * @param {boolean=} opt_interpolate Interpolate. Default is `false`. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. * @api */ MultiLineString.prototype.getCoordinateAtM = function(m, opt_extrapolate, opt_interpolate) { @@ -139,7 +139,7 @@ MultiLineString.prototype.getCoordinateAtM = function(m, opt_extrapolate, opt_in /** * Return the coordinates of the multilinestring. - * @return {Array.>} Coordinates. + * @return {Array.>} Coordinates. * @override * @api */ @@ -254,7 +254,7 @@ MultiLineString.prototype.intersectsExtent = function(extent) { /** * Set the coordinates of the multilinestring. - * @param {Array.>} coordinates Coordinates. + * @param {Array.>} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @override * @api diff --git a/src/ol/geom/MultiPoint.js b/src/ol/geom/MultiPoint.js index e2b0f9ae5a..b1ec998c03 100644 --- a/src/ol/geom/MultiPoint.js +++ b/src/ol/geom/MultiPoint.js @@ -18,7 +18,7 @@ import {squaredDistance as squaredDx} from '../math.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api */ @@ -84,7 +84,7 @@ MultiPoint.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDis /** * Return the coordinates of the multipoint. - * @return {Array.} Coordinates. + * @return {Array.} Coordinates. * @override * @api */ @@ -161,7 +161,7 @@ MultiPoint.prototype.intersectsExtent = function(extent) { /** * Set the coordinates of the multipoint. - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @override * @api diff --git a/src/ol/geom/MultiPolygon.js b/src/ol/geom/MultiPolygon.js index 0a165505ec..4292dd3043 100644 --- a/src/ol/geom/MultiPolygon.js +++ b/src/ol/geom/MultiPolygon.js @@ -26,7 +26,7 @@ import {quantizeMultiArray} from '../geom/flat/simplify.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {Array.>>} coordinates Coordinates. + * @param {Array.>>} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api */ @@ -175,7 +175,7 @@ MultiPolygon.prototype.getArea = function() { * (clockwise for exterior and counter-clockwise for interior rings). * By default, coordinate orientation will depend on how the geometry was * constructed. - * @return {Array.>>} Coordinates. + * @return {Array.>>} Coordinates. * @override * @api */ @@ -351,7 +351,7 @@ MultiPolygon.prototype.intersectsExtent = function(extent) { /** * Set the coordinates of the multipolygon. - * @param {Array.>>} coordinates Coordinates. + * @param {Array.>>} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @override * @api diff --git a/src/ol/geom/Point.js b/src/ol/geom/Point.js index 9d30635bc7..43157382cd 100644 --- a/src/ol/geom/Point.js +++ b/src/ol/geom/Point.js @@ -15,7 +15,7 @@ import {squaredDistance as squaredDx} from '../math.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {ol.Coordinate} coordinates Coordinates. + * @param {module:ol/coordinate~Coordinate} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @api */ @@ -61,7 +61,7 @@ Point.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance /** * Return the coordinate of the point. - * @return {ol.Coordinate} Coordinates. + * @return {module:ol/coordinate~Coordinate} Coordinates. * @override * @api */ diff --git a/src/ol/geom/Polygon.js b/src/ol/geom/Polygon.js index 50e7dfccc0..0c47af1cff 100644 --- a/src/ol/geom/Polygon.js +++ b/src/ol/geom/Polygon.js @@ -27,7 +27,7 @@ import {modulo} from '../math.js'; * * @constructor * @extends {ol.geom.SimpleGeometry} - * @param {Array.>} coordinates Array of linear + * @param {Array.>} coordinates Array of linear * rings that define the polygon. The first linear ring of the array * defines the outer-boundary or surface of the polygon. Each subsequent * linear ring defines a hole in the surface of the polygon. A linear ring @@ -54,7 +54,7 @@ const Polygon = function(coordinates, opt_layout) { /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.flatInteriorPoint_ = null; @@ -165,7 +165,7 @@ Polygon.prototype.getArea = function() { * (clockwise for exterior and counter-clockwise for interior rings). * By default, coordinate orientation will depend on how the geometry was * constructed. - * @return {Array.>} Coordinates. + * @return {Array.>} Coordinates. * @override * @api */ @@ -332,7 +332,7 @@ Polygon.prototype.intersectsExtent = function(extent) { /** * Set the coordinates of the polygon. - * @param {Array.>} coordinates Coordinates. + * @param {Array.>} coordinates Coordinates. * @param {ol.geom.GeometryLayout=} opt_layout Layout. * @override * @api @@ -369,7 +369,7 @@ export default Polygon; /** * Create an approximation of a circle on the surface of a sphere. - * @param {ol.Coordinate} center Center (`[lon, lat]` in degrees). + * @param {module:ol/coordinate~Coordinate} center Center (`[lon, lat]` in degrees). * @param {number} radius The great-circle distance from the center to * the polygon vertices. * @param {number=} opt_n Optional number of vertices for the resulting @@ -395,7 +395,7 @@ export function circular(center, radius, opt_n, opt_sphereRadius) { /** * Create a polygon from an extent. The layout used is `XY`. - * @param {ol.Extent} extent The extent. + * @param {module:ol/extent~Extent} extent The extent. * @return {ol.geom.Polygon} The polygon. * @api */ @@ -442,7 +442,7 @@ export function fromCircle(circle, opt_sides, opt_angle) { /** * Modify the coordinates of a polygon to make it a regular polygon. * @param {ol.geom.Polygon} polygon Polygon geometry. - * @param {ol.Coordinate} center Center of the regular polygon. + * @param {module:ol/coordinate~Coordinate} center Center of the regular polygon. * @param {number} radius Radius of the regular polygon. * @param {number=} opt_angle Start angle for the first vertex of the polygon in * radians. Default is 0. diff --git a/src/ol/geom/SimpleGeometry.js b/src/ol/geom/SimpleGeometry.js index 097a2cee61..ff65a197dd 100644 --- a/src/ol/geom/SimpleGeometry.js +++ b/src/ol/geom/SimpleGeometry.js @@ -104,7 +104,7 @@ SimpleGeometry.prototype.getCoordinates = function() {}; /** * Return the first coordinate of the geometry. - * @return {ol.Coordinate} First coordinate. + * @return {module:ol/coordinate~Coordinate} First coordinate. * @api */ SimpleGeometry.prototype.getFirstCoordinate = function() { @@ -122,7 +122,7 @@ SimpleGeometry.prototype.getFlatCoordinates = function() { /** * Return the last coordinate of the geometry. - * @return {ol.Coordinate} Last point. + * @return {module:ol/coordinate~Coordinate} Last point. * @api */ SimpleGeometry.prototype.getLastCoordinate = function() { @@ -317,7 +317,7 @@ SimpleGeometry.prototype.translate = function(deltaX, deltaY) { /** * @param {ol.geom.SimpleGeometry} simpleGeometry Simple geometry. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @param {Array.=} opt_dest Destination. * @return {Array.} Transformed flat coordinates. */ diff --git a/src/ol/geom/flat/contains.js b/src/ol/geom/flat/contains.js index acc843e992..176a1ed23a 100644 --- a/src/ol/geom/flat/contains.js +++ b/src/ol/geom/flat/contains.js @@ -9,13 +9,13 @@ import {forEachCorner} from '../../extent.js'; * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} Contains extent. */ export function linearRingContainsExtent(flatCoordinates, offset, end, stride, extent) { const outside = forEachCorner(extent, /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @return {boolean} Contains (x, y). */ function(coordinate) { diff --git a/src/ol/geom/flat/deflate.js b/src/ol/geom/flat/deflate.js index 1295c16a71..ccc78d5f49 100644 --- a/src/ol/geom/flat/deflate.js +++ b/src/ol/geom/flat/deflate.js @@ -6,7 +6,7 @@ /** * @param {Array.} flatCoordinates Flat coordinates. * @param {number} offset Offset. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} stride Stride. * @return {number} offset Offset. */ @@ -21,7 +21,7 @@ export function deflateCoordinate(flatCoordinates, offset, coordinate, stride) { /** * @param {Array.} flatCoordinates Flat coordinates. * @param {number} offset Offset. - * @param {Array.} coordinates Coordinates. + * @param {Array.} coordinates Coordinates. * @param {number} stride Stride. * @return {number} offset Offset. */ @@ -39,7 +39,7 @@ export function deflateCoordinates(flatCoordinates, offset, coordinates, stride) /** * @param {Array.} flatCoordinates Flat coordinates. * @param {number} offset Offset. - * @param {Array.>} coordinatess Coordinatess. + * @param {Array.>} coordinatess Coordinatess. * @param {number} stride Stride. * @param {Array.=} opt_ends Ends. * @return {Array.} Ends. @@ -61,7 +61,7 @@ export function deflateCoordinatesArray(flatCoordinates, offset, coordinatess, s /** * @param {Array.} flatCoordinates Flat coordinates. * @param {number} offset Offset. - * @param {Array.>>} coordinatesss Coordinatesss. + * @param {Array.>>} coordinatesss Coordinatesss. * @param {number} stride Stride. * @param {Array.>=} opt_endss Endss. * @return {Array.>} Endss. diff --git a/src/ol/geom/flat/geodesic.js b/src/ol/geom/flat/geodesic.js index 9a76ffa784..0069a54a3c 100644 --- a/src/ol/geom/flat/geodesic.js +++ b/src/ol/geom/flat/geodesic.js @@ -6,8 +6,8 @@ import {get as getProjection, getTransform} from '../../proj.js'; /** - * @param {function(number): ol.Coordinate} interpolate Interpolate function. - * @param {ol.TransformFunction} transform Transform from longitude/latitude to + * @param {function(number): module:ol/coordinate~Coordinate} interpolate Interpolate function. + * @param {module:ol/proj~TransformFunction} transform Transform from longitude/latitude to * projected coordinates. * @param {number} squaredTolerance Squared tolerance. * @return {Array.} Flat coordinates. @@ -25,9 +25,9 @@ function line(interpolate, transform, squaredTolerance) { let a = transform(geoA); let b = transform(geoB); - /** @type {Array.} */ + /** @type {Array.} */ const geoStack = [geoB, geoA]; - /** @type {Array.} */ + /** @type {Array.} */ const stack = [b, a]; /** @type {Array.} */ const fractionStack = [1, 0]; @@ -102,7 +102,7 @@ export function greatCircleArc(lon1, lat1, lon2, lat2, projection, squaredTolera return line( /** * @param {number} frac Fraction. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. */ function(frac) { if (1 <= d) { @@ -137,7 +137,7 @@ export function meridian(lon, lat1, lat2, projection, squaredTolerance) { return line( /** * @param {number} frac Fraction. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. */ function(frac) { return [lon, lat1 + ((lat2 - lat1) * frac)]; @@ -160,7 +160,7 @@ export function parallel(lat, lon1, lon2, projection, squaredTolerance) { return line( /** * @param {number} frac Fraction. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. */ function(frac) { return [lon1 + ((lon2 - lon1) * frac), lat]; diff --git a/src/ol/geom/flat/inflate.js b/src/ol/geom/flat/inflate.js index fd7c2ba002..f79f5b54f6 100644 --- a/src/ol/geom/flat/inflate.js +++ b/src/ol/geom/flat/inflate.js @@ -8,8 +8,8 @@ * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {Array.=} opt_coordinates Coordinates. - * @return {Array.} Coordinates. + * @param {Array.=} opt_coordinates Coordinates. + * @return {Array.} Coordinates. */ export function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) { const coordinates = opt_coordinates !== undefined ? opt_coordinates : []; @@ -27,8 +27,8 @@ export function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coo * @param {number} offset Offset. * @param {Array.} ends Ends. * @param {number} stride Stride. - * @param {Array.>=} opt_coordinatess Coordinatess. - * @return {Array.>} Coordinatess. + * @param {Array.>=} opt_coordinatess Coordinatess. + * @return {Array.>} Coordinatess. */ export function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) { const coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : []; @@ -49,9 +49,9 @@ export function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, o * @param {number} offset Offset. * @param {Array.>} endss Endss. * @param {number} stride Stride. - * @param {Array.>>=} opt_coordinatesss + * @param {Array.>>=} opt_coordinatesss * Coordinatesss. - * @return {Array.>>} Coordinatesss. + * @return {Array.>>} Coordinatesss. */ export function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) { const coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : []; diff --git a/src/ol/geom/flat/interpolate.js b/src/ol/geom/flat/interpolate.js index 37aa638bc3..444def7683 100644 --- a/src/ol/geom/flat/interpolate.js +++ b/src/ol/geom/flat/interpolate.js @@ -71,7 +71,7 @@ export function interpolatePoint(flatCoordinates, offset, end, stride, fraction, * @param {number} stride Stride. * @param {number} m M. * @param {boolean} extrapolate Extrapolate. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. */ export function lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, extrapolate) { if (end == offset) { @@ -133,7 +133,7 @@ export function lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, * @param {number} m M. * @param {boolean} extrapolate Extrapolate. * @param {boolean} interpolate Interpolate. - * @return {ol.Coordinate} Coordinate. + * @return {module:ol/coordinate~Coordinate} Coordinate. */ export function lineStringsCoordinateAtM( flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) { diff --git a/src/ol/geom/flat/intersectsextent.js b/src/ol/geom/flat/intersectsextent.js index 87bb8ea31b..c8e304971b 100644 --- a/src/ol/geom/flat/intersectsextent.js +++ b/src/ol/geom/flat/intersectsextent.js @@ -11,7 +11,7 @@ import {forEach as forEachSegment} from '../flat/segments.js'; * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} True if the geometry and the extent intersect. */ export function intersectsLineString(flatCoordinates, offset, end, stride, extent) { @@ -33,8 +33,8 @@ export function intersectsLineString(flatCoordinates, offset, end, stride, exten } return forEachSegment(flatCoordinates, offset, end, stride, /** - * @param {ol.Coordinate} point1 Start point. - * @param {ol.Coordinate} point2 End point. + * @param {module:ol/coordinate~Coordinate} point1 Start point. + * @param {module:ol/coordinate~Coordinate} point2 End point. * @return {boolean} `true` if the segment and the extent intersect, * `false` otherwise. */ @@ -49,7 +49,7 @@ export function intersectsLineString(flatCoordinates, offset, end, stride, exten * @param {number} offset Offset. * @param {Array.} ends Ends. * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} True if the geometry and the extent intersect. */ export function intersectsLineStringArray(flatCoordinates, offset, ends, stride, extent) { @@ -69,7 +69,7 @@ export function intersectsLineStringArray(flatCoordinates, offset, ends, stride, * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} True if the geometry and the extent intersect. */ export function intersectsLinearRing(flatCoordinates, offset, end, stride, extent) { @@ -98,7 +98,7 @@ export function intersectsLinearRing(flatCoordinates, offset, end, stride, exten * @param {number} offset Offset. * @param {Array.} ends Ends. * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} True if the geometry and the extent intersect. */ export function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent) { @@ -123,7 +123,7 @@ export function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, * @param {number} offset Offset. * @param {Array.>} endss Endss. * @param {number} stride Stride. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {boolean} True if the geometry and the extent intersect. */ export function intersectsLinearRingMultiArray(flatCoordinates, offset, endss, stride, extent) { diff --git a/src/ol/geom/flat/segments.js b/src/ol/geom/flat/segments.js index c7cb402ced..3db076ef13 100644 --- a/src/ol/geom/flat/segments.js +++ b/src/ol/geom/flat/segments.js @@ -11,7 +11,7 @@ * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {function(this: S, ol.Coordinate, ol.Coordinate): T} callback Function + * @param {function(this: S, module:ol/coordinate~Coordinate, module:ol/coordinate~Coordinate): T} callback Function * called for each segment. * @param {S=} opt_this The object to be used as the value of 'this' * within callback. diff --git a/src/ol/geom/flat/transform.js b/src/ol/geom/flat/transform.js index 8586d45fbf..78c22f3414 100644 --- a/src/ol/geom/flat/transform.js +++ b/src/ol/geom/flat/transform.js @@ -8,7 +8,7 @@ * @param {number} offset Offset. * @param {number} end End. * @param {number} stride Stride. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @param {Array.=} opt_dest Destination. * @return {Array.} Transformed coordinates. */ diff --git a/src/ol/has.jsdoc b/src/ol/has.jsdoc deleted file mode 100644 index ca1dca69ab..0000000000 --- a/src/ol/has.jsdoc +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @namespace ol.has - */ diff --git a/src/ol/index.js b/src/ol/index.js index 5ba16dda4d..2b4531cf42 100644 --- a/src/ol/index.js +++ b/src/ol/index.js @@ -5,6 +5,14 @@ import {getContext} from './webgl.js'; +/** + * An array with two elements, representing a pixel. The first element is the + * x-coordinate, the second the y-coordinate of the pixel. + * @typedef {Array.} Pixel + * @api + */ + + /** * Include debuggable shader sources. Default is `true`. This should be set to * `false` for production builds. diff --git a/src/ol/interaction.js b/src/ol/interaction.js index c328b078cb..b4ea25e409 100644 --- a/src/ol/interaction.js +++ b/src/ol/interaction.js @@ -14,27 +14,51 @@ import PinchRotate from './interaction/PinchRotate.js'; import PinchZoom from './interaction/PinchZoom.js'; +/** + * @typedef {Object} DefaultsOptions + * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is + * desired. + * @property {boolean} [constrainResolution=false] Zoom to the closest integer + * zoom level after the wheel/trackpad or pinch gesture ends. + * @property {boolean} [doubleClickZoom=true] Whether double click zoom is + * desired. + * @property {boolean} [keyboard=true] Whether keyboard interaction is desired. + * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired. + * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired. + * @property {boolean} [dragPan=true] Whether drag pan is desired. + * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired. + * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired. + * @property {number} [zoomDelta] Zoom level delta when using keyboard or + * mousewheel zoom. + * @property {number} [zoomDuration] Duration of the zoom animation in + * milliseconds. + */ + + /** * Set of interactions included in maps by default. Specific interactions can be * excluded by setting the appropriate option to false in the constructor * options, but the order of the interactions is fixed. If you want to specify * a different order for interactions, you will need to create your own - * {@link ol.interaction.Interaction} instances and insert them into a - * {@link ol.Collection} in the order you want before creating your - * {@link ol.Map} instance. The default set of interactions, in sequence, is: - * * {@link ol.interaction.DragRotate} - * * {@link ol.interaction.DoubleClickZoom} - * * {@link ol.interaction.DragPan} - * * {@link ol.interaction.PinchRotate} - * * {@link ol.interaction.PinchZoom} - * * {@link ol.interaction.KeyboardPan} - * * {@link ol.interaction.KeyboardZoom} - * * {@link ol.interaction.MouseWheelZoom} - * * {@link ol.interaction.DragZoom} + * {@link module:ol/interaction/Interaction~Interaction} instances and insert + * them into a {@link module:ol/Collection~Collection} in the order you want + * before creating your {@link module:ol/Map~Map} instance. The default set of + * interactions, in sequence, is: + * * {@link module:ol/interaction/DragRotate~DragRotate} + * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom} + * * {@link module:ol/interaction/DragPan~DragPan} + * * {@link module:ol/interaction/PinchRotate~PinchRotate} + * * {@link module:ol/interaction/PinchZoom~PinchZoom} + * * {@link module:ol/interaction/KeyboardPan~KeyboardPan} + * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} + * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom} + * * {@link module:ol/interaction/DragZoom~DragZoom} * - * @param {olx.interaction.DefaultsOptions=} opt_options Defaults options. - * @return {ol.Collection.} A collection of - * interactions to be used with the ol.Map constructor's interactions option. + * @param {module:ol/interaction/Interaction~DefaultsOptions=} opt_options + * Defaults options. + * @return {module:ol/Collection~Collection.} + * A collection of interactions to be used with the {@link module:ol/Map~Map} + * constructor's `interactions` option. * @api */ export function defaults(opt_options) { diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index 397b03f375..ee20fb4e1a 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -101,7 +101,7 @@ const DragAndDrop = function(opt_options) { /** * @private - * @type {Array.} + * @type {Array.} */ this.dropListenKeys_ = null; diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index 255482a011..3d05e6e923 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -43,7 +43,7 @@ const DragBoxEventType = { * this type. * * @param {string} type The event type. - * @param {ol.Coordinate} coordinate The event coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate The event coordinate. * @param {ol.MapBrowserEvent} mapBrowserEvent Originating event. * @extends {ol.events.Event} * @constructor @@ -55,7 +55,7 @@ const DragBoxEvent = function(type, coordinate, mapBrowserEvent) { /** * The coordinate of the drag event. * @const - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} * @api */ this.coordinate = coordinate; @@ -112,7 +112,7 @@ const DragBox = function(opt_options) { this.minArea_ = options.minArea !== undefined ? options.minArea : 64; /** - * @type {ol.Pixel} + * @type {module:ol~Pixel} * @private */ this.startPixel_ = null; @@ -139,8 +139,8 @@ inherits(DragBox, PointerInteraction); * should fire. * @param {ol.MapBrowserEvent} mapBrowserEvent The originating MapBrowserEvent * leading to the box end. - * @param {ol.Pixel} startPixel The starting pixel of the box. - * @param {ol.Pixel} endPixel The end pixel of the box. + * @param {module:ol~Pixel} startPixel The starting pixel of the box. + * @param {module:ol~Pixel} endPixel The end pixel of the box. * @return {boolean} Whether or not the boxend condition should be fired. * @this {ol.interaction.DragBox} */ diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 6bbb073f9f..3252c9fe44 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -35,7 +35,7 @@ const DragPan = function(opt_options) { this.kinetic_ = options.kinetic; /** - * @type {ol.Pixel} + * @type {module:ol~Pixel} */ this.lastCentroid = null; @@ -106,7 +106,7 @@ function handleUpEvent(mapBrowserEvent) { if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) { const distance = this.kinetic_.getDistance(); const angle = this.kinetic_.getAngle(); - const center = /** @type {!ol.Coordinate} */ (view.getCenter()); + const center = /** @type {!module:ol/coordinate~Coordinate} */ (view.getCenter()); const centerpx = map.getPixelFromCoordinate(center); const dest = map.getCoordinateFromPixel([ centerpx[0] - distance * Math.cos(angle), diff --git a/src/ol/interaction/DragZoom.js b/src/ol/interaction/DragZoom.js index e9d0268fa3..839d892c64 100644 --- a/src/ol/interaction/DragZoom.js +++ b/src/ol/interaction/DragZoom.js @@ -56,7 +56,7 @@ DragZoom.prototype.onBoxEnd = function() { const view = /** @type {!ol.View} */ (map.getView()); - const size = /** @type {!ol.Size} */ (map.getSize()); + const size = /** @type {!module:ol/size~Size} */ (map.getSize()); let extent = this.getGeometry().getExtent(); diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index 2c136c0028..d38d8a7924 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -113,7 +113,7 @@ const Draw = function(options) { this.shouldHandle_ = false; /** - * @type {ol.Pixel} + * @type {module:ol~Pixel} * @private */ this.downPx_ = null; @@ -209,7 +209,7 @@ const Draw = function(options) { if (!geometryFunction) { if (this.type_ === GeometryType.CIRCLE) { /** - * @param {!Array.} coordinates + * @param {!Array.} coordinates * The coordinates. * @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry. * @return {ol.geom.SimpleGeometry} A geometry. @@ -233,7 +233,7 @@ const Draw = function(options) { Constructor = Polygon; } /** - * @param {!Array.} coordinates + * @param {!Array.} coordinates * The coordinates. * @param {ol.geom.SimpleGeometry=} opt_geometry Optional geometry. * @return {ol.geom.SimpleGeometry} A geometry. @@ -274,7 +274,7 @@ const Draw = function(options) { /** * Finish coordinate for the feature (first point for polygons, last point for * linestrings). - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} * @private */ this.finishCoordinate_ = null; @@ -295,7 +295,7 @@ const Draw = function(options) { /** * Sketch coordinates. Used when drawing a line or polygon. - * @type {ol.Coordinate|Array.|Array.>} + * @type {module:ol/coordinate~Coordinate|Array.|Array.>} * @private */ this.sketchCoords_ = null; @@ -309,7 +309,7 @@ const Draw = function(options) { /** * Sketch line coordinates. Used when drawing a polygon or circle. - * @type {Array.} + * @type {Array.} * @private */ this.sketchLineCoords_ = null; @@ -374,7 +374,7 @@ inherits(Draw, PointerInteraction); /** - * @return {ol.StyleFunction} Styles. + * @return {module:ol/style~StyleFunction} Styles. */ function getDefaultStyleFunction() { const styles = createEditingStyle(); @@ -662,7 +662,7 @@ Draw.prototype.modifyDrawing_ = function(event) { } last[0] = coordinate[0]; last[1] = coordinate[1]; - this.geometryFunction_(/** @type {!Array.} */ (this.sketchCoords_), geometry); + this.geometryFunction_(/** @type {!Array.} */ (this.sketchCoords_), geometry); if (this.sketchPoint_) { const sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry()); sketchPointGeom.setCoordinates(coordinate); diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 7acb7bbc06..3e727c467b 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -25,7 +25,7 @@ import {createEditingStyle} from '../style/Style.js'; * * @constructor * @implements {oli.ExtentEvent} - * @param {ol.Extent} extent the new extent + * @param {module:ol/extent~Extent} extent the new extent * @extends {ol.events.Event} */ const ExtentInteractionEvent = function(extent) { @@ -33,7 +33,7 @@ const ExtentInteractionEvent = function(extent) { /** * The current extent. - * @type {ol.Extent} + * @type {module:ol/extent~Extent} * @api */ this.extent = extent; @@ -60,14 +60,14 @@ const ExtentInteraction = function(opt_options) { /** * Extent of the drawn box - * @type {ol.Extent} + * @type {module:ol/extent~Extent} * @private */ this.extent_ = null; /** * Handler for pointer move events - * @type {function (ol.Coordinate): ol.Extent|null} + * @type {function (module:ol/coordinate~Coordinate): module:ol/extent~Extent|null} * @private */ this.pointerHandler_ = null; @@ -260,7 +260,7 @@ function handleUpEvent(mapBrowserEvent) { /** * Returns the default style for the drawn bbox * - * @return {ol.StyleFunction} Default Extent style + * @return {module:ol/style~StyleFunction} Default Extent style */ function getDefaultExtentStyleFunction() { const style = createEditingStyle(); @@ -272,7 +272,7 @@ function getDefaultExtentStyleFunction() { /** * Returns the default style for the pointer * - * @return {ol.StyleFunction} Default pointer style + * @return {module:ol/style~StyleFunction} Default pointer style */ function getDefaultPointerStyleFunction() { const style = createEditingStyle(); @@ -282,8 +282,8 @@ function getDefaultPointerStyleFunction() { } /** - * @param {ol.Coordinate} fixedPoint corner that will be unchanged in the new extent - * @returns {function (ol.Coordinate): ol.Extent} event handler + * @param {module:ol/coordinate~Coordinate} fixedPoint corner that will be unchanged in the new extent + * @returns {function (module:ol/coordinate~Coordinate): module:ol/extent~Extent} event handler */ function getPointHandler(fixedPoint) { return function(point) { @@ -292,9 +292,9 @@ function getPointHandler(fixedPoint) { } /** - * @param {ol.Coordinate} fixedP1 first corner that will be unchanged in the new extent - * @param {ol.Coordinate} fixedP2 second corner that will be unchanged in the new extent - * @returns {function (ol.Coordinate): ol.Extent|null} event handler + * @param {module:ol/coordinate~Coordinate} fixedP1 first corner that will be unchanged in the new extent + * @param {module:ol/coordinate~Coordinate} fixedP2 second corner that will be unchanged in the new extent + * @returns {function (module:ol/coordinate~Coordinate): module:ol/extent~Extent|null} event handler */ function getEdgeHandler(fixedP1, fixedP2) { if (fixedP1[0] == fixedP2[0]) { @@ -311,8 +311,8 @@ function getEdgeHandler(fixedP1, fixedP2) { } /** - * @param {ol.Extent} extent extent - * @returns {Array>} extent line segments + * @param {module:ol/extent~Extent} extent extent + * @returns {Array>} extent line segments */ function getSegments(extent) { return [ @@ -324,9 +324,9 @@ function getSegments(extent) { } /** - * @param {ol.Pixel} pixel cursor location + * @param {module:ol~Pixel} pixel cursor location * @param {ol.PluggableMap} map map - * @returns {ol.Coordinate|null} snapped vertex on extent + * @returns {module:ol/coordinate~Coordinate|null} snapped vertex on extent * @private */ ExtentInteraction.prototype.snapToVertex_ = function(pixel, map) { @@ -381,7 +381,7 @@ ExtentInteraction.prototype.handlePointerMove_ = function(mapBrowserEvent) { }; /** - * @param {ol.Extent} extent extent + * @param {module:ol/extent~Extent} extent extent * @returns {ol.Feature} extent as featrue * @private */ @@ -408,7 +408,7 @@ ExtentInteraction.prototype.createOrUpdateExtentFeature_ = function(extent) { /** - * @param {ol.Coordinate} vertex location of feature + * @param {module:ol/coordinate~Coordinate} vertex location of feature * @returns {ol.Feature} vertex as feature * @private */ @@ -438,7 +438,7 @@ ExtentInteraction.prototype.setMap = function(map) { /** * Returns the current drawn extent in the view projection * - * @return {ol.Extent} Drawn extent in the view projection. + * @return {module:ol/extent~Extent} Drawn extent in the view projection. * @api */ ExtentInteraction.prototype.getExtent = function() { @@ -448,7 +448,7 @@ ExtentInteraction.prototype.getExtent = function() { /** * Manually sets the drawn extent, using the view projection. * - * @param {ol.Extent} extent Extent + * @param {module:ol/extent~Extent} extent Extent * @api */ ExtentInteraction.prototype.setExtent = function(extent) { diff --git a/src/ol/interaction/Interaction.js b/src/ol/interaction/Interaction.js index 4616ce95aa..61b756568b 100644 --- a/src/ol/interaction/Interaction.js +++ b/src/ol/interaction/Interaction.js @@ -103,7 +103,7 @@ Interaction.prototype.setMap = function(map) { /** * @param {module:ol/View~View} view View. - * @param {module:ol/types~Coordinate} delta Delta. + * @param {module:ol/coordinate~Coordinate} delta Delta. * @param {number=} opt_duration Duration. */ export function pan(view, delta, opt_duration) { @@ -127,7 +127,7 @@ export function pan(view, delta, opt_duration) { /** * @param {module:ol/View~View} view View. * @param {number|undefined} rotation Rotation. - * @param {module:ol/types~Coordinate=} opt_anchor Anchor coordinate. + * @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ export function rotate(view, rotation, opt_anchor, opt_duration) { @@ -139,7 +139,7 @@ export function rotate(view, rotation, opt_anchor, opt_duration) { /** * @param {module:ol/View~View} view View. * @param {number|undefined} rotation Rotation. - * @param {module:ol/types~Coordinate=} opt_anchor Anchor coordinate. + * @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ export function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duration) { @@ -163,7 +163,7 @@ export function rotateWithoutConstraints(view, rotation, opt_anchor, opt_duratio /** * @param {module:ol/View~View} view View. * @param {number|undefined} resolution Resolution to go to. - * @param {module:ol/types~Coordinate=} opt_anchor Anchor coordinate. + * @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. * @param {number=} opt_direction Zooming direction; > 0 indicates * zooming out, in which case the constraints system will select @@ -183,7 +183,7 @@ export function zoom(view, resolution, opt_anchor, opt_duration, opt_direction) /** * @param {module:ol/View~View} view View. * @param {number} delta Delta from previous zoom level. - * @param {module:ol/types~Coordinate=} opt_anchor Anchor coordinate. + * @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ export function zoomByDelta(view, delta, opt_anchor, opt_duration) { @@ -221,7 +221,7 @@ export function zoomByDelta(view, delta, opt_anchor, opt_duration) { /** * @param {module:ol/View~View} view View. * @param {number|undefined} resolution Resolution to go to. - * @param {module:ol/types~Coordinate=} opt_anchor Anchor coordinate. + * @param {module:ol/coordinate~Coordinate=} opt_anchor Anchor coordinate. * @param {number=} opt_duration Duration. */ export function zoomWithoutConstraints(view, resolution, opt_anchor, opt_duration) { diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 670010660a..173003041b 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -151,7 +151,7 @@ const Modify = function(options) { this.vertexSegments_ = null; /** - * @type {ol.Pixel} + * @type {module:ol~Pixel} * @private */ this.lastPixel_ = [0, 0]; @@ -620,7 +620,7 @@ Modify.prototype.writeGeometryCollectionGeometry_ = function(feature, geometry) /** - * @param {ol.Coordinate} coordinates Coordinates. + * @param {module:ol/coordinate~Coordinate} coordinates Coordinates. * @return {ol.Feature} Vertex feature. * @private */ @@ -876,7 +876,7 @@ Modify.prototype.handlePointerMove_ = function(evt) { /** - * @param {ol.Pixel} pixel Pixel + * @param {module:ol~Pixel} pixel Pixel * @param {ol.PluggableMap} map Map. * @private */ @@ -946,7 +946,7 @@ Modify.prototype.handlePointerAtPixel_ = function(pixel, map) { /** * Returns the distance from a point to a line segment. * - * @param {ol.Coordinate} pointCoordinates The coordinates of the point from + * @param {module:ol/coordinate~Coordinate} pointCoordinates The coordinates of the point from * which to calculate the distance. * @param {ol.ModifySegmentDataType} segmentData The object describing the line * segment we are calculating the distance to. @@ -972,11 +972,11 @@ function pointDistanceToSegmentDataSquared(pointCoordinates, segmentData) { /** * Returns the point closest to a given line segment. * - * @param {ol.Coordinate} pointCoordinates The point to which a closest point + * @param {module:ol/coordinate~Coordinate} pointCoordinates The point to which a closest point * should be found. * @param {ol.ModifySegmentDataType} segmentData The object describing the line * segment which should contain the closest point. - * @return {ol.Coordinate} The point closest to the specified line segment. + * @return {module:ol/coordinate~Coordinate} The point closest to the specified line segment. */ function closestOnSegmentData(pointCoordinates, segmentData) { const geometry = segmentData.geometry; @@ -991,7 +991,7 @@ function closestOnSegmentData(pointCoordinates, segmentData) { /** * @param {ol.ModifySegmentDataType} segmentData Segment data. - * @param {ol.Coordinate} vertex Vertex. + * @param {module:ol/coordinate~Coordinate} vertex Vertex. * @private */ Modify.prototype.insertVertex_ = function(segmentData, vertex) { @@ -1223,7 +1223,7 @@ Modify.prototype.updateSegmentIndices_ = function( /** - * @return {ol.StyleFunction} Styles. + * @return {module:ol/style~StyleFunction} Styles. */ function getDefaultStyleFunction() { const style = createEditingStyle(); diff --git a/src/ol/interaction/MouseWheelZoom.js b/src/ol/interaction/MouseWheelZoom.js index cb97653d19..1dfdf69cb3 100644 --- a/src/ol/interaction/MouseWheelZoom.js +++ b/src/ol/interaction/MouseWheelZoom.js @@ -82,7 +82,7 @@ const MouseWheelZoom = function(opt_options) { /** * @private - * @type {?ol.Coordinate} + * @type {?module:ol/coordinate~Coordinate} */ this.lastAnchor_ = null; diff --git a/src/ol/interaction/PinchRotate.js b/src/ol/interaction/PinchRotate.js index 09c9a40711..2b3d10670f 100644 --- a/src/ol/interaction/PinchRotate.js +++ b/src/ol/interaction/PinchRotate.js @@ -30,7 +30,7 @@ const PinchRotate = function(opt_options) { /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.anchor_ = null; diff --git a/src/ol/interaction/PinchZoom.js b/src/ol/interaction/PinchZoom.js index ea69a9d363..d57ffb4d2a 100644 --- a/src/ol/interaction/PinchZoom.js +++ b/src/ol/interaction/PinchZoom.js @@ -35,7 +35,7 @@ const PinchZoom = function(opt_options) { /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.anchor_ = null; diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index 0f5b40a74f..dcedb79f6b 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -115,7 +115,7 @@ inherits(PointerInteraction, Interaction); /** * @param {Array.} pointerEvents List of events. - * @return {ol.Pixel} Centroid pixel. + * @return {module:ol~Pixel} Centroid pixel. */ export function centroid(pointerEvents) { const length = pointerEvents.length; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index 5df6eced18..9b48e20882 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -371,7 +371,7 @@ Select.prototype.setMap = function(map) { /** - * @return {ol.StyleFunction} Styles. + * @return {module:ol/style~StyleFunction} Styles. */ function getDefaultStyleFunction() { const styles = createEditingStyle(); diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index f3090bfbd7..c4493667f1 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -74,13 +74,13 @@ const Snap = function(opt_options) { this.features_ = options.features ? options.features : null; /** - * @type {Array.} + * @type {Array.} * @private */ this.featuresListenerKeys_ = []; /** - * @type {Object.} + * @type {Object.} * @private */ this.featureChangeListenerKeys_ = {}; @@ -88,7 +88,7 @@ const Snap = function(opt_options) { /** * Extents are preserved so indexed segment can be quickly removed * when its feature geometry changes - * @type {Object.} + * @type {Object.} * @private */ this.indexedFeaturesExtents_ = {}; @@ -104,7 +104,7 @@ const Snap = function(opt_options) { /** * Used for distance sorting in sortByDistance_ - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} * @private */ this.pixelCoordinate_ = null; @@ -334,8 +334,8 @@ Snap.prototype.shouldStopEvent = FALSE; /** - * @param {ol.Pixel} pixel Pixel - * @param {ol.Coordinate} pixelCoordinate Coordinate + * @param {module:ol~Pixel} pixel Pixel + * @param {module:ol/coordinate~Coordinate} pixelCoordinate Coordinate * @param {ol.PluggableMap} map Map. * @return {ol.SnapResultType} Snap result */ diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index 4fee69a746..b92f7d85de 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -47,7 +47,7 @@ const TranslateEventType = { * @implements {oli.interaction.TranslateEvent} * @param {ol.interaction.TranslateEventType} type Type. * @param {ol.Collection.} features The features translated. - * @param {ol.Coordinate} coordinate The event coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate The event coordinate. */ export const TranslateEvent = function(type, features, coordinate) { @@ -63,7 +63,7 @@ export const TranslateEvent = function(type, features, coordinate) { /** * The coordinate of the drag event. * @const - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} * @api */ this.coordinate = coordinate; @@ -94,7 +94,7 @@ const Translate = function(opt_options) { /** * The last position we translated to. - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} * @private */ this.lastCoordinate_ = null; @@ -241,7 +241,7 @@ function handleMoveEvent(event) { /** * Tests to see if the given coordinates intersects any of our selected * features. - * @param {ol.Pixel} pixel Pixel coordinate to test for intersection. + * @param {module:ol~Pixel} pixel Pixel coordinate to test for intersection. * @param {ol.PluggableMap} map Map to test the intersection on. * @return {ol.Feature} Returns the feature found at the specified pixel * coordinates. diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 265e30a242..7f1ef3f412 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -43,10 +43,10 @@ const BaseLayer = function(options) { this.setProperties(properties); /** - * @type {ol.LayerState} + * @type {module:ol/layer/Layer~State} * @private */ - this.state_ = /** @type {ol.LayerState} */ ({ + this.state_ = /** @type {module:ol/layer/Layer~State} */ ({ layer: /** @type {ol.layer.Layer} */ (this), managed: true }); @@ -73,7 +73,7 @@ BaseLayer.prototype.getType = function() { /** - * @return {ol.LayerState} Layer state. + * @return {module:ol/layer/Layer~State} Layer state. */ BaseLayer.prototype.getLayerState = function() { this.state_.opacity = clamp(this.getOpacity(), 0, 1); @@ -99,22 +99,22 @@ BaseLayer.prototype.getLayersArray = function(opt_array) {}; /** * @abstract - * @param {Array.=} opt_states Optional list of layer + * @param {Array.=} opt_states Optional list of layer * states (to be modified in place). - * @return {Array.} List of layer states. + * @return {Array.} List of layer states. */ BaseLayer.prototype.getLayerStatesArray = function(opt_states) {}; /** - * Return the {@link ol.Extent extent} of the layer or `undefined` if it + * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it * will be visible regardless of extent. - * @return {ol.Extent|undefined} The layer extent. + * @return {module:ol/extent~Extent|undefined} The layer extent. * @observable * @api */ BaseLayer.prototype.getExtent = function() { - return /** @type {ol.Extent|undefined} */ (this.get(LayerProperty.EXTENT)); + return /** @type {module:ol/extent~Extent|undefined} */ (this.get(LayerProperty.EXTENT)); }; @@ -184,7 +184,7 @@ BaseLayer.prototype.getZIndex = function() { /** * Set the extent at which the layer is visible. If `undefined`, the layer * will be visible at all extents. - * @param {ol.Extent|undefined} extent The extent of the layer. + * @param {module:ol/extent~Extent|undefined} extent The extent of the layer. * @observable * @api */ diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 99035973f9..375c027e13 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -47,13 +47,13 @@ const LayerGroup = function(opt_options) { /** * @private - * @type {Array.} + * @type {Array.} */ this.layersListenerKeys_ = []; /** * @private - * @type {Object.>} + * @type {Object.>} */ this.listenerKeys_ = {}; diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 412e99a865..01759d2a20 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -11,6 +11,21 @@ import {assign} from '../obj.js'; import RenderEventType from '../render/EventType.js'; import SourceState from '../source/State.js'; + +/** + * @typedef {Object} State + * @property {module:ol/layer/Layer~Layer} layer + * @property {number} opacity + * @property {module:ol/source/Source~State} sourceState + * @property {boolean} visible + * @property {boolean} managed + * @property {module:ol/extent~Extent} [extent] + * @property {number} zIndex + * @property {number} maxResolution + * @property {number} minResolution + */ + + /** * @classdesc * Abstract base class; normally only used for creating subclasses and not @@ -42,19 +57,19 @@ const Layer = function(options) { /** * @private - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} */ this.mapPrecomposeKey_ = null; /** * @private - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} */ this.mapRenderKey_ = null; /** * @private - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} */ this.sourceChangeKey_ = null; @@ -77,7 +92,7 @@ inherits(Layer, BaseLayer); * Return `true` if the layer is visible, and if the passed resolution is * between the layer's minResolution and maxResolution. The comparison is * inclusive for `minResolution` and exclusive for `maxResolution`. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @param {number} resolution Resolution. * @return {boolean} The layer is visible at the given resolution. */ diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index eb8f9e22fd..0cbfe7636f 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -58,14 +58,14 @@ const VectorLayer = function(opt_options) { /** * User provided style. - * @type {ol.style.Style|Array.|ol.StyleFunction} + * @type {ol.style.Style|Array.|module:ol/style~StyleFunction} * @private */ this.style_ = null; /** * Style function for use within the library. - * @type {ol.StyleFunction|undefined} + * @type {module:ol/style~StyleFunction|undefined} * @private */ this.styleFunction_ = undefined; @@ -133,7 +133,7 @@ VectorLayer.prototype.getRenderBuffer = function() { * order. */ VectorLayer.prototype.getRenderOrder = function() { - return /** @type {ol.RenderOrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER)); + return /** @type {module:ol/render~OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER)); }; @@ -149,7 +149,7 @@ VectorLayer.prototype.getSource; /** * Get the style for features. This returns whatever was passed to the `style` * option at construction or to the `setStyle` method. - * @return {ol.style.Style|Array.|ol.StyleFunction} + * @return {ol.style.Style|Array.|module:ol/style~StyleFunction} * Layer style. * @api */ @@ -160,7 +160,7 @@ VectorLayer.prototype.getStyle = function() { /** * Get the style function. - * @return {ol.StyleFunction|undefined} Layer style function. + * @return {module:ol/style~StyleFunction|undefined} Layer style function. * @api */ VectorLayer.prototype.getStyleFunction = function() { @@ -187,7 +187,7 @@ VectorLayer.prototype.getUpdateWhileInteracting = function() { /** - * @param {ol.RenderOrderFunction|null|undefined} renderOrder + * @param {module:ol/render~OrderFunction|null|undefined} renderOrder * Render order. */ VectorLayer.prototype.setRenderOrder = function(renderOrder) { @@ -202,7 +202,7 @@ VectorLayer.prototype.setRenderOrder = function(renderOrder) { * it is `null` the layer has no style (a `null` style), so only features * that have their own styles will be rendered in the layer. See * {@link ol.style} for information on the default style. - * @param {ol.style.Style|Array.|ol.StyleFunction|null|undefined} + * @param {ol.style.Style|Array.|module:ol/style~StyleFunction|null|undefined} * style Layer style. * @api */ diff --git a/src/ol/loadingstrategy.js b/src/ol/loadingstrategy.js index b4cc2ed6b5..4cc18a2930 100644 --- a/src/ol/loadingstrategy.js +++ b/src/ol/loadingstrategy.js @@ -5,9 +5,9 @@ /** * Strategy function for loading all features with a single request. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. - * @return {Array.} Extents. + * @return {Array.} Extents. * @api */ export function all(extent, resolution) { @@ -18,9 +18,9 @@ export function all(extent, resolution) { /** * Strategy function for loading features based on the view's extent and * resolution. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. - * @return {Array.} Extents. + * @return {Array.} Extents. * @api */ export function bbox(extent, resolution) { @@ -30,23 +30,23 @@ export function bbox(extent, resolution) { /** * Creates a strategy function for loading features based on a tile grid. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {function(ol.Extent, number): Array.} Loading strategy. + * @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid. + * @return {function(module:ol/extent~Extent, number): Array.} Loading strategy. * @api */ export function tile(tileGrid) { return ( /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. - * @return {Array.} Extents. + * @return {Array.} Extents. */ function(extent, resolution) { const z = tileGrid.getZForResolution(resolution); const tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); - /** @type {Array.} */ + /** @type {Array.} */ const extents = []; - /** @type {ol.TileCoord} */ + /** @type {module:ol/tilecoord~TileCoord} */ const tileCoord = [z, 0, 0]; for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; ++tileCoord[1]) { for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; ++tileCoord[2]) { diff --git a/src/ol/loadingstrategy.jsdoc b/src/ol/loadingstrategy.jsdoc deleted file mode 100644 index 7c917fb648..0000000000 --- a/src/ol/loadingstrategy.jsdoc +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Strategies for loading vector data. - * @namespace ol.loadingstrategy - */ diff --git a/src/ol/plugins.js b/src/ol/plugins.js index 35e05f24e6..a26fcfe7f0 100644 --- a/src/ol/plugins.js +++ b/src/ol/plugins.js @@ -3,9 +3,28 @@ */ import PluginType from './PluginType.js'; + +/** + * @typedef {Object} MapRendererPlugin + * @property {function(module:ol/renderer/Type):boolean} handles Determine if + * this renderer handles the provided layer. + * @property {function(Element, module:ol/PluggableMap~PluggableMap):module:ol/renderer/Map~Map} create + * Create the map renderer. + */ + + +/** + * @typedef {Object} LayerRendererPlugin + * @property {function(module:ol/renderer/Type, module:ol/layer/Layer~Layer):boolean} handles + * Determine if this renderer handles the provided layer. + * @property {function(module:ol/renderer/Map~Map, module:ol/layer/Layer~Layer):module:ol/renderer/Layer~Layer} create + * Create a layer renderer. + */ + + /** * The registry of map renderer plugins. - * @type {Array} + * @type {Array} * @private */ const mapRendererPlugins = []; @@ -39,7 +58,7 @@ export function getLayerRendererPlugins() { /** * Register a plugin. - * @param {ol.PluginType} type The plugin type. + * @param {module:ol/PluginType~PluginType} type The plugin type. * @param {*} plugin The plugin. */ export function register(type, plugin) { @@ -64,7 +83,7 @@ export function register(type, plugin) { /** * Register multiple plugins. - * @param {ol.PluginType} type The plugin type. + * @param {module:ol/PluginType~PluginType} type The plugin type. * @param {Array} plugins The plugins. */ export function registerMultiple(type, plugins) { diff --git a/src/ol/pointer/MouseSource.js b/src/ol/pointer/MouseSource.js index dfec1826ae..f261080659 100644 --- a/src/ol/pointer/MouseSource.js +++ b/src/ol/pointer/MouseSource.js @@ -57,7 +57,7 @@ const MouseSource = function(dispatcher) { /** * @const - * @type {Array.} + * @type {Array.} */ this.lastTouches = []; }; diff --git a/src/ol/pointer/PointerEventHandler.js b/src/ol/pointer/PointerEventHandler.js index 49f7c95a92..f548dfc98a 100644 --- a/src/ol/pointer/PointerEventHandler.js +++ b/src/ol/pointer/PointerEventHandler.js @@ -44,7 +44,7 @@ import TouchSource from '../pointer/TouchSource.js'; /** * @constructor - * @extends {ol.events.EventTarget} + * @extends {module:ol/events/EventTarget~EventTarget} * @param {Element|HTMLDocument} element Viewport element. */ const PointerEventHandler = function(element) { diff --git a/src/ol/proj.js b/src/ol/proj.js index 7ffce664ea..f9e55b6234 100644 --- a/src/ol/proj.js +++ b/src/ol/proj.js @@ -12,10 +12,29 @@ import * as projections from './proj/projections.js'; import {add as addTransformFunc, clear as clearTransformFuncs, get as getTransformFunc} from './proj/transforms.js'; +/** + * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier + * string or undefined. + * @typedef {module:ol/proj/Projection~Projection|string|undefined} ProjectionLike + * @api + */ + + +/** + * A transform function accepts an array of input coordinate values, an optional + * output array, and an optional dimension (default should be 2). The function + * transforms the input coordinate values, populates the output array, and + * returns the output array. + * + * @typedef {function(Array., Array.=, number=): Array.} TransformFunction + * @api + */ + + /** * Meters per unit lookup table. * @const - * @type {Object.} + * @type {Object.} * @api */ export {METERS_PER_UNIT}; @@ -63,7 +82,7 @@ export function identityTransform(input, opt_output, opt_dimension) { * Add a Projection object to the list of supported projections that can be * looked up by their code. * - * @param {ol.proj.Projection} projection Projection instance. + * @param {module:ol/proj/Projection~Projection} projection Projection instance. * @api */ export function addProjection(projection) { @@ -73,7 +92,7 @@ export function addProjection(projection) { /** - * @param {Array.} projections Projections. + * @param {Array.} projections Projections. */ export function addProjections(projections) { projections.forEach(addProjection); @@ -83,10 +102,10 @@ export function addProjections(projections) { /** * Fetches a Projection object for the code specified. * - * @param {ol.ProjectionLike} projectionLike Either a code string which is + * @param {module:ol/proj~ProjectionLike} projectionLike Either a code string which is * a combination of authority and identifier such as "EPSG:4326", or an * existing projection object, or undefined. - * @return {ol.proj.Projection} Projection object, or null if not in list. + * @return {module:ol/proj/Projection~Projection} Projection object, or null if not in list. * @api */ export function get(projectionLike) { @@ -110,13 +129,13 @@ export function get(projectionLike) { * and taking the average of the width and height. * A custom function can be provided for a specific projection, either * by setting the `getPointResolution` option in the - * {@link ol.proj.Projection} constructor or by using - * {@link ol.proj.Projection#setGetPointResolution} to change an existing + * {@link module:ol/proj/Projection~Projection} constructor or by using + * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing * projection object. - * @param {ol.ProjectionLike} projection The projection. + * @param {module:ol/proj~ProjectionLike} projection The projection. * @param {number} resolution Nominal resolution in projection units. - * @param {ol.Coordinate} point Point to find adjusted resolution at. - * @param {ol.proj.Units=} opt_units Units to get the point resolution in. + * @param {module:ol/coordinate~Coordinate} point Point to find adjusted resolution at. + * @param {module:ol/proj/Units~Units=} opt_units Units to get the point resolution in. * Default is the projection's units. * @return {number} Point resolution. * @api @@ -162,7 +181,7 @@ export function getPointResolution(projection, resolution, point, opt_units) { * Registers transformation functions that don't alter coordinates. Those allow * to transform between projections with equal meaning. * - * @param {Array.} projections Projections. + * @param {Array.} projections Projections. * @api */ export function addEquivalentProjections(projections) { @@ -181,13 +200,13 @@ export function addEquivalentProjections(projections) { * Registers transformation functions to convert coordinates in any projection * in projection1 to any projection in projection2. * - * @param {Array.} projections1 Projections with equal + * @param {Array.} projections1 Projections with equal * meaning. - * @param {Array.} projections2 Projections with equal + * @param {Array.} projections2 Projections with equal * meaning. - * @param {ol.TransformFunction} forwardTransform Transformation from any + * @param {module:ol/proj~TransformFunction} forwardTransform Transformation from any * projection in projection1 to any projection in projection2. - * @param {ol.TransformFunction} inverseTransform Transform from any projection + * @param {module:ol/proj~TransformFunction} inverseTransform Transform from any projection * in projection2 to any projection in projection1.. */ export function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) { @@ -210,9 +229,9 @@ export function clearAllProjections() { /** - * @param {ol.proj.Projection|string|undefined} projection Projection. + * @param {module:ol/proj/Projection~Projection|string|undefined} projection Projection. * @param {string} defaultCode Default code. - * @return {ol.proj.Projection} Projection. + * @return {module:ol/proj/Projection~Projection} Projection. */ export function createProjection(projection, defaultCode) { if (!projection) { @@ -220,17 +239,17 @@ export function createProjection(projection, defaultCode) { } else if (typeof projection === 'string') { return get(projection); } else { - return /** @type {ol.proj.Projection} */ (projection); + return /** @type {module:ol/proj/Projection~Projection} */ (projection); } } /** - * Creates a {@link ol.TransformFunction} from a simple 2D coordinate transform + * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform * function. - * @param {function(ol.Coordinate): ol.Coordinate} coordTransform Coordinate + * @param {function(module:ol/coordinate~Coordinate): module:ol/coordinate~Coordinate} coordTransform Coordinate * transform. - * @return {ol.TransformFunction} Transform function. + * @return {module:ol/proj~TransformFunction} Transform function. */ export function createTransformFromCoordinateTransform(coordTransform) { return ( @@ -265,16 +284,16 @@ export function createTransformFromCoordinateTransform(coordTransform) { * converts these into the functions used internally which also handle * extents and coordinate arrays. * - * @param {ol.ProjectionLike} source Source projection. - * @param {ol.ProjectionLike} destination Destination projection. - * @param {function(ol.Coordinate): ol.Coordinate} forward The forward transform + * @param {module:ol/proj~ProjectionLike} source Source projection. + * @param {module:ol/proj~ProjectionLike} destination Destination projection. + * @param {function(module:ol/coordinate~Coordinate): module:ol/coordinate~Coordinate} forward The forward transform * function (that is, from the source projection to the destination - * projection) that takes a {@link ol.Coordinate} as argument and returns - * the transformed {@link ol.Coordinate}. - * @param {function(ol.Coordinate): ol.Coordinate} inverse The inverse transform + * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns + * the transformed {@link module:ol/coordinate~Coordinate}. + * @param {function(module:ol/coordinate~Coordinate): module:ol/coordinate~Coordinate} inverse The inverse transform * function (that is, from the destination projection to the source - * projection) that takes a {@link ol.Coordinate} as argument and returns - * the transformed {@link ol.Coordinate}. + * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns + * the transformed {@link module:ol/coordinate~Coordinate}. * @api */ export function addCoordinateTransforms(source, destination, forward, inverse) { @@ -287,11 +306,11 @@ export function addCoordinateTransforms(source, destination, forward, inverse) { /** * Transforms a coordinate from longitude/latitude to a different projection. - * @param {ol.Coordinate} coordinate Coordinate as longitude and latitude, i.e. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate as longitude and latitude, i.e. * an array with longitude as 1st and latitude as 2nd element. - * @param {ol.ProjectionLike=} opt_projection Target projection. The + * @param {module:ol/proj~ProjectionLike=} opt_projection Target projection. The * default is Web Mercator, i.e. 'EPSG:3857'. - * @return {ol.Coordinate} Coordinate projected to the target projection. + * @return {module:ol/coordinate~Coordinate} Coordinate projected to the target projection. * @api */ export function fromLonLat(coordinate, opt_projection) { @@ -302,10 +321,10 @@ export function fromLonLat(coordinate, opt_projection) { /** * Transforms a coordinate to longitude/latitude. - * @param {ol.Coordinate} coordinate Projected coordinate. - * @param {ol.ProjectionLike=} opt_projection Projection of the coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Projected coordinate. + * @param {module:ol/proj~ProjectionLike=} opt_projection Projection of the coordinate. * The default is Web Mercator, i.e. 'EPSG:3857'. - * @return {ol.Coordinate} Coordinate as longitude and latitude, i.e. an array + * @return {module:ol/coordinate~Coordinate} Coordinate as longitude and latitude, i.e. an array * with longitude as 1st and latitude as 2nd element. * @api */ @@ -325,8 +344,8 @@ export function toLonLat(coordinate, opt_projection) { * projection does represent the same geographic point as the same coordinate in * the other projection. * - * @param {ol.proj.Projection} projection1 Projection 1. - * @param {ol.proj.Projection} projection2 Projection 2. + * @param {module:ol/proj/Projection~Projection} projection1 Projection 1. + * @param {module:ol/proj/Projection~Projection} projection2 Projection 2. * @return {boolean} Equivalent. * @api */ @@ -348,10 +367,10 @@ export function equivalent(projection1, projection2) { * Searches in the list of transform functions for the function for converting * coordinates from the source projection to the destination projection. * - * @param {ol.proj.Projection} sourceProjection Source Projection object. - * @param {ol.proj.Projection} destinationProjection Destination Projection + * @param {module:ol/proj/Projection~Projection} sourceProjection Source Projection object. + * @param {module:ol/proj/Projection~Projection} destinationProjection Destination Projection * object. - * @return {ol.TransformFunction} Transform function. + * @return {module:ol/proj~TransformFunction} Transform function. */ export function getTransformFromProjections(sourceProjection, destinationProjection) { const sourceCode = sourceProjection.getCode(); @@ -369,9 +388,9 @@ export function getTransformFromProjections(sourceProjection, destinationProject * function to convert a coordinates array from the source projection to the * destination projection. * - * @param {ol.ProjectionLike} source Source. - * @param {ol.ProjectionLike} destination Destination. - * @return {ol.TransformFunction} Transform function. + * @param {module:ol/proj~ProjectionLike} source Source. + * @param {module:ol/proj~ProjectionLike} destination Destination. + * @return {module:ol/proj~TransformFunction} Transform function. * @api */ export function getTransform(source, destination) { @@ -385,14 +404,14 @@ export function getTransform(source, destination) { * Transforms a coordinate from source projection to destination projection. * This returns a new coordinate (and does not modify the original). * - * See {@link ol.proj.transformExtent} for extent transformation. - * See the transform method of {@link ol.geom.Geometry} and its subclasses for - * geometry transforms. + * See {@link module:ol/proj~transformExtent} for extent transformation. + * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its + * subclasses for geometry transforms. * - * @param {ol.Coordinate} coordinate Coordinate. - * @param {ol.ProjectionLike} source Source projection-like. - * @param {ol.ProjectionLike} destination Destination projection-like. - * @return {ol.Coordinate} Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. + * @param {module:ol/proj~ProjectionLike} source Source projection-like. + * @param {module:ol/proj~ProjectionLike} destination Destination projection-like. + * @return {module:ol/coordinate~Coordinate} Coordinate. * @api */ export function transform(coordinate, source, destination) { @@ -405,10 +424,10 @@ export function transform(coordinate, source, destination) { * Transforms an extent from source projection to destination projection. This * returns a new extent (and does not modify the original). * - * @param {ol.Extent} extent The extent to transform. - * @param {ol.ProjectionLike} source Source projection-like. - * @param {ol.ProjectionLike} destination Destination projection-like. - * @return {ol.Extent} The transformed extent. + * @param {module:ol/extent~Extent} extent The extent to transform. + * @param {module:ol/proj~ProjectionLike} source Source projection-like. + * @param {module:ol/proj~ProjectionLike} destination Destination projection-like. + * @return {module:ol/extent~Extent} The transformed extent. * @api */ export function transformExtent(extent, source, destination) { @@ -420,10 +439,10 @@ export function transformExtent(extent, source, destination) { /** * Transforms the given point to the destination projection. * - * @param {ol.Coordinate} point Point. - * @param {ol.proj.Projection} sourceProjection Source projection. - * @param {ol.proj.Projection} destinationProjection Destination projection. - * @return {ol.Coordinate} Point. + * @param {module:ol/coordinate~Coordinate} point Point. + * @param {module:ol/proj/Projection~Projection} sourceProjection Source projection. + * @param {module:ol/proj/Projection~Projection} destinationProjection Destination projection. + * @return {module:ol/coordinate~Coordinate} Point. */ export function transformWithProjections(point, sourceProjection, destinationProjection) { const transformFunc = getTransformFromProjections(sourceProjection, destinationProjection); diff --git a/src/ol/proj/Projection.js b/src/ol/proj/Projection.js index 80008d2cc5..eb572f0ebc 100644 --- a/src/ol/proj/Projection.js +++ b/src/ol/proj/Projection.js @@ -8,7 +8,7 @@ import {METERS_PER_UNIT} from '../proj/Units.js'; * Projection definition class. One of these is created for each projection * supported in the application and stored in the {@link ol.proj} namespace. * You can use these in applications, but this is not required, as API params - * and options use {@link ol.ProjectionLike} which means the simple string + * and options use {@link module:ol/proj~ProjectionLike} which means the simple string * code will suffice. * * You can use {@link ol.proj.get} to retrieve the object for a particular @@ -54,7 +54,7 @@ const Projection = function(options) { * with `ol.proj.Units.TILE_PIXELS` units, this is the extent of the tile in * tile pixel space. * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = options.extent !== undefined ? options.extent : null; @@ -63,7 +63,7 @@ const Projection = function(options) { * `ol.proj.Units.TILE_PIXELS` units, this is the extent of the tile in * projected coordinate space. * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.worldExtent_ = options.worldExtent !== undefined ? options.worldExtent : null; @@ -89,7 +89,7 @@ const Projection = function(options) { /** * @private - * @type {function(number, ol.Coordinate):number|undefined} + * @type {function(number, module:ol/coordinate~Coordinate):number|undefined} */ this.getPointResolutionFunc_ = options.getPointResolution; @@ -127,7 +127,7 @@ Projection.prototype.getCode = function() { /** * Get the validity extent for this projection. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. * @api */ Projection.prototype.getExtent = function() { @@ -159,7 +159,7 @@ Projection.prototype.getMetersPerUnit = function() { /** * Get the world extent for this projection. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. * @api */ Projection.prototype.getWorldExtent = function() { @@ -222,7 +222,7 @@ Projection.prototype.setDefaultTileGrid = function(tileGrid) { /** * Set the validity extent for this projection. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @api */ Projection.prototype.setExtent = function(extent) { @@ -233,7 +233,7 @@ Projection.prototype.setExtent = function(extent) { /** * Set the world extent for this projection. - * @param {ol.Extent} worldExtent World extent + * @param {module:ol/extent~Extent} worldExtent World extent * [minlon, minlat, maxlon, maxlat]. * @api */ @@ -245,7 +245,7 @@ Projection.prototype.setWorldExtent = function(worldExtent) { /** * Set the getPointResolution function (see {@link ol.proj#getPointResolution} * for this projection. - * @param {function(number, ol.Coordinate):number} func Function + * @param {function(number, module:ol/coordinate~Coordinate):number} func Function * @api */ Projection.prototype.setGetPointResolution = function(func) { @@ -255,7 +255,7 @@ Projection.prototype.setGetPointResolution = function(func) { /** * Get the custom point resolution function for this projection (if set). - * @return {function(number, ol.Coordinate):number|undefined} The custom point + * @return {function(number, module:ol/coordinate~Coordinate):number|undefined} The custom point * resolution function (if set). */ Projection.prototype.getPointResolutionFunc = function() { diff --git a/src/ol/proj/epsg3857.js b/src/ol/proj/epsg3857.js index b4d939752d..8c77b0a4c9 100644 --- a/src/ol/proj/epsg3857.js +++ b/src/ol/proj/epsg3857.js @@ -25,7 +25,7 @@ export const HALF_SIZE = Math.PI * RADIUS; /** * @const - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ export const EXTENT = [ -HALF_SIZE, -HALF_SIZE, @@ -35,7 +35,7 @@ export const EXTENT = [ /** * @const - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ export const WORLD_EXTENT = [-180, -85, 180, 85]; diff --git a/src/ol/proj/epsg4326.js b/src/ol/proj/epsg4326.js index 868f8e96f0..dc0b7c3d9a 100644 --- a/src/ol/proj/epsg4326.js +++ b/src/ol/proj/epsg4326.js @@ -19,7 +19,7 @@ export const RADIUS = 6378137; * Extent of the EPSG:4326 projection which is the whole world. * * @const - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ export const EXTENT = [-180, -90, 180, 90]; diff --git a/src/ol/proj/transforms.js b/src/ol/proj/transforms.js index 4417f30de4..c73cd8fd1a 100644 --- a/src/ol/proj/transforms.js +++ b/src/ol/proj/transforms.js @@ -6,7 +6,7 @@ import {isEmpty} from '../obj.js'; /** * @private - * @type {!Object.>} + * @type {!Object.>} */ let transforms = {}; @@ -25,7 +25,7 @@ export function clear() { * * @param {ol.proj.Projection} source Source. * @param {ol.proj.Projection} destination Destination. - * @param {ol.TransformFunction} transformFn Transform. + * @param {module:ol/proj~TransformFunction} transformFn Transform. */ export function add(source, destination, transformFn) { const sourceCode = source.getCode(); @@ -44,7 +44,7 @@ export function add(source, destination, transformFn) { * * @param {ol.proj.Projection} source Source projection. * @param {ol.proj.Projection} destination Destination projection. - * @return {ol.TransformFunction} transformFn The unregistered transform. + * @return {module:ol/proj~TransformFunction} transformFn The unregistered transform. */ export function remove(source, destination) { const sourceCode = source.getCode(); @@ -62,7 +62,7 @@ export function remove(source, destination) { * Get a transform given a source code and a destination code. * @param {string} sourceCode The code for the source projection. * @param {string} destinationCode The code for the destination projection. - * @return {ol.TransformFunction|undefined} The transform function (if found). + * @return {module:ol/proj~TransformFunction|undefined} The transform function (if found). */ export function get(sourceCode, destinationCode) { let transform; diff --git a/src/ol/render.js b/src/ol/render.js index 3445606d26..b017ed3d56 100644 --- a/src/ol/render.js +++ b/src/ol/render.js @@ -6,6 +6,27 @@ import {create as createTransform, scale as scaleTransform} from './transform.js import CanvasImmediateRenderer from './render/canvas/Immediate.js'; +/** + * A function to be used when sorting features before rendering. + * It takes two instances of {@link module:ol/Feature} or + * {@link module:ol/render/Feature} and returns a `{number}`. + * + * @typedef {function((module:ol/Feature~Feature|module:ol/render/Feature~Feature), + * (module:ol/Feature~Feature|module:ol/render/Feature~Feature)):number} OrderFunction + */ + + +/** + * @typedef {Object} ToContextOptions + * @property {module:ol/size~Size} [size] Desired size of the canvas in css + * pixels. When provided, both canvas and css size will be set according to the + * `pixelRatio`. If not provided, the current canvas and css sizes will not be + * altered. + * @property {number} [pixelRatio=window.devicePixelRatio] Pixel ratio (canvas + * pixel to css pixel ratio) for the canvas. + */ + + /** * Binds a Canvas Immediate API to a canvas context, to allow drawing geometries * to the context's canvas. @@ -13,17 +34,21 @@ import CanvasImmediateRenderer from './render/canvas/Immediate.js'; * The units for geometry coordinates are css pixels relative to the top left * corner of the canvas element. * ```js + * import {toContext} from 'ol/render'; + * import Fill from 'ol/style/Fill'; + * import Polygon from 'ol/geom/Polygon'; + * * var canvas = document.createElement('canvas'); - * var render = ol.render.toContext(canvas.getContext('2d'), + * var render = toContext(canvas.getContext('2d'), * { size: [100, 100] }); - * render.setFillStrokeStyle(new ol.style.Fill({ color: blue })); + * render.setFillStrokeStyle(new Fill({ color: blue })); * render.drawPolygon( - * new ol.geom.Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]])); + * new Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]])); * ``` * * @param {CanvasRenderingContext2D} context Canvas context. - * @param {olx.render.ToContextOptions=} opt_options Options. - * @return {ol.render.canvas.Immediate} Canvas Immediate. + * @param {module:ol/render~ToContextOptions=} opt_options Options. + * @return {module:ol/render/canvas/Immediate~Immediate} Canvas Immediate. * @api */ export function toContext(context, opt_options) { diff --git a/src/ol/render.jsdoc b/src/ol/render.jsdoc deleted file mode 100644 index a167ba1d5f..0000000000 --- a/src/ol/render.jsdoc +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @namespace ol.render - */ diff --git a/src/ol/render/Box.js b/src/ol/render/Box.js index 4660086372..a303fd345d 100644 --- a/src/ol/render/Box.js +++ b/src/ol/render/Box.js @@ -36,13 +36,13 @@ const RenderBox = function(className) { /** * @private - * @type {ol.Pixel} + * @type {module:ol~Pixel} */ this.startPixel_ = null; /** * @private - * @type {ol.Pixel} + * @type {module:ol~Pixel} */ this.endPixel_ = null; @@ -91,8 +91,8 @@ RenderBox.prototype.setMap = function(map) { /** - * @param {ol.Pixel} startPixel Start pixel. - * @param {ol.Pixel} endPixel End pixel. + * @param {module:ol~Pixel} startPixel Start pixel. + * @param {module:ol~Pixel} endPixel End pixel. */ RenderBox.prototype.setPixels = function(startPixel, endPixel) { this.startPixel_ = startPixel; diff --git a/src/ol/render/Feature.js b/src/ol/render/Feature.js index 1a0541f175..ffb9b1acd7 100644 --- a/src/ol/render/Feature.js +++ b/src/ol/render/Feature.js @@ -27,7 +27,7 @@ import {create as createTransform, compose as composeTransform} from '../transfo const RenderFeature = function(type, flatCoordinates, ends, properties, id) { /** * @private - * @type {ol.Extent|undefined} + * @type {module:ol/extent~Extent|undefined} */ this.extent_; @@ -77,7 +77,7 @@ const RenderFeature = function(type, flatCoordinates, ends, properties, id) { /** - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ const tmpTransform = createTransform(); @@ -104,7 +104,7 @@ RenderFeature.prototype.getEndss = function() { /** * Get the extent of this feature's geometry. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. * @api */ RenderFeature.prototype.getExtent = function() { @@ -260,8 +260,8 @@ RenderFeature.prototype.getType = function() { * Transform geometry coordinates from tile pixel space to projected. * The SRS of the source and destination are expected to be the same. * - * @param {ol.ProjectionLike} source The current projection - * @param {ol.ProjectionLike} destination The desired projection. + * @param {module:ol/proj~ProjectionLike} source The current projection + * @param {module:ol/proj~ProjectionLike} destination The desired projection. */ RenderFeature.prototype.transform = function(source, destination) { const pixelExtent = source.getExtent(); diff --git a/src/ol/render/canvas.js b/src/ol/render/canvas.js index 98734a9659..4d4debb055 100644 --- a/src/ol/render/canvas.js +++ b/src/ol/render/canvas.js @@ -206,7 +206,7 @@ function getMeasureContext() { /** * @param {string} font Font to use for measuring. - * @return {ol.Size} Measurement. + * @return {module:ol/size~Size} Measurement. */ export const measureTextHeight = (function() { let span; @@ -265,7 +265,7 @@ export const resetTransform = createTransform(); /** * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Transform|null} transform Transform. + * @param {module:ol/transform~Transform|null} transform Transform. * @param {number} opacity Opacity. * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image Image. * @param {number} originX Origin X. diff --git a/src/ol/render/canvas/ImageReplay.js b/src/ol/render/canvas/ImageReplay.js index 70872cf1b8..ece28508b8 100644 --- a/src/ol/render/canvas/ImageReplay.js +++ b/src/ol/render/canvas/ImageReplay.js @@ -9,7 +9,7 @@ import CanvasReplay from '../canvas/Replay.js'; * @constructor * @extends {ol.render.canvas.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. + * @param {module:ol/extent~Extent} maxExtent Maximum extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {boolean} overlaps The replay can have overlapping geometries. diff --git a/src/ol/render/canvas/Immediate.js b/src/ol/render/canvas/Immediate.js index fae21a64e3..01475886d9 100644 --- a/src/ol/render/canvas/Immediate.js +++ b/src/ol/render/canvas/Immediate.js @@ -30,8 +30,8 @@ import {create as createTransform, compose as composeTransform} from '../../tran * @extends {ol.render.VectorContext} * @param {CanvasRenderingContext2D} context Context. * @param {number} pixelRatio Pixel ratio. - * @param {ol.Extent} extent Extent. - * @param {ol.Transform} transform Transform. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/transform~Transform} transform Transform. * @param {number} viewRotation View rotation. * @struct */ @@ -52,13 +52,13 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform, /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = extent; /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.transform_ = transform; @@ -232,7 +232,7 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform, /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.tmpLocalTransform_ = createTransform(); diff --git a/src/ol/render/canvas/LineStringReplay.js b/src/ol/render/canvas/LineStringReplay.js index 78db8cad92..17ccc749ca 100644 --- a/src/ol/render/canvas/LineStringReplay.js +++ b/src/ol/render/canvas/LineStringReplay.js @@ -9,7 +9,7 @@ import CanvasReplay from '../canvas/Replay.js'; * @constructor * @extends {ol.render.canvas.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. + * @param {module:ol/extent~Extent} maxExtent Maximum extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {boolean} overlaps The replay can have overlapping geometries. diff --git a/src/ol/render/canvas/PolygonReplay.js b/src/ol/render/canvas/PolygonReplay.js index 879ebff636..53992f74fb 100644 --- a/src/ol/render/canvas/PolygonReplay.js +++ b/src/ol/render/canvas/PolygonReplay.js @@ -15,7 +15,7 @@ import CanvasReplay from '../canvas/Replay.js'; * @constructor * @extends {ol.render.canvas.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. + * @param {module:ol/extent~Extent} maxExtent Maximum extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {boolean} overlaps The replay can have overlapping geometries. diff --git a/src/ol/render/canvas/Replay.js b/src/ol/render/canvas/Replay.js index 91ec941fd9..1c9a3e6653 100644 --- a/src/ol/render/canvas/Replay.js +++ b/src/ol/render/canvas/Replay.js @@ -32,7 +32,7 @@ import { * @constructor * @extends {ol.render.VectorContext} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. + * @param {module:ol/extent~Extent} maxExtent Maximum extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {boolean} overlaps The replay can have overlapping geometries. @@ -49,7 +49,7 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.tmpExtent_ = createEmpty(); @@ -62,7 +62,7 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @protected * @const - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.maxExtent = maxExtent; @@ -93,7 +93,7 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.fillOrigin_; @@ -111,7 +111,7 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.bufferedMaxExtent_ = null; @@ -129,13 +129,13 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @private - * @type {!Object.|Array.>>} + * @type {!Object.|Array.>>} */ this.coordinateCache_ = {}; /** * @private - * @type {!ol.Transform} + * @type {!module:ol/transform~Transform} */ this.renderedTransform_ = createTransform(); @@ -165,13 +165,13 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over /** * @private - * @type {!ol.Transform} + * @type {!module:ol/transform~Transform} */ this.tmpLocalTransform_ = createTransform(); /** * @private - * @type {!ol.Transform} + * @type {!module:ol/transform~Transform} */ this.resetTransform = createTransform(); }; @@ -181,10 +181,10 @@ inherits(CanvasReplay, VectorContext); /** * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Coordinate} p1 1st point of the background box. - * @param {ol.Coordinate} p2 2nd point of the background box. - * @param {ol.Coordinate} p3 3rd point of the background box. - * @param {ol.Coordinate} p4 4th point of the background box. + * @param {module:ol/coordinate~Coordinate} p1 1st point of the background box. + * @param {module:ol/coordinate~Coordinate} p2 2nd point of the background box. + * @param {module:ol/coordinate~Coordinate} p3 3rd point of the background box. + * @param {module:ol/coordinate~Coordinate} p4 4th point of the background box. * @param {Array.<*>} fillInstruction Fill instruction. * @param {Array.<*>} strokeInstruction Stroke instruction. */ @@ -245,13 +245,13 @@ CanvasReplay.prototype.replayImage_ = function(context, x, y, image, const boxX = x - padding[3]; const boxY = y - padding[0]; - /** @type {ol.Coordinate} */ + /** @type {module:ol/coordinate~Coordinate} */ let p1; - /** @type {ol.Coordinate} */ + /** @type {module:ol/coordinate~Coordinate} */ let p2; - /** @type {ol.Coordinate} */ + /** @type {module:ol/coordinate~Coordinate} */ let p3; - /** @type {ol.Coordinate} */ + /** @type {module:ol/coordinate~Coordinate} */ let p4; if (fillStroke || rotation !== 0) { p1 = [boxX, boxY]; @@ -534,13 +534,13 @@ CanvasReplay.prototype.renderDeclutter_ = function(declutterGroup, feature) { /** * @private * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @param {Object.} skippedFeaturesHash Ids of features * to skip. * @param {Array.<*>} instructions Instructions array. * @param {function((ol.Feature|ol.render.Feature)): T|undefined} * featureCallback Feature callback. - * @param {ol.Extent=} opt_hitExtent Only check features that intersect this + * @param {module:ol/extent~Extent=} opt_hitExtent Only check features that intersect this * extent. * @return {T|undefined} Callback result. * @template T @@ -851,7 +851,7 @@ CanvasReplay.prototype.replay_ = function( /** * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @param {number} viewRotation View rotation. * @param {Object.} skippedFeaturesHash Ids of features * to skip. @@ -866,13 +866,13 @@ CanvasReplay.prototype.replay = function( /** * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @param {number} viewRotation View rotation. * @param {Object.} skippedFeaturesHash Ids of features * to skip. * @param {function((ol.Feature|ol.render.Feature)): T=} opt_featureCallback * Feature callback. - * @param {ol.Extent=} opt_hitExtent Only check features that intersect this + * @param {module:ol/extent~Extent=} opt_hitExtent Only check features that intersect this * extent. * @return {T|undefined} Callback result. * @template T @@ -1077,7 +1077,7 @@ CanvasReplay.prototype.finish = UNDEFINED; * Get the buffered rendering extent. Rendering will be clipped to the extent * provided to the constructor. To account for symbolizers that may intersect * this extent, we calculate a buffered extent (e.g. based on stroke width). - * @return {ol.Extent} The buffered rendering extent. + * @return {module:ol/extent~Extent} The buffered rendering extent. * @protected */ CanvasReplay.prototype.getBufferedMaxExtent = function() { diff --git a/src/ol/render/canvas/ReplayGroup.js b/src/ol/render/canvas/ReplayGroup.js index 38bcc251e1..c2dc394408 100644 --- a/src/ol/render/canvas/ReplayGroup.js +++ b/src/ol/render/canvas/ReplayGroup.js @@ -20,7 +20,7 @@ import {create as createTransform, compose as composeTransform} from '../../tran /** * @type {Object.)>} */ const BATCH_CONSTRUCTORS = { @@ -37,7 +37,7 @@ const BATCH_CONSTRUCTORS = { * @constructor * @extends {ol.render.ReplayGroup} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {boolean} overlaps The replay group can have overlapping geometries. @@ -70,7 +70,7 @@ const CanvasReplayGroup = function( /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.maxExtent_ = maxExtent; @@ -112,7 +112,7 @@ const CanvasReplayGroup = function( /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.hitDetectionTransform_ = createTransform(); }; @@ -238,7 +238,7 @@ CanvasReplayGroup.prototype.addDeclutter = function(group) { /** * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. */ CanvasReplayGroup.prototype.clip = function(context, transform) { const flatClipCoords = this.getClipCoords(transform); @@ -282,7 +282,7 @@ CanvasReplayGroup.prototype.finish = function() { /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. * @param {number} rotation Rotation. * @param {number} hitTolerance Hit tolerance in pixels. @@ -315,7 +315,7 @@ CanvasReplayGroup.prototype.forEachFeatureAtCoordinate = function( } /** - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ let hitExtent; if (this.renderBuffer_ !== undefined) { @@ -396,7 +396,7 @@ CanvasReplayGroup.prototype.forEachFeatureAtCoordinate = function( /** - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @return {Array.} Clip coordinates. */ CanvasReplayGroup.prototype.getClipCoords = function(transform) { @@ -451,7 +451,7 @@ CanvasReplayGroup.prototype.isEmpty = function() { /** * @param {CanvasRenderingContext2D} context Context. - * @param {ol.Transform} transform Transform. + * @param {module:ol/transform~Transform} transform Transform. * @param {number} viewRotation View rotation. * @param {Object.} skippedFeaturesHash Ids of features * to skip. diff --git a/src/ol/render/canvas/TextReplay.js b/src/ol/render/canvas/TextReplay.js index 1d9922176d..1349f55b10 100644 --- a/src/ol/render/canvas/TextReplay.js +++ b/src/ol/render/canvas/TextReplay.js @@ -18,7 +18,7 @@ import TextPlacement from '../../style/TextPlacement.js'; * @constructor * @extends {ol.render.canvas.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Maximum extent. + * @param {module:ol/extent~Extent} maxExtent Maximum extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {boolean} overlaps The replay can have overlapping geometries. diff --git a/src/ol/render/webgl/CircleReplay.js b/src/ol/render/webgl/CircleReplay.js index e6005b622b..03a39f2968 100644 --- a/src/ol/render/webgl/CircleReplay.js +++ b/src/ol/render/webgl/CircleReplay.js @@ -19,7 +19,7 @@ import WebGLBuffer from '../../webgl/Buffer.js'; * @constructor * @extends {ol.render.webgl.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLCircleReplay = function(tolerance, maxExtent) { diff --git a/src/ol/render/webgl/ImageReplay.js b/src/ol/render/webgl/ImageReplay.js index ed6076745a..59e34a5c03 100644 --- a/src/ol/render/webgl/ImageReplay.js +++ b/src/ol/render/webgl/ImageReplay.js @@ -9,7 +9,7 @@ import WebGLBuffer from '../../webgl/Buffer.js'; * @constructor * @extends {ol.render.webgl.TextureReplay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLImageReplay = function(tolerance, maxExtent) { diff --git a/src/ol/render/webgl/Immediate.js b/src/ol/render/webgl/Immediate.js index 13f1155300..47874f24aa 100644 --- a/src/ol/render/webgl/Immediate.js +++ b/src/ol/render/webgl/Immediate.js @@ -12,11 +12,11 @@ import WebGLReplayGroup from '../webgl/ReplayGroup.js'; * @constructor * @extends {ol.render.VectorContext} * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. - * @param {ol.Extent} extent Extent. + * @param {module:ol/size~Size} size Size. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} pixelRatio Pixel ratio. * @struct */ diff --git a/src/ol/render/webgl/LineStringReplay.js b/src/ol/render/webgl/LineStringReplay.js index fd45af9c49..5398ebf57b 100644 --- a/src/ol/render/webgl/LineStringReplay.js +++ b/src/ol/render/webgl/LineStringReplay.js @@ -39,7 +39,7 @@ const Instruction = { * @constructor * @extends {ol.render.webgl.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLLineStringReplay = function(tolerance, maxExtent) { diff --git a/src/ol/render/webgl/PolygonReplay.js b/src/ol/render/webgl/PolygonReplay.js index 1e0a7c9088..30fee93002 100644 --- a/src/ol/render/webgl/PolygonReplay.js +++ b/src/ol/render/webgl/PolygonReplay.js @@ -24,7 +24,7 @@ import WebGLBuffer from '../../webgl/Buffer.js'; * @constructor * @extends {ol.render.webgl.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLPolygonReplay = function(tolerance, maxExtent) { diff --git a/src/ol/render/webgl/Replay.js b/src/ol/render/webgl/Replay.js index cefdfc8fb4..5f3ae52bda 100644 --- a/src/ol/render/webgl/Replay.js +++ b/src/ol/render/webgl/Replay.js @@ -20,7 +20,7 @@ import {ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, TRIANGLES, * @abstract * @extends {ol.render.VectorContext} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLReplay = function(tolerance, maxExtent) { @@ -35,7 +35,7 @@ const WebGLReplay = function(tolerance, maxExtent) { /** * @protected * @const - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.maxExtent = maxExtent; @@ -45,25 +45,25 @@ const WebGLReplay = function(tolerance, maxExtent) { * we use the "Rendering Relative to Eye" technique described in the "3D * Engine Design for Virtual Globes" book. * @protected - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.origin = getCenter(maxExtent); /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.projectionMatrix_ = createTransform(); /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.offsetRotateMatrix_ = createTransform(); /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.offsetScaleMatrix_ = createTransform(); @@ -143,7 +143,7 @@ WebGLReplay.prototype.finish = function(context) {}; * @protected * @param {WebGLRenderingContext} gl gl. * @param {ol.webgl.Context} context Context. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @return {ol.render.webgl.circlereplay.defaultshader.Locations| ol.render.webgl.linestringreplay.defaultshader.Locations| @@ -185,7 +185,7 @@ WebGLReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hi * @param {Object.} skippedFeaturesHash Ids of features * to skip. * @param {function((ol.Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting + * @param {module:ol/extent~Extent=} opt_hitExtent Hit extent: Only features intersecting * this extent are checked. * @return {T|undefined} Callback result. * @template T @@ -201,7 +201,7 @@ WebGLReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, ski * to skip. * @param {function((ol.Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. * @param {boolean} oneByOne Draw features one-by-one for the hit-detecion. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting + * @param {module:ol/extent~Extent=} opt_hitExtent Hit extent: Only features intersecting * this extent are checked. * @return {T|undefined} Callback result. * @template T @@ -246,17 +246,17 @@ WebGLReplay.prototype.drawHitDetectionReplayAll = function(gl, context, skippedF /** * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {number} opacity Global opacity. * @param {Object.} skippedFeaturesHash Ids of features * to skip. * @param {function((ol.Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. * @param {boolean} oneByOne Draw features one-by-one for the hit-detecion. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting + * @param {module:ol/extent~Extent=} opt_hitExtent Hit extent: Only features intersecting * this extent are checked. * @return {T|undefined} Callback result. * @template T diff --git a/src/ol/render/webgl/ReplayGroup.js b/src/ol/render/webgl/ReplayGroup.js index 4fb2cceb78..b874615e78 100644 --- a/src/ol/render/webgl/ReplayGroup.js +++ b/src/ol/render/webgl/ReplayGroup.js @@ -21,7 +21,7 @@ const HIT_DETECTION_SIZE = [1, 1]; /** * @type {Object.} + * module:ol/extent~Extent)>} */ const BATCH_CONSTRUCTORS = { 'Circle': WebGLCircleReplay, @@ -36,7 +36,7 @@ const BATCH_CONSTRUCTORS = { * @constructor * @extends {ol.render.ReplayGroup} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @param {number=} opt_renderBuffer Render buffer. * @struct */ @@ -44,7 +44,7 @@ const WebGLReplayGroup = function(tolerance, maxExtent, opt_renderBuffer) { ReplayGroup.call(this); /** - * @type {ol.Extent} + * @type {module:ol/extent~Extent} * @private */ this.maxExtent_ = maxExtent; @@ -152,10 +152,10 @@ WebGLReplayGroup.prototype.isEmpty = function() { /** * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {number} opacity Global opacity. * @param {Object.} skippedFeaturesHash Ids of features @@ -187,17 +187,17 @@ WebGLReplayGroup.prototype.replay = function(context, /** * @private * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {number} opacity Global opacity. * @param {Object.} skippedFeaturesHash Ids of features * to skip. * @param {function((ol.Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. * @param {boolean} oneByOne Draw features one-by-one for the hit-detecion. - * @param {ol.Extent=} opt_hitExtent Hit extent: Only features intersecting + * @param {module:ol/extent~Extent=} opt_hitExtent Hit extent: Only features intersecting * this extent are checked. * @return {T|undefined} Callback result. * @template T @@ -231,12 +231,12 @@ WebGLReplayGroup.prototype.replayHitDetection_ = function(context, /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {number} opacity Global opacity. * @param {Object.} skippedFeaturesHash Ids of features @@ -255,7 +255,7 @@ WebGLReplayGroup.prototype.forEachFeatureAtCoordinate = function( /** - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ let hitExtent; if (this.renderBuffer_ !== undefined) { @@ -286,12 +286,12 @@ WebGLReplayGroup.prototype.forEachFeatureAtCoordinate = function( /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {ol.webgl.Context} context Context. - * @param {ol.Coordinate} center Center. + * @param {module:ol/coordinate~Coordinate} center Center. * @param {number} resolution Resolution. * @param {number} rotation Rotation. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {number} opacity Global opacity. * @param {Object.} skippedFeaturesHash Ids of features diff --git a/src/ol/render/webgl/TextReplay.js b/src/ol/render/webgl/TextReplay.js index 739e587a74..177bb3f2d6 100644 --- a/src/ol/render/webgl/TextReplay.js +++ b/src/ol/render/webgl/TextReplay.js @@ -18,7 +18,7 @@ import WebGLBuffer from '../../webgl/Buffer.js'; * @constructor * @extends {ol.render.webgl.TextureReplay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLTextReplay = function(tolerance, maxExtent) { diff --git a/src/ol/render/webgl/TextureReplay.js b/src/ol/render/webgl/TextureReplay.js index ceab45f4ff..a33efa7baf 100644 --- a/src/ol/render/webgl/TextureReplay.js +++ b/src/ol/render/webgl/TextureReplay.js @@ -15,7 +15,7 @@ import {createTexture} from '../../webgl/Context.js'; * @abstract * @extends {ol.render.webgl.Replay} * @param {number} tolerance Tolerance. - * @param {ol.Extent} maxExtent Max extent. + * @param {module:ol/extent~Extent} maxExtent Max extent. * @struct */ const WebGLTextureReplay = function(tolerance, maxExtent) { diff --git a/src/ol/renderer/Layer.js b/src/ol/renderer/Layer.js index 8b2cb853c6..de168794c7 100644 --- a/src/ol/renderer/Layer.js +++ b/src/ol/renderer/Layer.js @@ -33,7 +33,7 @@ inherits(LayerRenderer, Observable); /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {olx.FrameState} frameState Frame state. * @param {number} hitTolerance Hit tolerance in pixels. * @param {function(this: S, (ol.Feature|ol.render.Feature), ol.layer.Layer): T} @@ -46,7 +46,7 @@ LayerRenderer.prototype.forEachFeatureAtCoordinate = UNDEFINED; /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {olx.FrameState} frameState Frame state. * @return {boolean} Is there a feature at the given coordinate? */ @@ -157,7 +157,7 @@ LayerRenderer.prototype.scheduleExpireCache = function(frameState, tileSource) { }.bind(null, tileSource); frameState.postRenderFunctions.push( - /** @type {ol.PostRenderFunction} */ (postRenderFunction) + /** @type {module:ol/PluggableMap~PostRenderFunction} */ (postRenderFunction) ); } }; @@ -199,7 +199,7 @@ LayerRenderer.prototype.updateUsedTiles = function(usedTiles, tileSource, z, til * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} currentZ Current Z. * @param {number} preload Load low resolution tiles up to 'preload' levels. * @param {function(this: T, ol.Tile)=} opt_tileCallback Tile callback. diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index 194a20f2e8..3a442b6924 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -38,7 +38,7 @@ const MapRenderer = function(container, map) { /** * @private - * @type {Object.} + * @type {Object.} */ this.layerRendererListeners_ = {}; @@ -87,7 +87,7 @@ function expireIconCache(map, frameState) { /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {olx.FrameState} frameState FrameState. * @param {number} hitTolerance Hit tolerance in pixels. * @param {function(this: S, (ol.Feature|ol.render.Feature), @@ -157,7 +157,7 @@ MapRenderer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameSta /** * @abstract - * @param {ol.Pixel} pixel Pixel. + * @param {module:ol~Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. @@ -175,7 +175,7 @@ MapRenderer.prototype.forEachLayerAtPixel = function(pixel, frameState, callback /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {olx.FrameState} frameState FrameState. * @param {number} hitTolerance Hit tolerance in pixels. * @param {function(this: U, ol.layer.Layer): boolean} layerFilter Layer filter @@ -311,7 +311,7 @@ MapRenderer.prototype.removeUnusedLayerRenderers_ = function(map, frameState) { * @protected */ MapRenderer.prototype.scheduleExpireIconCache = function(frameState) { - frameState.postRenderFunctions.push(/** @type {ol.PostRenderFunction} */ (expireIconCache)); + frameState.postRenderFunctions.push(/** @type {module:ol/PluggableMap~PostRenderFunction} */ (expireIconCache)); }; @@ -323,7 +323,7 @@ MapRenderer.prototype.scheduleRemoveUnusedLayerRenderers = function(frameState) for (const layerKey in this.layerRenderers_) { if (!(layerKey in frameState.layerStates)) { frameState.postRenderFunctions.push( - /** @type {ol.PostRenderFunction} */ (this.removeUnusedLayerRenderers_.bind(this)) + /** @type {module:ol/PluggableMap~PostRenderFunction} */ (this.removeUnusedLayerRenderers_.bind(this)) ); return; } @@ -332,8 +332,8 @@ MapRenderer.prototype.scheduleRemoveUnusedLayerRenderers = function(frameState) /** - * @param {ol.LayerState} state1 First layer state. - * @param {ol.LayerState} state2 Second layer state. + * @param {module:ol/layer/Layer~State} state1 First layer state. + * @param {module:ol/layer/Layer~State} state2 Second layer state. * @return {number} The zIndex difference. */ export function sortByZIndex(state1, state2) { diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index 2c07a68215..5a4825b4d4 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -33,7 +33,7 @@ const CanvasImageLayerRenderer = function(imageLayer) { /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.imageTransform_ = createTransform(); diff --git a/src/ol/renderer/canvas/IntermediateCanvas.js b/src/ol/renderer/canvas/IntermediateCanvas.js index 2193b8ed72..b0fdf227d6 100644 --- a/src/ol/renderer/canvas/IntermediateCanvas.js +++ b/src/ol/renderer/canvas/IntermediateCanvas.js @@ -21,7 +21,7 @@ const IntermediateCanvasRenderer = function(layer) { /** * @protected - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.coordinateToCanvasPixelTransform = createTransform(); @@ -52,7 +52,7 @@ IntermediateCanvasRenderer.prototype.composeFrame = function(frameState, layerSt !containsExtent(extent, frameState.extent) && intersects(extent, frameState.extent); if (clipped) { - this.clip(context, frameState, /** @type {ol.Extent} */ (extent)); + this.clip(context, frameState, /** @type {module:ol/extent~Extent} */ (extent)); } const imageTransform = this.getImageTransform(); @@ -90,7 +90,7 @@ IntermediateCanvasRenderer.prototype.getImage = function() {}; /** * @abstract - * @return {!ol.Transform} Image transform. + * @return {!module:ol/transform~Transform} Image transform. */ IntermediateCanvasRenderer.prototype.getImageTransform = function() {}; diff --git a/src/ol/renderer/canvas/Layer.js b/src/ol/renderer/canvas/Layer.js index aa400f1ee1..ef9151efd5 100644 --- a/src/ol/renderer/canvas/Layer.js +++ b/src/ol/renderer/canvas/Layer.js @@ -29,7 +29,7 @@ const CanvasLayerRenderer = function(layer) { /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.transform_ = createTransform(); @@ -41,7 +41,7 @@ inherits(CanvasLayerRenderer, LayerRenderer); /** * @param {CanvasRenderingContext2D} context Context. * @param {olx.FrameState} frameState Frame state. - * @param {ol.Extent} extent Clip extent. + * @param {module:ol/extent~Extent} extent Clip extent. * @protected */ CanvasLayerRenderer.prototype.clip = function(context, frameState, extent) { @@ -49,10 +49,10 @@ CanvasLayerRenderer.prototype.clip = function(context, frameState, extent) { const width = frameState.size[0] * pixelRatio; const height = frameState.size[1] * pixelRatio; const rotation = frameState.viewState.rotation; - const topLeft = getTopLeft(/** @type {ol.Extent} */ (extent)); - const topRight = getTopRight(/** @type {ol.Extent} */ (extent)); - const bottomRight = getBottomRight(/** @type {ol.Extent} */ (extent)); - const bottomLeft = getBottomLeft(/** @type {ol.Extent} */ (extent)); + const topLeft = getTopLeft(/** @type {module:ol/extent~Extent} */ (extent)); + const topRight = getTopRight(/** @type {module:ol/extent~Extent} */ (extent)); + const bottomRight = getBottomRight(/** @type {module:ol/extent~Extent} */ (extent)); + const bottomLeft = getBottomLeft(/** @type {module:ol/extent~Extent} */ (extent)); applyTransform(frameState.coordinateToPixelTransform, topLeft); applyTransform(frameState.coordinateToPixelTransform, topRight); @@ -75,7 +75,7 @@ CanvasLayerRenderer.prototype.clip = function(context, frameState, extent) { * @param {ol.render.EventType} type Event type. * @param {CanvasRenderingContext2D} context Context. * @param {olx.FrameState} frameState Frame state. - * @param {ol.Transform=} opt_transform Transform. + * @param {module:ol/transform~Transform=} opt_transform Transform. * @private */ CanvasLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, frameState, opt_transform) { @@ -99,7 +99,7 @@ CanvasLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fr /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {olx.FrameState} frameState FrameState. * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. @@ -121,8 +121,8 @@ CanvasLayerRenderer.prototype.forEachLayerAtCoordinate = function(coordinate, fr /** * @param {CanvasRenderingContext2D} context Context. * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. - * @param {ol.Transform=} opt_transform Transform. + * @param {module:ol/layer/Layer~State} layerState Layer state. + * @param {module:ol/transform~Transform=} opt_transform Transform. * @protected */ CanvasLayerRenderer.prototype.postCompose = function(context, frameState, layerState, opt_transform) { @@ -133,7 +133,7 @@ CanvasLayerRenderer.prototype.postCompose = function(context, frameState, layerS /** * @param {CanvasRenderingContext2D} context Context. * @param {olx.FrameState} frameState Frame state. - * @param {ol.Transform=} opt_transform Transform. + * @param {module:ol/transform~Transform=} opt_transform Transform. * @protected */ CanvasLayerRenderer.prototype.preCompose = function(context, frameState, opt_transform) { @@ -144,7 +144,7 @@ CanvasLayerRenderer.prototype.preCompose = function(context, frameState, opt_tra /** * @param {CanvasRenderingContext2D} context Context. * @param {olx.FrameState} frameState Frame state. - * @param {ol.Transform=} opt_transform Transform. + * @param {module:ol/transform~Transform=} opt_transform Transform. * @protected */ CanvasLayerRenderer.prototype.dispatchRenderEvent = function(context, frameState, opt_transform) { @@ -156,7 +156,7 @@ CanvasLayerRenderer.prototype.dispatchRenderEvent = function(context, frameState * @param {olx.FrameState} frameState Frame state. * @param {number} offsetX Offset on the x-axis in view coordinates. * @protected - * @return {!ol.Transform} Transform. + * @return {!module:ol/transform~Transform} Transform. */ CanvasLayerRenderer.prototype.getTransform = function(frameState, offsetX) { const viewState = frameState.viewState; @@ -175,7 +175,7 @@ CanvasLayerRenderer.prototype.getTransform = function(frameState, offsetX) { /** * @abstract * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @param {CanvasRenderingContext2D} context Context. */ CanvasLayerRenderer.prototype.composeFrame = function(frameState, layerState, context) {}; @@ -183,7 +183,7 @@ CanvasLayerRenderer.prototype.composeFrame = function(frameState, layerState, co /** * @abstract * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @return {boolean} whether composeFrame should be called. */ CanvasLayerRenderer.prototype.prepareFrame = function(frameState, layerState) {}; diff --git a/src/ol/renderer/canvas/Map.js b/src/ol/renderer/canvas/Map.js index b76abb83a3..3ac6a63544 100644 --- a/src/ol/renderer/canvas/Map.js +++ b/src/ol/renderer/canvas/Map.js @@ -54,7 +54,7 @@ const CanvasMapRenderer = function(container, map) { /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.transform_ = createTransform(); @@ -112,7 +112,7 @@ CanvasMapRenderer.prototype.dispatchComposeEvent_ = function(type, frameState) { /** * @param {olx.FrameState} frameState Frame state. * @protected - * @return {!ol.Transform} Transform. + * @return {!module:ol/transform~Transform} Transform. */ CanvasMapRenderer.prototype.getTransform = function(frameState) { const viewState = frameState.viewState; diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index 5227dde96b..a934ed8f7e 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -36,7 +36,7 @@ const CanvasTileLayerRenderer = function(tileLayer) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.renderedExtent_ = null; @@ -54,7 +54,7 @@ const CanvasTileLayerRenderer = function(tileLayer) { /** * @protected - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.tmpExtent = createEmpty(); @@ -66,7 +66,7 @@ const CanvasTileLayerRenderer = function(tileLayer) { /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.imageTransform_ = createTransform(); @@ -300,7 +300,7 @@ CanvasTileLayerRenderer.prototype.prepareFrame = function(frameState, layerState /** * @param {ol.Tile} tile Tile. * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @param {number} x Left of the tile. * @param {number} y Top of the tile. * @param {number} w Width of the tile. diff --git a/src/ol/renderer/canvas/VectorLayer.js b/src/ol/renderer/canvas/VectorLayer.js index 9b8093865e..2874a1dc3f 100644 --- a/src/ol/renderer/canvas/VectorLayer.js +++ b/src/ol/renderer/canvas/VectorLayer.js @@ -52,7 +52,7 @@ const CanvasVectorLayerRenderer = function(vectorLayer) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.renderedExtent_ = createEmpty(); @@ -140,7 +140,7 @@ CanvasVectorLayerRenderer.prototype.composeFrame = function(frameState, layerSta const clipExtent = layerState.extent; const clipped = clipExtent !== undefined; if (clipped) { - this.clip(context, frameState, /** @type {ol.Extent} */ (clipExtent)); + this.clip(context, frameState, /** @type {module:ol/extent~Extent} */ (clipExtent)); } const replayGroup = this.replayGroup_; if (replayGroup && !replayGroup.isEmpty()) { diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js index 46f005b31a..ec33aae92a 100644 --- a/src/ol/renderer/canvas/VectorTileLayer.js +++ b/src/ol/renderer/canvas/VectorTileLayer.js @@ -83,7 +83,7 @@ const CanvasVectorTileLayerRenderer = function(layer) { /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.tmpTransform_ = createTransform(); @@ -159,7 +159,7 @@ CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function(tile, fram const pixelRatio = frameState.pixelRatio; const projection = frameState.viewState.projection; const revision = layer.getRevision(); - const renderOrder = /** @type {ol.RenderOrderFunction} */ (layer.getRenderOrder()) || null; + const renderOrder = /** @type {module:ol/render~OrderFunction} */ (layer.getRenderOrder()) || null; const replayState = tile.getReplayState(layer); if (!replayState.dirty && replayState.renderedRevision == revision && @@ -311,7 +311,7 @@ CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function(co /** * @param {ol.VectorTile} tile Tile. * @param {olx.FrameState} frameState Frame state. - * @return {ol.Transform} transform Transform. + * @return {module:ol/transform~Transform} transform Transform. * @private */ CanvasVectorTileLayerRenderer.prototype.getReplayTransform_ = function(tile, frameState) { @@ -476,7 +476,7 @@ CanvasVectorTileLayerRenderer.prototype.renderFeature = function(feature, square /** * @param {ol.VectorImageTile} tile Tile. * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @private */ CanvasVectorTileLayerRenderer.prototype.renderTileImage_ = function( diff --git a/src/ol/renderer/webgl/ImageLayer.js b/src/ol/renderer/webgl/ImageLayer.js index 60522eed4c..29bae528b7 100644 --- a/src/ol/renderer/webgl/ImageLayer.js +++ b/src/ol/renderer/webgl/ImageLayer.js @@ -50,7 +50,7 @@ const WebGLImageLayerRenderer = function(mapRenderer, imageLayer) { /** * @private - * @type {?ol.Transform} + * @type {?module:ol/transform~Transform} */ this.hitTransformationMatrix_ = null; @@ -176,7 +176,7 @@ WebGLImageLayerRenderer.prototype.prepareFrame = function(frameState, layerState } }.bind(null, gl, this.texture); frameState.postRenderFunctions.push( - /** @type {ol.PostRenderFunction} */ (postRenderFunction) + /** @type {module:ol/PluggableMap~PostRenderFunction} */ (postRenderFunction) ); } } @@ -209,10 +209,10 @@ WebGLImageLayerRenderer.prototype.prepareFrame = function(frameState, layerState * @param {number} canvasWidth Canvas width. * @param {number} canvasHeight Canvas height. * @param {number} pixelRatio Pixel ratio. - * @param {ol.Coordinate} viewCenter View center. + * @param {module:ol/coordinate~Coordinate} viewCenter View center. * @param {number} viewResolution View resolution. * @param {number} viewRotation View rotation. - * @param {ol.Extent} imageExtent Image extent. + * @param {module:ol/extent~Extent} imageExtent Image extent. * @private */ WebGLImageLayerRenderer.prototype.updateProjectionMatrix_ = function(canvasWidth, canvasHeight, pixelRatio, @@ -306,9 +306,9 @@ WebGLImageLayerRenderer.prototype.forEachLayerAtPixel = function(pixel, frameSta /** * The transformation matrix to get the pixel on the image for a * pixel on the map. - * @param {ol.Size} mapSize The map size. - * @param {ol.Size} imageSize The image size. - * @return {ol.Transform} The transformation matrix. + * @param {module:ol/size~Size} mapSize The map size. + * @param {module:ol/size~Size} imageSize The image size. + * @return {module:ol/transform~Transform} The transformation matrix. * @private */ WebGLImageLayerRenderer.prototype.getHitTransformationMatrix_ = function(mapSize, imageSize) { diff --git a/src/ol/renderer/webgl/Layer.js b/src/ol/renderer/webgl/Layer.js index 476d51e4af..6a98f45513 100644 --- a/src/ol/renderer/webgl/Layer.js +++ b/src/ol/renderer/webgl/Layer.js @@ -63,13 +63,13 @@ const WebGLLayerRenderer = function(mapRenderer, layer) { /** * @protected - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.texCoordMatrix = createTransform(); /** * @protected - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ this.projectionMatrix = createTransform(); @@ -114,7 +114,7 @@ WebGLLayerRenderer.prototype.bindFramebuffer = function(frameState, framebufferD }.bind(null, gl, this.framebuffer, this.texture); frameState.postRenderFunctions.push( - /** @type {ol.PostRenderFunction} */ (postRenderFunction) + /** @type {module:ol/PluggableMap~PostRenderFunction} */ (postRenderFunction) ); const texture = createEmptyTexture( @@ -138,7 +138,7 @@ WebGLLayerRenderer.prototype.bindFramebuffer = function(frameState, framebufferD /** * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @param {ol.webgl.Context} context Context. */ WebGLLayerRenderer.prototype.composeFrame = function(frameState, layerState, context) { @@ -208,7 +208,7 @@ WebGLLayerRenderer.prototype.dispatchComposeEvent_ = function(type, context, fra /** - * @return {!ol.Transform} Matrix. + * @return {!module:ol/transform~Transform} Matrix. */ WebGLLayerRenderer.prototype.getTexCoordMatrix = function() { return this.texCoordMatrix; @@ -224,7 +224,7 @@ WebGLLayerRenderer.prototype.getTexture = function() { /** - * @return {!ol.Transform} Matrix. + * @return {!module:ol/transform~Transform} Matrix. */ WebGLLayerRenderer.prototype.getProjectionMatrix = function() { return this.projectionMatrix; @@ -244,7 +244,7 @@ WebGLLayerRenderer.prototype.handleWebGLContextLost = function() { /** * @abstract * @param {olx.FrameState} frameState Frame state. - * @param {ol.LayerState} layerState Layer state. + * @param {module:ol/layer/Layer~State} layerState Layer state. * @param {ol.webgl.Context} context Context. * @return {boolean} whether composeFrame should be called. */ @@ -253,7 +253,7 @@ WebGLLayerRenderer.prototype.prepareFrame = function(frameState, layerState, con /** * @abstract - * @param {ol.Pixel} pixel Pixel. + * @param {module:ol~Pixel} pixel Pixel. * @param {olx.FrameState} frameState FrameState. * @param {function(this: S, ol.layer.Layer, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. diff --git a/src/ol/renderer/webgl/Map.js b/src/ol/renderer/webgl/Map.js index 32b9786eb6..a580492374 100644 --- a/src/ol/renderer/webgl/Map.js +++ b/src/ol/renderer/webgl/Map.js @@ -109,7 +109,7 @@ const WebGLMapRenderer = function(container, map) { /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.focus_ = null; @@ -124,7 +124,7 @@ const WebGLMapRenderer = function(container, map) { * @this {ol.renderer.webgl.Map} */ (function(element) { - const tileCenter = /** @type {ol.Coordinate} */ (element[1]); + const tileCenter = /** @type {module:ol/coordinate~Coordinate} */ (element[1]); const tileResolution = /** @type {number} */ (element[2]); const deltaX = tileCenter[0] - this.focus_[0]; const deltaY = tileCenter[1] - this.focus_[1]; @@ -152,7 +152,7 @@ const WebGLMapRenderer = function(container, map) { this.tileTextureQueue_.reprioritize(); const element = this.tileTextureQueue_.dequeue(); const tile = /** @type {ol.Tile} */ (element[0]); - const tileSize = /** @type {ol.Size} */ (element[3]); + const tileSize = /** @type {module:ol/size~Size} */ (element[3]); const tileGutter = /** @type {number} */ (element[4]); this.bindTileTexture( tile, tileSize, tileGutter, LINEAR, LINEAR); @@ -196,7 +196,7 @@ WebGLMapRenderer['create'] = function(container, map) { /** * @param {ol.Tile} tile Tile. - * @param {ol.Size} tileSize Tile size. + * @param {module:ol/size~Size} tileSize Tile size. * @param {number} tileGutter Tile gutter. * @param {number} magFilter Mag filter. * @param {number} minFilter Min filter. @@ -444,7 +444,7 @@ WebGLMapRenderer.prototype.renderFrame = function(frameState) { this.dispatchComposeEvent_(RenderEventType.PRECOMPOSE, frameState); - /** @type {Array.} */ + /** @type {Array.} */ const layerStatesToDraw = []; const layerStatesArray = frameState.layerStatesArray; stableSort(layerStatesArray, sortByZIndex); @@ -492,7 +492,7 @@ WebGLMapRenderer.prototype.renderFrame = function(frameState) { if (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ > WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) { frameState.postRenderFunctions.push( - /** @type {ol.PostRenderFunction} */ (this.expireCache_.bind(this)) + /** @type {module:ol/PluggableMap~PostRenderFunction} */ (this.expireCache_.bind(this)) ); } diff --git a/src/ol/renderer/webgl/TileLayer.js b/src/ol/renderer/webgl/TileLayer.js index ad610801e0..b483772af5 100644 --- a/src/ol/renderer/webgl/TileLayer.js +++ b/src/ol/renderer/webgl/TileLayer.js @@ -74,7 +74,7 @@ const WebGLTileLayerRenderer = function(mapRenderer, tileLayer) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.renderedFramebufferExtent_ = null; @@ -86,7 +86,7 @@ const WebGLTileLayerRenderer = function(mapRenderer, tileLayer) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.tmpSize_ = [0, 0]; diff --git a/src/ol/renderer/webgl/VectorLayer.js b/src/ol/renderer/webgl/VectorLayer.js index 328c32abb2..d8b5701f00 100644 --- a/src/ol/renderer/webgl/VectorLayer.js +++ b/src/ol/renderer/webgl/VectorLayer.js @@ -42,7 +42,7 @@ const WebGLVectorLayerRenderer = function(mapRenderer, vectorLayer) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.renderedExtent_ = createEmpty(); @@ -61,7 +61,7 @@ const WebGLVectorLayerRenderer = function(mapRenderer, vectorLayer) { /** * The last layer state. * @private - * @type {?ol.LayerState} + * @type {?module:ol/layer/Layer~State} */ this.layerState_ = null; diff --git a/src/ol/reproj.js b/src/ol/reproj.js index acaaf9fd77..23a586f033 100644 --- a/src/ol/reproj.js +++ b/src/ol/reproj.js @@ -13,9 +13,9 @@ import {getPointResolution, transform} from './proj.js'; * The resolution is calculated regardless of what resolutions * are actually available in the dataset (TileGrid, Image, ...). * - * @param {ol.proj.Projection} sourceProj Source projection. - * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.Coordinate} targetCenter Target center. + * @param {module:ol/proj/Projection~Projection} sourceProj Source projection. + * @param {module:ol/proj/Projection~Projection} targetProj Target projection. + * @param {module:ol/coordinate~Coordinate} targetCenter Target center. * @param {number} targetResolution Target resolution. * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0. */ @@ -61,7 +61,7 @@ export function calculateSourceResolution(sourceProj, targetProj, * @param {number} centroidY Centroid of the triangle (y coordinate in pixels). * @param {number} x X coordinate of the point (in pixels). * @param {number} y Y coordinate of the point (in pixels). - * @return {ol.Coordinate} New point 1 px farther from the centroid. + * @return {module:ol/coordinate~Coordinate} New point 1 px farther from the centroid. */ function enlargeClipPoint(centroidX, centroidY, x, y) { const dX = x - centroidX; @@ -78,13 +78,14 @@ function enlargeClipPoint(centroidX, centroidY, x, y) { * @param {number} height Height of the canvas. * @param {number} pixelRatio Pixel ratio. * @param {number} sourceResolution Source resolution. - * @param {ol.Extent} sourceExtent Extent of the data source. + * @param {module:ol/extent~Extent} sourceExtent Extent of the data source. * @param {number} targetResolution Target resolution. - * @param {ol.Extent} targetExtent Target extent. - * @param {ol.reproj.Triangulation} triangulation Calculated triangulation. - * @param {Array.<{extent: ol.Extent, + * @param {module:ol/extent~Extent} targetExtent Target extent. + * @param {module:ol/reproj/Triangulation~Triangulation} triangulation + * Calculated triangulation. + * @param {Array.<{extent: module:ol/extent~Extent, * image: (HTMLCanvasElement|Image|HTMLVideoElement)}>} sources - * Array of sources. + * Array of sources. * @param {number} gutter Gutter of the sources. * @param {boolean=} opt_renderEdges Render reprojection edges. * @return {HTMLCanvasElement} Canvas with reprojected data. diff --git a/src/ol/reproj/Image.js b/src/ol/reproj/Image.js index 742650129b..311cb59a7f 100644 --- a/src/ol/reproj/Image.js +++ b/src/ol/reproj/Image.js @@ -20,7 +20,7 @@ import Triangulation from '../reproj/Triangulation.js'; * @extends {ol.ImageBase} * @param {ol.proj.Projection} sourceProj Source projection (of the data). * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.Extent} targetExtent Target extent. + * @param {module:ol/extent~Extent} targetExtent Target extent. * @param {number} targetResolution Target resolution. * @param {number} pixelRatio Pixel ratio. * @param {ol.ReprojImageFunctionType} getImageFunction @@ -37,7 +37,7 @@ const ReprojImage = function(sourceProj, targetProj, /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.maxSourceExtent_ = sourceProj.getExtent(); const maxTargetExtent = targetProj.getExtent(); @@ -67,7 +67,7 @@ const ReprojImage = function(sourceProj, targetProj, /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.targetExtent_ = targetExtent; @@ -95,7 +95,7 @@ const ReprojImage = function(sourceProj, targetProj, /** * @private - * @type {?ol.EventsKey} + * @type {?module:ol/events~EventsKey} */ this.sourceListenerKey_ = null; @@ -190,7 +190,7 @@ ReprojImage.prototype.load = function() { * @private */ ReprojImage.prototype.unlistenSource_ = function() { - unlistenByKey(/** @type {!ol.EventsKey} */ (this.sourceListenerKey_)); + unlistenByKey(/** @type {!module:ol/events~EventsKey} */ (this.sourceListenerKey_)); this.sourceListenerKey_ = null; }; export default ReprojImage; diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js index d3c4600d04..e54fb0c5ea 100644 --- a/src/ol/reproj/Tile.js +++ b/src/ol/reproj/Tile.js @@ -23,8 +23,8 @@ import Triangulation from '../reproj/Triangulation.js'; * @param {ol.tilegrid.TileGrid} sourceTileGrid Source tile grid. * @param {ol.proj.Projection} targetProj Target projection. * @param {ol.tilegrid.TileGrid} targetTileGrid Target tile grid. - * @param {ol.TileCoord} tileCoord Coordinate of the tile. - * @param {ol.TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X. + * @param {module:ol/tilecoord~TileCoord} tileCoord Coordinate of the tile. + * @param {module:ol/tilecoord~TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X. * @param {number} pixelRatio Pixel ratio. * @param {number} gutter Gutter of the source tiles. * @param {ol.ReprojTileFunctionType} getTileFunction @@ -76,7 +76,7 @@ const ReprojTile = function(sourceProj, sourceTileGrid, /** * @private - * @type {ol.TileCoord} + * @type {module:ol/tilecoord~TileCoord} */ this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord; @@ -88,7 +88,7 @@ const ReprojTile = function(sourceProj, sourceTileGrid, /** * @private - * @type {Array.} + * @type {Array.} */ this.sourcesListenerKeys_ = null; diff --git a/src/ol/reproj/Triangulation.js b/src/ol/reproj/Triangulation.js index 6216cd1689..a9c7c2a114 100644 --- a/src/ol/reproj/Triangulation.js +++ b/src/ol/reproj/Triangulation.js @@ -35,8 +35,8 @@ const MAX_TRIANGLE_WIDTH = 0.25; * * @param {ol.proj.Projection} sourceProj Source projection. * @param {ol.proj.Projection} targetProj Target projection. - * @param {ol.Extent} targetExtent Target extent to triangulate. - * @param {ol.Extent} maxSourceExtent Maximal source extent that can be used. + * @param {module:ol/extent~Extent} targetExtent Target extent to triangulate. + * @param {module:ol/extent~Extent} maxSourceExtent Maximal source extent that can be used. * @param {number} errorThreshold Acceptable error (in source units). * @constructor */ @@ -55,13 +55,13 @@ const Triangulation = function(sourceProj, targetProj, targetExtent, */ this.targetProj_ = targetProj; - /** @type {!Object.} */ + /** @type {!Object.} */ let transformInvCache = {}; const transformInv = getTransform(this.targetProj_, this.sourceProj_); /** - * @param {ol.Coordinate} c A coordinate. - * @return {ol.Coordinate} Transformed coordinate. + * @param {module:ol/coordinate~Coordinate} c A coordinate. + * @return {module:ol/coordinate~Coordinate} Transformed coordinate. * @private */ this.transformInv_ = function(c) { @@ -73,7 +73,7 @@ const Triangulation = function(sourceProj, targetProj, targetExtent, }; /** - * @type {ol.Extent} + * @type {module:ol/extent~Extent} * @private */ this.maxSourceExtent_ = maxSourceExtent; @@ -180,12 +180,12 @@ const Triangulation = function(sourceProj, targetProj, targetExtent, /** * Adds triangle to the triangulation. - * @param {ol.Coordinate} a The target a coordinate. - * @param {ol.Coordinate} b The target b coordinate. - * @param {ol.Coordinate} c The target c coordinate. - * @param {ol.Coordinate} aSrc The source a coordinate. - * @param {ol.Coordinate} bSrc The source b coordinate. - * @param {ol.Coordinate} cSrc The source c coordinate. + * @param {module:ol/coordinate~Coordinate} a The target a coordinate. + * @param {module:ol/coordinate~Coordinate} b The target b coordinate. + * @param {module:ol/coordinate~Coordinate} c The target c coordinate. + * @param {module:ol/coordinate~Coordinate} aSrc The source a coordinate. + * @param {module:ol/coordinate~Coordinate} bSrc The source b coordinate. + * @param {module:ol/coordinate~Coordinate} cSrc The source c coordinate. * @private */ Triangulation.prototype.addTriangle_ = function(a, b, c, @@ -202,14 +202,14 @@ Triangulation.prototype.addTriangle_ = function(a, b, c, * (and reprojects the vertices) if valid. * Performs quad subdivision if needed to increase precision. * - * @param {ol.Coordinate} a The target a coordinate. - * @param {ol.Coordinate} b The target b coordinate. - * @param {ol.Coordinate} c The target c coordinate. - * @param {ol.Coordinate} d The target d coordinate. - * @param {ol.Coordinate} aSrc The source a coordinate. - * @param {ol.Coordinate} bSrc The source b coordinate. - * @param {ol.Coordinate} cSrc The source c coordinate. - * @param {ol.Coordinate} dSrc The source d coordinate. + * @param {module:ol/coordinate~Coordinate} a The target a coordinate. + * @param {module:ol/coordinate~Coordinate} b The target b coordinate. + * @param {module:ol/coordinate~Coordinate} c The target c coordinate. + * @param {module:ol/coordinate~Coordinate} d The target d coordinate. + * @param {module:ol/coordinate~Coordinate} aSrc The source a coordinate. + * @param {module:ol/coordinate~Coordinate} bSrc The source b coordinate. + * @param {module:ol/coordinate~Coordinate} cSrc The source c coordinate. + * @param {module:ol/coordinate~Coordinate} dSrc The source d coordinate. * @param {number} maxSubdivision Maximal allowed subdivision of the quad. * @private */ @@ -323,7 +323,7 @@ Triangulation.prototype.addQuad_ = function(a, b, c, d, /** * Calculates extent of the 'source' coordinates from all the triangles. * - * @return {ol.Extent} Calculated extent. + * @return {module:ol/extent~Extent} Calculated extent. */ Triangulation.prototype.calculateSourceExtent = function() { const extent = createEmpty(); diff --git a/src/ol/resolutionconstraint.js b/src/ol/resolutionconstraint.js index 7844634e29..8e58775a19 100644 --- a/src/ol/resolutionconstraint.js +++ b/src/ol/resolutionconstraint.js @@ -4,9 +4,15 @@ import {linearFindNearest} from './array.js'; import {clamp} from './math.js'; + +/** + * @typedef {function((number|undefined), number, number): (number|undefined)} Type + */ + + /** * @param {Array.} resolutions Resolutions. - * @return {ol.ResolutionConstraintType} Zoom function. + * @return {module:ol/resolutionconstraint~Type} Zoom function. */ export function createSnapToResolutions(resolutions) { return ( @@ -39,7 +45,7 @@ export function createSnapToResolutions(resolutions) { * @param {number} power Power. * @param {number} maxResolution Maximum resolution. * @param {number=} opt_maxLevel Maximum level. - * @return {ol.ResolutionConstraintType} Zoom function. + * @return {module:ol/resolutionconstraint~Type} Zoom function. */ export function createSnapToPower(power, maxResolution, opt_maxLevel) { return ( diff --git a/src/ol/rotationconstraint.js b/src/ol/rotationconstraint.js index ea4f84e098..3e71185938 100644 --- a/src/ol/rotationconstraint.js +++ b/src/ol/rotationconstraint.js @@ -3,6 +3,12 @@ */ import {toRadians} from './math.js'; + +/** + * @typedef {function((number|undefined), number): (number|undefined)} Type + */ + + /** * @param {number|undefined} rotation Rotation. * @param {number} delta Delta. @@ -33,7 +39,7 @@ export function none(rotation, delta) { /** * @param {number} n N. - * @return {ol.RotationConstraintType} Rotation constraint. + * @return {module:ol/rotationconstraint~Type} Rotation constraint. */ export function createSnapToN(n) { const theta = 2 * Math.PI / n; @@ -56,7 +62,7 @@ export function createSnapToN(n) { /** * @param {number=} opt_tolerance Tolerance. - * @return {ol.RotationConstraintType} Rotation constraint. + * @return {module:ol/rotationconstraint~Type} Rotation constraint. */ export function createSnapToZero(opt_tolerance) { const tolerance = opt_tolerance || toRadians(5); diff --git a/src/ol/size.js b/src/ol/size.js index 3bed63a6cc..8c73d4ac99 100644 --- a/src/ol/size.js +++ b/src/ol/size.js @@ -3,12 +3,19 @@ */ +/** + * An array of numbers representing a size: `[width, height]`. + * @typedef {Array.} Size + * @api + */ + + /** * Returns a buffered size. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} num The amount by which to buffer. - * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} The buffered size. + * @param {module:ol/size~Size=} opt_size Optional reusable size array. + * @return {module:ol/size~Size} The buffered size. */ export function buffer(size, num, opt_size) { if (opt_size === undefined) { @@ -22,7 +29,7 @@ export function buffer(size, num, opt_size) { /** * Determines if a size has a positive area. - * @param {ol.Size} size The size to test. + * @param {module:ol/size~Size} size The size to test. * @return {boolean} The size has a positive area. */ export function hasArea(size) { @@ -32,10 +39,10 @@ export function hasArea(size) { /** * Returns a size scaled by a ratio. The result will be an array of integers. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {number} ratio Ratio. - * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} The scaled size. + * @param {module:ol/size~Size=} opt_size Optional reusable size array. + * @return {module:ol/size~Size} The scaled size. */ export function scale(size, ratio, opt_size) { if (opt_size === undefined) { @@ -48,12 +55,12 @@ export function scale(size, ratio, opt_size) { /** - * Returns an `ol.Size` array for the passed in number (meaning: square) or - * `ol.Size` array. + * Returns an `module:ol/size~Size` array for the passed in number (meaning: square) or + * `module:ol/size~Size` array. * (meaning: non-square), - * @param {number|ol.Size} size Width and height. - * @param {ol.Size=} opt_size Optional reusable size array. - * @return {ol.Size} Size. + * @param {number|module:ol/size~Size} size Width and height. + * @param {module:ol/size~Size=} opt_size Optional reusable size array. + * @return {module:ol/size~Size} Size. * @api */ export function toSize(size, opt_size) { @@ -68,4 +75,3 @@ export function toSize(size, opt_size) { return opt_size; } } - diff --git a/src/ol/source.jsdoc b/src/ol/source.jsdoc deleted file mode 100644 index 7c86502e0e..0000000000 --- a/src/ol/source.jsdoc +++ /dev/null @@ -1,3 +0,0 @@ -/** - * @namespace ol.source - */ diff --git a/src/ol/source/BingMaps.js b/src/ol/source/BingMaps.js index 5bb46b29e0..e062301ca4 100644 --- a/src/ol/source/BingMaps.js +++ b/src/ol/source/BingMaps.js @@ -149,7 +149,7 @@ BingMaps.prototype.handleImageryMetadataResponse = function(response) { .replace('{culture}', culture); return ( /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index 4f0f3c3f08..bfe21ea3b1 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -136,7 +136,7 @@ ImageSource.prototype.findNearestResolution = function(resolution) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. @@ -180,7 +180,7 @@ ImageSource.prototype.getImage = function(extent, resolution, pixelRatio, projec /** * @abstract - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index c2461985b4..e25b39b183 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -57,7 +57,7 @@ const ImageArcGISRest = function(opt_options) { /** * @private - * @type {ol.ImageLoadFunctionType} + * @type {module:ol/Image~LoadFunction} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? options.imageLoadFunction : defaultImageLoadFunction; @@ -77,7 +77,7 @@ const ImageArcGISRest = function(opt_options) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.imageSize_ = [0, 0]; @@ -183,7 +183,7 @@ ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelR /** * Return the image load function of the source. - * @return {ol.ImageLoadFunctionType} The image load function. + * @return {module:ol/Image~LoadFunction} The image load function. * @api */ ImageArcGISRest.prototype.getImageLoadFunction = function() { @@ -192,8 +192,8 @@ ImageArcGISRest.prototype.getImageLoadFunction = function() { /** - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @param {Object} params Params. @@ -234,7 +234,7 @@ ImageArcGISRest.prototype.getUrl = function() { /** * Set the image load function of the source. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. + * @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function. * @api */ ImageArcGISRest.prototype.setImageLoadFunction = function(imageLoadFunction) { diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index a3d6e20bbf..cb3c490683 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -55,7 +55,7 @@ const ImageMapGuide = function(options) { /** * @private - * @type {ol.ImageLoadFunctionType} + * @type {module:ol/Image~LoadFunction} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? options.imageLoadFunction : defaultImageLoadFunction; @@ -158,7 +158,7 @@ ImageMapGuide.prototype.getImageInternal = function(extent, resolution, pixelRat /** * Return the image load function of the source. - * @return {ol.ImageLoadFunctionType} The image load function. + * @return {module:ol/Image~LoadFunction} The image load function. * @api */ ImageMapGuide.prototype.getImageLoadFunction = function() { @@ -167,8 +167,8 @@ ImageMapGuide.prototype.getImageLoadFunction = function() { /** - * @param {ol.Extent} extent The map extents. - * @param {ol.Size} size The viewport size. + * @param {module:ol/extent~Extent} extent The map extents. + * @param {module:ol/size~Size} size The viewport size. * @param {number} metersPerUnit The meters-per-unit value. * @param {number} dpi The display resolution. * @return {number} The computed map scale. @@ -201,8 +201,8 @@ ImageMapGuide.prototype.updateParams = function(params) { /** * @param {string} baseUrl The mapagent url. * @param {Object.} params Request parameters. - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/size~Size} size Size. * @param {ol.proj.Projection} projection Projection. * @return {string} The mapagent map image request URL. */ @@ -230,7 +230,7 @@ ImageMapGuide.prototype.getUrl = function(baseUrl, params, extent, size, project /** * Set the image load function of the MapGuide source. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. + * @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function. * @api */ ImageMapGuide.prototype.setImageLoadFunction = function(imageLoadFunction) { diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index 304b5ace52..b7b2ed442e 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -26,7 +26,7 @@ const Static = function(options) { const crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : null; - const /** @type {ol.ImageLoadFunctionType} */ imageLoadFunction = + const /** @type {module:ol/Image~LoadFunction} */ imageLoadFunction = options.imageLoadFunction !== undefined ? options.imageLoadFunction : defaultImageLoadFunction; @@ -43,7 +43,7 @@ const Static = function(options) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.imageSize_ = options.imageSize ? options.imageSize : null; diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index 4425b86772..47723e4058 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -52,7 +52,7 @@ const ImageWMS = function(opt_options) { /** * @private - * @type {ol.ImageLoadFunctionType} + * @type {module:ol/Image~LoadFunction} */ this.imageLoadFunction_ = options.imageLoadFunction !== undefined ? options.imageLoadFunction : defaultImageLoadFunction; @@ -90,7 +90,7 @@ const ImageWMS = function(opt_options) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.imageSize_ = [0, 0]; @@ -113,7 +113,7 @@ inherits(ImageWMS, ImageSource); /** * @const - * @type {ol.Size} + * @type {module:ol/size~Size} */ const GETFEATUREINFO_IMAGE_SIZE = [101, 101]; @@ -122,9 +122,9 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101]; * Return the GetFeatureInfo URL for the passed coordinate, resolution, and * projection. Return `undefined` if the GetFeatureInfo URL cannot be * constructed. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. - * @param {ol.ProjectionLike} projection Projection. + * @param {module:ol/proj~ProjectionLike} projection Projection. * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should * be provided. If `QUERY_LAYERS` is not provided then the layers specified * in the `LAYERS` parameter will be used. `VERSION` should not be @@ -245,7 +245,7 @@ ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, p /** * Return the image load function of the source. - * @return {ol.ImageLoadFunctionType} The image load function. + * @return {module:ol/Image~LoadFunction} The image load function. * @api */ ImageWMS.prototype.getImageLoadFunction = function() { @@ -254,8 +254,8 @@ ImageWMS.prototype.getImageLoadFunction = function() { /** - * @param {ol.Extent} extent Extent. - * @param {ol.Size} size Size. + * @param {module:ol/extent~Extent} extent Extent. + * @param {module:ol/size~Size} size Size. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @param {Object} params Params. @@ -323,7 +323,7 @@ ImageWMS.prototype.getUrl = function() { /** * Set the image load function of the source. - * @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function. + * @param {module:ol/Image~LoadFunction} imageLoadFunction Image load function. * @api */ ImageWMS.prototype.setImageLoadFunction = function(imageLoadFunction) { diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index be27c28e6c..b25045c5a2 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -59,7 +59,7 @@ const RasterSourceEvent = function(type, frameState, data) { /** * The raster extent. - * @type {ol.Extent} + * @type {module:ol/extent~Extent} * @api */ this.extent = frameState.extent; @@ -222,7 +222,7 @@ RasterSource.prototype.setOperation = function(operation, opt_lib) { /** * Update the stored frame state. - * @param {ol.Extent} extent The view extent (in map units). + * @param {module:ol/extent~Extent} extent The view extent (in map units). * @param {number} resolution The view resolution. * @param {ol.proj.Projection} projection The view projection. * @return {olx.FrameState} The updated frame state. @@ -379,7 +379,7 @@ let sharedContext = null; * Get image data from a renderer. * @param {ol.renderer.canvas.Layer} renderer Layer renderer. * @param {olx.FrameState} frameState The frame state. - * @param {ol.LayerState} layerState The layer state. + * @param {module:ol/layer/Layer~State} layerState The layer state. * @return {ImageData} The image data. */ function getImageData(renderer, frameState, layerState) { @@ -406,7 +406,7 @@ function getImageData(renderer, frameState, layerState) { /** * Get a list of layer states from a list of renderers. * @param {Array.} renderers Layer renderers. - * @return {Array.} The layer states. + * @return {Array.} The layer states. */ function getLayerStatesArray(renderers) { return renderers.map(function(renderer) { diff --git a/src/ol/source/Source.js b/src/ol/source/Source.js index 495d4028bd..3f0dda1712 100644 --- a/src/ol/source/Source.js +++ b/src/ol/source/Source.js @@ -80,7 +80,7 @@ Source.prototype.adaptAttributions_ = function(attributionLike) { }; /** - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. * @param {number} rotation Rotation. * @param {number} hitTolerance Hit tolerance in pixels. diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index a24109f923..74f8fe9d3a 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -61,7 +61,7 @@ const TileSource = function(options) { /** * @protected - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.tmpSize = [0, 0]; @@ -73,7 +73,7 @@ const TileSource = function(options) { /** * @protected - * @type {olx.TileOptions} + * @type {module:ol/Tile~Options} */ this.tileOptions = {transition: options.transition}; @@ -254,7 +254,7 @@ TileSource.prototype.getTilePixelRatio = function(pixelRatio) { * @param {number} z Z. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. - * @return {ol.Size} Tile size. + * @return {module:ol/size~Size} Tile size. */ TileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) { const tileGrid = this.getTileGridForProjection(projection); @@ -272,9 +272,9 @@ TileSource.prototype.getTilePixelSize = function(z, pixelRatio, projection) { * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate * is outside the resolution and extent range of the tile grid, `null` will be * returned. - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {ol.proj.Projection=} opt_projection Projection. - * @return {ol.TileCoord} Tile coordinate to be passed to the tileUrlFunction or + * @return {module:ol/tilecoord~TileCoord} Tile coordinate to be passed to the tileUrlFunction or * null if no tile URL should be created for the passed `tileCoord`. */ TileSource.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_projection) { diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index 304fa2f86c..29c5124d7b 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -50,7 +50,7 @@ const TileArcGISRest = function(opt_options) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.tmpExtent_ = createEmpty(); @@ -86,9 +86,9 @@ TileArcGISRest.prototype.getParams = function() { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Size} tileSize Tile size. - * @param {ol.Extent} tileExtent Tile extent. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/size~Size} tileSize Tile size. + * @param {module:ol/extent~Extent} tileExtent Tile extent. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @param {Object} params Params. diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js index 46369b6677..1c5144f6c1 100644 --- a/src/ol/source/TileDebug.js +++ b/src/ol/source/TileDebug.js @@ -13,8 +13,8 @@ import {getKeyZXY} from '../tilecoord.js'; /** * @constructor * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Size} tileSize Tile size. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/size~Size} tileSize Tile size. * @param {string} text Text. */ const LabeledTile = function(tileCoord, tileSize, text) { @@ -23,7 +23,7 @@ const LabeledTile = function(tileCoord, tileSize, text) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.tileSize_ = tileSize; diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index 2da8c2ee29..5329ff7c92 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -53,8 +53,8 @@ const TileImage = function(options) { /** * @protected - * @type {function(new: ol.ImageTile, ol.TileCoord, ol.TileState, string, - * ?string, ol.TileLoadFunctionType, olx.TileOptions=)} + * @type {function(new: ol.ImageTile, module:ol/tilecoord~TileCoord, ol.TileState, string, + * ?string, module:ol/Tile~LoadFunction, module:ol/Tile~Options=)} */ this.tileClass = options.tileClass !== undefined ? options.tileClass : ImageTile; @@ -343,7 +343,7 @@ TileImage.prototype.setRenderReprojectionEdges = function(render) { * (e.g. projection has no extent defined) or * for optimization reasons (custom tile size, resolutions, ...). * - * @param {ol.ProjectionLike} projection Projection. + * @param {module:ol/proj~ProjectionLike} projection Projection. * @param {ol.tilegrid.TileGrid} tilegrid Tile grid to use for the projection. * @api */ diff --git a/src/ol/source/TileUTFGrid.js b/src/ol/source/TileUTFGrid.js index 3af6715d75..1626db6fee 100644 --- a/src/ol/source/TileUTFGrid.js +++ b/src/ol/source/TileUTFGrid.js @@ -20,10 +20,10 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js'; /** * @constructor * @extends {ol.Tile} - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {ol.TileState} state State. * @param {string} src Image source URI. - * @param {ol.Extent} extent Extent of the tile. + * @param {module:ol/extent~Extent} extent Extent of the tile. * @param {boolean} preemptive Load the tile when visible (before it's needed). * @param {boolean} jsonp Load the tile as a script. */ @@ -39,7 +39,7 @@ export const CustomTile = function(tileCoord, state, src, extent, preemptive, js /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = extent; @@ -89,7 +89,7 @@ CustomTile.prototype.getImage = function() { /** * Synchronously returns data at given coordinate (if available). - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @return {*} The data. */ CustomTile.prototype.getData = function(coordinate) { @@ -132,7 +132,7 @@ CustomTile.prototype.getData = function(coordinate) { /** * Calls the callback (synchronously by default) with the available data * for given coordinate (or `null` if not yet loaded). - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {function(this: T, *)} callback Callback. * @param {T=} opt_this The object to use as `this` in the callback. * @param {boolean=} opt_request If `true` the callback is always async. @@ -273,7 +273,7 @@ const UTFGrid = function(options) { /** * @private - * @type {!ol.TileUrlFunctionType} + * @type {!module:ol/tileurlfunction~Type} */ this.tileUrlFunction_ = nullTileUrlFunction; @@ -355,7 +355,7 @@ UTFGrid.prototype.getTemplate = function() { * Calls the callback (synchronously by default) with the available data * for given coordinate and resolution (or `null` if not yet loaded or * in case of an error). - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. * @param {function(*)} callback Callback. * @param {boolean=} opt_request If `true` the callback is always async. diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index 54054c6d54..342d52af3d 100644 --- a/src/ol/source/TileWMS.js +++ b/src/ol/source/TileWMS.js @@ -82,7 +82,7 @@ const TileWMS = function(opt_options) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.tmpExtent_ = createEmpty(); @@ -98,9 +98,9 @@ inherits(TileWMS, TileImage); * Return the GetFeatureInfo URL for the passed coordinate, resolution, and * projection. Return `undefined` if the GetFeatureInfo URL cannot be * constructed. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. - * @param {ol.ProjectionLike} projection Projection. + * @param {module:ol/proj~ProjectionLike} projection Projection. * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should * be provided. If `QUERY_LAYERS` is not provided then the layers specified * in the `LAYERS` parameter will be used. `VERSION` should not be @@ -181,9 +181,9 @@ TileWMS.prototype.getParams = function() { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Size} tileSize Tile size. - * @param {ol.Extent} tileExtent Tile extent. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/size~Size} tileSize Tile size. + * @param {module:ol/extent~Extent} tileExtent Tile extent. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @param {Object} params Params. diff --git a/src/ol/source/UrlTile.js b/src/ol/source/UrlTile.js index 11e7c3b514..97f7fc068d 100644 --- a/src/ol/source/UrlTile.js +++ b/src/ol/source/UrlTile.js @@ -35,13 +35,13 @@ const UrlTile = function(options) { /** * @protected - * @type {ol.TileLoadFunctionType} + * @type {module:ol/Tile~LoadFunction} */ this.tileLoadFunction = options.tileLoadFunction; /** * @protected - * @type {ol.TileUrlFunctionType} + * @type {module:ol/tileurlfunction~Type} */ this.tileUrlFunction = this.fixedTileUrlFunction ? this.fixedTileUrlFunction.bind(this) : nullTileUrlFunction; @@ -73,14 +73,14 @@ inherits(UrlTile, TileSource); /** - * @type {ol.TileUrlFunctionType|undefined} + * @type {module:ol/tileurlfunction~Type|undefined} * @protected */ UrlTile.prototype.fixedTileUrlFunction; /** * Return the tile load function of the source. - * @return {ol.TileLoadFunctionType} TileLoadFunction + * @return {module:ol/Tile~LoadFunction} TileLoadFunction * @api */ UrlTile.prototype.getTileLoadFunction = function() { @@ -90,7 +90,7 @@ UrlTile.prototype.getTileLoadFunction = function() { /** * Return the tile URL function of the source. - * @return {ol.TileUrlFunctionType} TileUrlFunction + * @return {module:ol/tileurlfunction~Type} TileUrlFunction * @api */ UrlTile.prototype.getTileUrlFunction = function() { @@ -137,7 +137,7 @@ UrlTile.prototype.handleTileChange = function(event) { /** * Set the tile load function of the source. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. + * @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function. * @api */ UrlTile.prototype.setTileLoadFunction = function(tileLoadFunction) { @@ -149,7 +149,7 @@ UrlTile.prototype.setTileLoadFunction = function(tileLoadFunction) { /** * Set the tile URL function of the source. - * @param {ol.TileUrlFunctionType} tileUrlFunction Tile URL function. + * @param {module:ol/tileurlfunction~Type} tileUrlFunction Tile URL function. * @param {string=} opt_key Optional new tile key for the source. * @api */ diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index 9208832806..1ce27269d3 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -73,7 +73,7 @@ const VectorSource = function(opt_options) { /** * @private - * @type {ol.FeatureLoader} + * @type {module:ol/featureloader~FeatureLoader} */ this.loader_ = UNDEFINED; @@ -91,7 +91,7 @@ const VectorSource = function(opt_options) { /** * @private - * @type {string|ol.FeatureUrlFunction|undefined} + * @type {string|module:ol/featureloader~FeatureUrlFunction|undefined} */ this.url_ = options.url; @@ -120,7 +120,7 @@ const VectorSource = function(opt_options) { /** * @private - * @type {ol.structs.RBush.<{extent: ol.Extent}>} + * @type {ol.structs.RBush.<{extent: module:ol/extent~Extent}>} */ this.loadedExtentsRtree_ = new RBush(); @@ -146,7 +146,7 @@ const VectorSource = function(opt_options) { /** * @private - * @type {Object.>} + * @type {Object.>} */ this.featureChangeKeys_ = {}; @@ -423,7 +423,7 @@ VectorSource.prototype.forEachFeature = function(callback) { * a "truthy" value, iteration will stop and the function will return the same * value. * - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {function(ol.Feature): T} callback Called with each feature * whose goemetry contains the provided coordinate. * @return {T|undefined} The return value from the last call to the callback. @@ -455,7 +455,7 @@ VectorSource.prototype.forEachFeatureAtCoordinateDirect = function(coordinate, c * When `useSpatialIndex` is set to false, this method will loop through all * features, equivalent to {@link ol.source.Vector#forEachFeature}. * - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {function(ol.Feature): T} callback Called with each feature * whose bounding box intersects the provided extent. * @return {T|undefined} The return value from the last call to the callback. @@ -480,7 +480,7 @@ VectorSource.prototype.forEachFeatureInExtent = function(extent, callback) { * {@link ol.source.Vector#forEachFeatureInExtent * source.forEachFeatureInExtent()} method instead. * - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {function(ol.Feature): T} callback Called with each feature * whose geometry intersects the provided extent. * @return {T|undefined} The return value from the last call to the callback. @@ -539,7 +539,7 @@ VectorSource.prototype.getFeatures = function() { /** * Get all features whose geometry intersects the provided coordinate. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @return {Array.} Features. * @api */ @@ -559,7 +559,7 @@ VectorSource.prototype.getFeaturesAtCoordinate = function(coordinate) { * * This method is not available when the source is configured with * `useSpatialIndex` set to `false`. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {Array.} Features. * @api */ @@ -573,7 +573,7 @@ VectorSource.prototype.getFeaturesInExtent = function(extent) { * * This method is not available when the source is configured with * `useSpatialIndex` set to `false`. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {function(ol.Feature):boolean=} opt_filter Feature filter function. * The filter function will receive one argument, the {@link ol.Feature feature} * and it should return a boolean value. By default, no filtering is made. @@ -628,9 +628,9 @@ VectorSource.prototype.getClosestFeatureToCoordinate = function(coordinate, opt_ * * This method is not available when the source is configured with * `useSpatialIndex` set to `false`. - * @param {ol.Extent=} opt_extent Destination extent. If provided, no new extent + * @param {module:ol/extent~Extent=} opt_extent Destination extent. If provided, no new extent * will be created. Instead, that extent's coordinates will be overwritten. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. * @api */ VectorSource.prototype.getExtent = function(opt_extent) { @@ -681,7 +681,7 @@ VectorSource.prototype.getResolutions = function() {}; /** * Get the url associated with this source. * - * @return {string|ol.FeatureUrlFunction|undefined} The url. + * @return {string|module:ol/featureloader~FeatureUrlFunction|undefined} The url. * @api */ VectorSource.prototype.getUrl = function() { @@ -750,7 +750,7 @@ VectorSource.prototype.isEmpty = function() { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} resolution Resolution. * @param {ol.proj.Projection} projection Projection. */ @@ -761,7 +761,7 @@ VectorSource.prototype.loadFeatures = function(extent, resolution, projection) { const extentToLoad = extentsToLoad[i]; const alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad, /** - * @param {{extent: ol.Extent}} object Object. + * @param {{extent: module:ol/extent~Extent}} object Object. * @return {boolean} Contains. */ function(object) { @@ -777,7 +777,7 @@ VectorSource.prototype.loadFeatures = function(extent, resolution, projection) { /** * Remove an extent from the list of loaded extents. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @api */ VectorSource.prototype.removeLoadedExtent = function(extent) { @@ -859,7 +859,7 @@ VectorSource.prototype.removeFromIdIndex_ = function(feature) { /** * Set the new loader of the source. The next loadFeatures call will use the * new loader. - * @param {ol.FeatureLoader} loader The loader to set. + * @param {module:ol/featureloader~FeatureLoader} loader The loader to set. * @api */ VectorSource.prototype.setLoader = function(loader) { diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 9bb611aba7..0f42526934 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -74,8 +74,8 @@ const VectorTileSource = function(options) { /** * @protected - * @type {function(new: ol.VectorTile, ol.TileCoord, ol.TileState, string, - * ol.format.Feature, ol.TileLoadFunctionType)} + * @type {function(new: ol.VectorTile, module:ol/tilecoord~TileCoord, ol.TileState, string, + * ol.format.Feature, module:ol/Tile~LoadFunction)} */ this.tileClass = options.tileClass ? options.tileClass : VectorTile; diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index dd631611e8..937038cd00 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -104,7 +104,7 @@ const WMTS = function(options) { /** * @param {string} template Template. - * @return {ol.TileUrlFunctionType} Tile URL function. + * @return {module:ol/tileurlfunction~Type} Tile URL function. * @private */ this.createFromWMTSTemplate_ = function(template) { @@ -121,7 +121,7 @@ const WMTS = function(options) { return ( /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. diff --git a/src/ol/source/Zoomify.js b/src/ol/source/Zoomify.js index fc45850d5b..0b50cf352c 100644 --- a/src/ol/source/Zoomify.js +++ b/src/ol/source/Zoomify.js @@ -27,12 +27,12 @@ const TierSizeCalculation = { * @constructor * @extends {ol.ImageTile} * @param {ol.tilegrid.TileGrid} tileGrid TileGrid that the tile belongs to. - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {ol.TileState} state State. * @param {string} src Image source URI. * @param {?string} crossOrigin Cross origin. - * @param {ol.TileLoadFunctionType} tileLoadFunction Tile load function. - * @param {olx.TileOptions=} opt_options Tile options. + * @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function. + * @param {module:ol/Tile~Options=} opt_options Tile options. */ export const CustomTile = function( tileGrid, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) { @@ -47,7 +47,7 @@ export const CustomTile = function( /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.tileSize_ = toSize(tileGrid.getTileSize(tileCoord[0])); }; @@ -161,13 +161,13 @@ const Zoomify = function(opt_options) { /** * @param {string} template Template. - * @return {ol.TileUrlFunctionType} Tile URL function. + * @return {module:ol/tileurlfunction~Type} Tile URL function. */ function createFromTemplate(template) { return ( /** - * @param {ol.TileCoord} tileCoord Tile Coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile Coordinate. * @param {number} pixelRatio Pixel ratio. * @param {ol.proj.Projection} projection Projection. * @return {string|undefined} Tile URL. diff --git a/src/ol/sphere.js b/src/ol/sphere.js index cbc9937b58..0f05e1cb90 100644 --- a/src/ol/sphere.js +++ b/src/ol/sphere.js @@ -16,7 +16,7 @@ import GeometryType from './geom/GeometryType.js'; * Object literal with options for the {@link getLength} or {@link getArea} * functions. * @typedef {Object} SphereMetricOptions - * @property {module:ol/types~ProjectionLike} [projection='EPSG:3857'] + * @property {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] * Projection of the geometry. By default, the geometry is assumed to be in * Web Mercator. * @property {number} [radius=6371008.8] Sphere radius. By default, the radius of the @@ -143,7 +143,7 @@ export function getLength(geometry, opt_options) { * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion * Laboratory, Pasadena, CA, June 2007 * - * @param {Array.} coordinates List of coordinates of a linear + * @param {Array.} coordinates List of coordinates of a linear * ring. If the ring is oriented clockwise, the area will be positive, * otherwise it will be negative. * @param {number} radius The sphere radius. @@ -232,13 +232,13 @@ export function getArea(geometry, opt_options) { /** * Returns the coordinate at the given distance and bearing from `c1`. * - * @param {module:ol/types~Coordinate} c1 The origin point (`[lon, lat]` in degrees). + * @param {module:ol/coordinate~Coordinate} c1 The origin point (`[lon, lat]` in degrees). * @param {number} distance The great-circle distance between the origin * point and the target point. * @param {number} bearing The bearing (in radians). * @param {number=} opt_radius The sphere radius to use. Defaults to the Earth's * mean radius using the WGS84 ellipsoid. - * @return {module:ol/types~Coordinate} The target point. + * @return {module:ol/coordinate~Coordinate} The target point. */ export function offset(c1, distance, bearing, opt_radius) { const radius = opt_radius || DEFAULT_RADIUS; diff --git a/src/ol/structs/LRUCache.js b/src/ol/structs/LRUCache.js index b51f3ed1ed..e16e9fa88b 100644 --- a/src/ol/structs/LRUCache.js +++ b/src/ol/structs/LRUCache.js @@ -11,7 +11,7 @@ import EventType from '../events/EventType.js'; * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring * items from the cache is the responsibility of the user. * @constructor - * @extends {ol.events.EventTarget} + * @extends {module:ol/events/EventTarget~EventTarget} * @fires ol.events.Event * @struct * @template T diff --git a/src/ol/structs/RBush.js b/src/ol/structs/RBush.js index 90afa86aef..7c4c8fee57 100644 --- a/src/ol/structs/RBush.js +++ b/src/ol/structs/RBush.js @@ -35,7 +35,7 @@ const RBush = function(opt_maxEntries) { /** * Insert a value into the RBush. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {T} value Value. */ RBush.prototype.insert = function(extent, value) { @@ -55,7 +55,7 @@ RBush.prototype.insert = function(extent, value) { /** * Bulk-insert values into the RBush. - * @param {Array.} extents Extents. + * @param {Array.} extents Extents. * @param {Array.} values Values. */ RBush.prototype.load = function(extents, values) { @@ -97,7 +97,7 @@ RBush.prototype.remove = function(value) { /** * Update the extent of a value in the RBush. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {T} value Value. */ RBush.prototype.update = function(extent, value) { @@ -124,7 +124,7 @@ RBush.prototype.getAll = function() { /** * Return all values in the given extent. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @return {Array.} All in extent. */ RBush.prototype.getInExtent = function(extent) { @@ -158,7 +158,7 @@ RBush.prototype.forEach = function(callback, opt_this) { /** * Calls a callback function with each value in the provided extent. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {function(this: S, T): *} callback Callback. * @param {S=} opt_this The object to use as `this` in `callback`. * @return {*} Callback return value. @@ -207,8 +207,8 @@ RBush.prototype.clear = function() { /** - * @param {ol.Extent=} opt_extent Extent. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent=} opt_extent Extent. + * @return {module:ol/extent~Extent} Extent. */ RBush.prototype.getExtent = function(opt_extent) { // FIXME add getExtent() to rbush diff --git a/src/ol/style.js b/src/ol/style.js index 806387d571..703b51dd99 100644 --- a/src/ol/style.js +++ b/src/ol/style.js @@ -1,10 +1,25 @@ /** * @module ol/style */ + + +/** + * A function that takes an {@link module:ol/Feature~Feature} and a `{number}` + * representing the view's resolution. The function should return a + * {@link module:ol/style/Style~Style} or an array of them. This way e.g. a + * vector layer can be styled. + * + * @typedef {function((module:ol/Feature~Feature|module:ol/render/Feature~Feature), number): + * (module:ol/style/Style~Style|Array.)} StyleFunction + * @api + */ + + import IconImageCache from './style/IconImageCache.js'; /** - * The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images. + * The {@link module:ol/style/IconImageCache~IconImageCache} for + * {@link module:ol/style/Icon~Icon} images. * @api */ export const iconImageCache = new IconImageCache(); diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index d99acb4f8b..2e62683fa6 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -71,7 +71,7 @@ const Icon = function(opt_options) { const image = options.img !== undefined ? options.img : null; /** - * @type {ol.Size} + * @type {module:ol/size~Size} */ const imgSize = options.imgSize !== undefined ? options.imgSize : null; @@ -131,7 +131,7 @@ const Icon = function(opt_options) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.size_ = options.size !== undefined ? options.size : null; diff --git a/src/ol/style/IconImage.js b/src/ol/style/IconImage.js index 311b64660e..d57390c33d 100644 --- a/src/ol/style/IconImage.js +++ b/src/ol/style/IconImage.js @@ -13,11 +13,11 @@ import {iconImageCache} from '../style.js'; * @constructor * @param {Image|HTMLCanvasElement} image Image. * @param {string|undefined} src Src. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {?string} crossOrigin Cross origin. * @param {ol.ImageState} imageState Image state. * @param {ol.Color} color Color. - * @extends {ol.events.EventTarget} + * @extends {module:ol/events/EventTarget~EventTarget} */ const IconImage = function(image, src, size, crossOrigin, imageState, color) { @@ -55,7 +55,7 @@ const IconImage = function(image, src, size, crossOrigin, imageState, color) { /** * @private - * @type {Array.} + * @type {Array.} */ this.imageListenerKeys_ = null; @@ -67,7 +67,7 @@ const IconImage = function(image, src, size, crossOrigin, imageState, color) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.size_ = size; @@ -94,7 +94,7 @@ inherits(IconImage, EventTarget); /** * @param {Image|HTMLCanvasElement} image Image. * @param {string} src Src. - * @param {ol.Size} size Size. + * @param {module:ol/size~Size} size Size. * @param {?string} crossOrigin Cross origin. * @param {ol.ImageState} imageState Image state. * @param {ol.Color} color Color. @@ -197,7 +197,7 @@ IconImage.prototype.getHitDetectionImage = function(pixelRatio) { /** - * @return {ol.Size} Image size. + * @return {module:ol/size~Size} Image size. */ IconImage.prototype.getSize = function() { return this.size_; diff --git a/src/ol/style/Image.js b/src/ol/style/Image.js index 2765867b44..073cc3b032 100644 --- a/src/ol/style/Image.js +++ b/src/ol/style/Image.js @@ -132,14 +132,14 @@ ImageStyle.prototype.getImageState = function() {}; /** * @abstract - * @return {ol.Size} Image size. + * @return {module:ol/size~Size} Image size. */ ImageStyle.prototype.getImageSize = function() {}; /** * @abstract - * @return {ol.Size} Size of the hit-detection image. + * @return {module:ol/size~Size} Size of the hit-detection image. */ ImageStyle.prototype.getHitDetectionImageSize = function() {}; @@ -155,7 +155,7 @@ ImageStyle.prototype.getOrigin = function() {}; /** * Get the size of the symbolizer (in pixels). * @abstract - * @return {ol.Size} Size. + * @return {module:ol/size~Size} Size. */ ImageStyle.prototype.getSize = function() {}; @@ -217,7 +217,7 @@ ImageStyle.prototype.setSnapToPixel = function(snapToPixel) { * @abstract * @param {function(this: T, ol.events.Event)} listener Listener function. * @param {T} thisArg Value to use as `this` when executing `listener`. - * @return {ol.EventsKey|undefined} Listener key. + * @return {module:ol/events~EventsKey|undefined} Listener key. * @template T */ ImageStyle.prototype.listenImageChange = function(listener, thisArg) {}; diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index d3e05eac6c..13400b0b4e 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -90,19 +90,19 @@ const RegularShape = function(options) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.size_ = null; /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.imageSize_ = null; /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.hitDetectionImageSize_ = null; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index 748cf67f05..52bc19db0f 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -274,9 +274,9 @@ Style.prototype.setZIndex = function(zIndex) { * Convert the provided object into a style function. Functions passed through * unchanged. Arrays of ol.style.Style or single style objects wrapped in a * new style function. - * @param {ol.StyleFunction|Array.|ol.style.Style} obj + * @param {module:ol/style~StyleFunction|Array.|ol.style.Style} obj * A style function, a single style, or an array of styles. - * @return {ol.StyleFunction} A style function. + * @return {module:ol/style~StyleFunction} A style function. */ export function toFunction(obj) { let styleFunction; diff --git a/src/ol/tilecoord.js b/src/ol/tilecoord.js index bd8f00963a..db357d0c3b 100644 --- a/src/ol/tilecoord.js +++ b/src/ol/tilecoord.js @@ -3,12 +3,20 @@ */ +/** + * An array of three numbers representing the location of a tile in a tile + * grid. The order is `z`, `x`, and `y`. `z` is the zoom level. + * @typedef {Array.} TileCoord + * @api + */ + + /** * @param {number} z Z. * @param {number} x X. * @param {number} y Y. - * @param {ol.TileCoord=} opt_tileCoord Tile coordinate. - * @return {ol.TileCoord} Tile coordinate. + * @param {module:ol/tilecoord~TileCoord=} opt_tileCoord Tile coordinate. + * @return {module:ol/tilecoord~TileCoord} Tile coordinate. */ export function createOrUpdate(z, x, y, opt_tileCoord) { if (opt_tileCoord !== undefined) { @@ -35,7 +43,7 @@ export function getKeyZXY(z, x, y) { /** * Get the key for a tile coord. - * @param {ol.TileCoord} tileCoord The tile coord. + * @param {module:ol/tilecoord~TileCoord} tileCoord The tile coord. * @return {string} Key. */ export function getKey(tileCoord) { @@ -46,7 +54,7 @@ export function getKey(tileCoord) { /** * Get a tile coord given a key. * @param {string} key The tile coord key. - * @return {ol.TileCoord} The tile coord. + * @return {module:ol/tilecoord~TileCoord} The tile coord. */ export function fromKey(key) { return key.split('/').map(Number); @@ -54,7 +62,7 @@ export function fromKey(key) { /** - * @param {ol.TileCoord} tileCoord Tile coord. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coord. * @return {number} Hash. */ export function hash(tileCoord) { @@ -63,7 +71,7 @@ export function hash(tileCoord) { /** - * @param {ol.TileCoord} tileCoord Tile coord. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coord. * @return {string} Quad key. */ export function quadKey(tileCoord) { @@ -88,8 +96,8 @@ export function quadKey(tileCoord) { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {!ol.tilegrid.TileGrid} tileGrid Tile grid. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {!module:ol/tilegrid~TileGrid} tileGrid Tile grid. * @return {boolean} Tile coordinate is within extent and zoom level range. */ export function withinExtentAndZ(tileCoord, tileGrid) { diff --git a/src/ol/tilegrid.js b/src/ol/tilegrid.js index 47eccfaf92..113c6b1ff8 100644 --- a/src/ol/tilegrid.js +++ b/src/ol/tilegrid.js @@ -12,8 +12,9 @@ import TileGrid from './tilegrid/TileGrid.js'; /** - * @param {ol.proj.Projection} projection Projection. - * @return {!ol.tilegrid.TileGrid} Default tile grid for the passed projection. + * @param {module:ol/proj/Projection~Projection} projection Projection. + * @return {!module:ol/tilegrid/TileGrid~TileGrid} Default tile grid for the + * passed projection. */ export function getForProjection(projection) { let tileGrid = projection.getDefaultTileGrid(); @@ -26,10 +27,10 @@ export function getForProjection(projection) { /** - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.proj.Projection} projection Projection. - * @return {ol.TileCoord} Tile coordinate. + * @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/proj/Projection~Projection} projection Projection. + * @return {module:ol/tilecoord~TileCoord} Tile coordinate. */ export function wrapX(tileGrid, tileCoord, projection) { const z = tileCoord[0]; @@ -47,14 +48,14 @@ export function wrapX(tileGrid, tileCoord, projection) { /** - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number=} opt_maxZoom Maximum zoom level (default is * DEFAULT_MAX_ZOOM). - * @param {number|ol.Size=} opt_tileSize Tile size (default uses + * @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses * DEFAULT_TILE_SIZE). - * @param {ol.extent.Corner=} opt_corner Extent corner (default is - * ol.extent.Corner.TOP_LEFT). - * @return {!ol.tilegrid.TileGrid} TileGrid instance. + * @param {module:ol/extent~Extent.Corner=} opt_corner Extent corner (default is + * module:ol/extent~Extent.Corner.TOP_LEFT). + * @return {!module:ol/tilegrid/TileGrid~TileGrid} TileGrid instance. */ export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) { const corner = opt_corner !== undefined ? opt_corner : Corner.TOP_LEFT; @@ -74,7 +75,7 @@ export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) { /** * Creates a tile grid with a standard XYZ tiling scheme. * @param {olx.tilegrid.XYZOptions=} opt_options Tile grid options. - * @return {!ol.tilegrid.TileGrid} Tile grid instance. + * @return {!module:ol/tilegrid/TileGrid~TileGrid} Tile grid instance. * @api */ export function createXYZ(opt_options) { @@ -94,10 +95,10 @@ export function createXYZ(opt_options) { /** * Create a resolutions array from an extent. A zoom factor of 2 is assumed. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number=} opt_maxZoom Maximum zoom level (default is * DEFAULT_MAX_ZOOM). - * @param {number|ol.Size=} opt_tileSize Tile size (default uses + * @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses * DEFAULT_TILE_SIZE). * @return {!Array.} Resolutions array. */ @@ -123,14 +124,14 @@ function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize) { /** - * @param {ol.ProjectionLike} projection Projection. + * @param {module:ol/proj~ProjectionLike} projection Projection. * @param {number=} opt_maxZoom Maximum zoom level (default is * DEFAULT_MAX_ZOOM). - * @param {number|ol.Size=} opt_tileSize Tile size (default uses + * @param {number|module:ol/size~Size=} opt_tileSize Tile size (default uses * DEFAULT_TILE_SIZE). - * @param {ol.extent.Corner=} opt_corner Extent corner (default is - * ol.extent.Corner.BOTTOM_LEFT). - * @return {!ol.tilegrid.TileGrid} TileGrid instance. + * @param {module:ol/extent~Extent.Corner=} opt_corner Extent corner (default is + * module:ol/extent~Extent.Corner.BOTTOM_LEFT). + * @return {!module:ol/tilegrid/TileGrid~TileGrid} TileGrid instance. */ export function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) { const extent = extentFromProjection(projection); @@ -142,8 +143,8 @@ export function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_c /** * Generate a tile grid extent from a projection. If the projection has an * extent, it is used. If not, a global extent is assumed. - * @param {ol.ProjectionLike} projection Projection. - * @return {ol.Extent} Extent. + * @param {module:ol/proj~ProjectionLike} projection Projection. + * @return {module:ol/extent~Extent} Extent. */ export function extentFromProjection(projection) { projection = getProjection(projection); diff --git a/src/ol/tilegrid/TileGrid.js b/src/ol/tilegrid/TileGrid.js index cac0b7f314..3fc612d0c8 100644 --- a/src/ol/tilegrid/TileGrid.js +++ b/src/ol/tilegrid/TileGrid.js @@ -69,13 +69,13 @@ const TileGrid = function(options) { /** * @private - * @type {ol.Coordinate} + * @type {module:ol/coordinate~Coordinate} */ this.origin_ = options.origin !== undefined ? options.origin : null; /** * @private - * @type {Array.} + * @type {Array.} */ this.origins_ = null; if (options.origins !== undefined) { @@ -97,7 +97,7 @@ const TileGrid = function(options) { /** * @private - * @type {Array.} + * @type {Array.} */ this.tileSizes_ = null; if (options.tileSizes !== undefined) { @@ -108,7 +108,7 @@ const TileGrid = function(options) { /** * @private - * @type {number|ol.Size} + * @type {number|module:ol/size~Size} */ this.tileSize_ = options.tileSize !== undefined ? options.tileSize : @@ -120,7 +120,7 @@ const TileGrid = function(options) { /** * @private - * @type {ol.Extent} + * @type {module:ol/extent~Extent} */ this.extent_ = extent !== undefined ? extent : null; @@ -133,7 +133,7 @@ const TileGrid = function(options) { /** * @private - * @type {ol.Size} + * @type {module:ol/size~Size} */ this.tmpSize_ = [0, 0]; @@ -153,7 +153,7 @@ const TileGrid = function(options) { /** * @private - * @type {ol.TileCoord} + * @type {module:ol/tilecoord~TileCoord} */ const tmpTileCoord = [0, 0, 0]; @@ -161,9 +161,9 @@ const tmpTileCoord = [0, 0, 0]; /** * Call a function with each tile coordinate for a given extent and zoom level. * - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} zoom Integer zoom level. - * @param {function(ol.TileCoord)} callback Function called with each tile coordinate. + * @param {function(module:ol/tilecoord~TileCoord)} callback Function called with each tile coordinate. * @api */ TileGrid.prototype.forEachTileCoord = function(extent, zoom, callback) { @@ -177,11 +177,11 @@ TileGrid.prototype.forEachTileCoord = function(extent, zoom, callback) { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {function(this: T, number, ol.TileRange): boolean} callback Callback. * @param {T=} opt_this The object to use as `this` in `callback`. * @param {ol.TileRange=} opt_tileRange Temporary ol.TileRange object. - * @param {ol.Extent=} opt_extent Temporary ol.Extent object. + * @param {module:ol/extent~Extent=} opt_extent Temporary module:ol/extent~Extent object. * @return {boolean} Callback succeeded. * @template T */ @@ -214,7 +214,7 @@ TileGrid.prototype.forEachTileCoordParentTileRange = function(tileCoord, callbac /** * Get the extent for this tile grid, if it was configured. - * @return {ol.Extent} Extent. + * @return {module:ol/extent~Extent} Extent. */ TileGrid.prototype.getExtent = function() { return this.extent_; @@ -244,7 +244,7 @@ TileGrid.prototype.getMinZoom = function() { /** * Get the origin for the grid at the given zoom level. * @param {number} z Integer zoom level. - * @return {ol.Coordinate} Origin. + * @return {module:ol/coordinate~Coordinate} Origin. * @api */ TileGrid.prototype.getOrigin = function(z) { @@ -278,9 +278,9 @@ TileGrid.prototype.getResolutions = function() { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {ol.TileRange=} opt_tileRange Temporary ol.TileRange object. - * @param {ol.Extent=} opt_extent Temporary ol.Extent object. + * @param {module:ol/extent~Extent=} opt_extent Temporary module:ol/extent~Extent object. * @return {ol.TileRange} Tile range. */ TileGrid.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRange, opt_extent) { @@ -302,8 +302,8 @@ TileGrid.prototype.getTileCoordChildTileRange = function(tileCoord, opt_tileRang * Get the extent for a tile range. * @param {number} z Integer zoom level. * @param {ol.TileRange} tileRange Tile range. - * @param {ol.Extent=} opt_extent Temporary ol.Extent object. - * @return {ol.Extent} Extent. + * @param {module:ol/extent~Extent=} opt_extent Temporary module:ol/extent~Extent object. + * @return {module:ol/extent~Extent} Extent. */ TileGrid.prototype.getTileRangeExtent = function(z, tileRange, opt_extent) { const origin = this.getOrigin(z); @@ -319,7 +319,7 @@ TileGrid.prototype.getTileRangeExtent = function(z, tileRange, opt_extent) { /** * Get a tile range for the given extent and integer zoom level. - * @param {ol.Extent} extent Extent. + * @param {module:ol/extent~Extent} extent Extent. * @param {number} z Integer zoom level. * @param {ol.TileRange=} opt_tileRange Temporary tile range object. * @return {ol.TileRange} Tile range. @@ -335,8 +335,8 @@ TileGrid.prototype.getTileRangeForExtentAndZ = function(extent, z, opt_tileRange /** - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @return {ol.Coordinate} Tile center. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @return {module:ol/coordinate~Coordinate} Tile center. */ TileGrid.prototype.getTileCoordCenter = function(tileCoord) { const origin = this.getOrigin(tileCoord[0]); @@ -352,9 +352,9 @@ TileGrid.prototype.getTileCoordCenter = function(tileCoord) { /** * Get the extent of a tile coordinate. * - * @param {ol.TileCoord} tileCoord Tile coordinate. - * @param {ol.Extent=} opt_extent Temporary extent object. - * @return {ol.Extent} Extent. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. + * @param {module:ol/extent~Extent=} opt_extent Temporary extent object. + * @return {module:ol/extent~Extent} Extent. * @api */ TileGrid.prototype.getTileCoordExtent = function(tileCoord, opt_extent) { @@ -374,10 +374,10 @@ TileGrid.prototype.getTileCoordExtent = function(tileCoord, opt_extent) { * method considers that coordinates that intersect tile boundaries should be * assigned the higher tile coordinate. * - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} resolution Resolution. - * @param {ol.TileCoord=} opt_tileCoord Destination ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. + * @param {module:ol/tilecoord~TileCoord=} opt_tileCoord Destination module:ol/tilecoord~TileCoord object. + * @return {module:ol/tilecoord~TileCoord} Tile coordinate. * @api */ TileGrid.prototype.getTileCoordForCoordAndResolution = function(coordinate, resolution, opt_tileCoord) { @@ -395,8 +395,8 @@ TileGrid.prototype.getTileCoordForCoordAndResolution = function(coordinate, reso * @param {boolean} reverseIntersectionPolicy Instead of letting edge * intersections go to the higher tile coordinate, let edge intersections * go to the lower tile coordinate. - * @param {ol.TileCoord=} opt_tileCoord Temporary ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. + * @param {module:ol/tilecoord~TileCoord=} opt_tileCoord Temporary module:ol/tilecoord~TileCoord object. + * @return {module:ol/tilecoord~TileCoord} Tile coordinate. * @private */ TileGrid.prototype.getTileCoordForXYAndResolution_ = function( @@ -436,8 +436,8 @@ TileGrid.prototype.getTileCoordForXYAndResolution_ = function( * @param {boolean} reverseIntersectionPolicy Instead of letting edge * intersections go to the higher tile coordinate, let edge intersections * go to the lower tile coordinate. - * @param {ol.TileCoord=} opt_tileCoord Temporary ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. + * @param {module:ol/tilecoord~TileCoord=} opt_tileCoord Temporary module:ol/tilecoord~TileCoord object. + * @return {module:ol/tilecoord~TileCoord} Tile coordinate. * @private */ TileGrid.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reverseIntersectionPolicy, opt_tileCoord) { @@ -466,10 +466,10 @@ TileGrid.prototype.getTileCoordForXYAndZ_ = function(x, y, z, reverseIntersectio /** * Get a tile coordinate given a map coordinate and zoom level. - * @param {ol.Coordinate} coordinate Coordinate. + * @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {number} z Zoom level. - * @param {ol.TileCoord=} opt_tileCoord Destination ol.TileCoord object. - * @return {ol.TileCoord} Tile coordinate. + * @param {module:ol/tilecoord~TileCoord=} opt_tileCoord Destination module:ol/tilecoord~TileCoord object. + * @return {module:ol/tilecoord~TileCoord} Tile coordinate. * @api */ TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z, opt_tileCoord) { @@ -479,7 +479,7 @@ TileGrid.prototype.getTileCoordForCoordAndZ = function(coordinate, z, opt_tileCo /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @return {number} Tile resolution. */ TileGrid.prototype.getTileCoordResolution = function(tileCoord) { @@ -490,9 +490,9 @@ TileGrid.prototype.getTileCoordResolution = function(tileCoord) { /** * Get the tile size for a zoom level. The type of the return value matches the * `tileSize` or `tileSizes` that the tile grid was configured with. To always - * get an `ol.Size`, run the result through `ol.size.toSize()`. + * get an `module:ol/size~Size`, run the result through `module:ol/size~Size.toSize()`. * @param {number} z Z. - * @return {number|ol.Size} Tile size. + * @return {number|module:ol/size~Size} Tile size. * @api */ TileGrid.prototype.getTileSize = function(z) { @@ -532,7 +532,7 @@ TileGrid.prototype.getZForResolution = function(resolution, opt_direction) { /** - * @param {!ol.Extent} extent Extent for this tile grid. + * @param {!module:ol/extent~Extent} extent Extent for this tile grid. * @private */ TileGrid.prototype.calculateTileRanges_ = function(extent) { diff --git a/src/ol/tilegrid/WMTS.js b/src/ol/tilegrid/WMTS.js index 0dc3985c68..c3287d2f0e 100644 --- a/src/ol/tilegrid/WMTS.js +++ b/src/ol/tilegrid/WMTS.js @@ -63,7 +63,7 @@ export default WMTSTileGrid; * optional TileMatrixSetLimits. * @param {Object} matrixSet An object representing a matrixSet in the * capabilities document. - * @param {ol.Extent=} opt_extent An optional extent to restrict the tile + * @param {module:ol/extent~Extent=} opt_extent An optional extent to restrict the tile * ranges the server provides. * @param {Array.=} opt_matrixLimits An optional object representing * the available matrices for tileGrid. @@ -76,11 +76,11 @@ export function createFromCapabilitiesMatrixSet(matrixSet, opt_extent, opt_matri const resolutions = []; /** @type {!Array.} */ const matrixIds = []; - /** @type {!Array.} */ + /** @type {!Array.} */ const origins = []; - /** @type {!Array.} */ + /** @type {!Array.} */ const tileSizes = []; - /** @type {!Array.} */ + /** @type {!Array.} */ const sizes = []; const matrixLimits = opt_matrixLimits !== undefined ? opt_matrixLimits : []; diff --git a/src/ol/tileurlfunction.js b/src/ol/tileurlfunction.js index bfef0b9749..92d6536607 100644 --- a/src/ol/tileurlfunction.js +++ b/src/ol/tileurlfunction.js @@ -8,8 +8,8 @@ import {hash as tileCoordHash} from './tilecoord.js'; /** * @param {string} template Template. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {ol.TileUrlFunctionType} Tile URL function. + * @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid. + * @return {module:ol/tileurlfunction~Type} Tile URL function. */ export function createFromTemplate(template, tileGrid) { const zRegEx = /\{z\}/g; @@ -18,9 +18,9 @@ export function createFromTemplate(template, tileGrid) { const dashYRegEx = /\{-y\}/g; return ( /** - * @param {ol.TileCoord} tileCoord Tile Coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile Coordinate. * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. + * @param {module:ol/proj/Projection~Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, pixelRatio, projection) { @@ -48,8 +48,8 @@ export function createFromTemplate(template, tileGrid) { /** * @param {Array.} templates Templates. - * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. - * @return {ol.TileUrlFunctionType} Tile URL function. + * @param {module:ol/tilegrid/TileGrid~TileGrid} tileGrid Tile grid. + * @return {module:ol/tileurlfunction~Type} Tile URL function. */ export function createFromTemplates(templates, tileGrid) { const len = templates.length; @@ -62,8 +62,8 @@ export function createFromTemplates(templates, tileGrid) { /** - * @param {Array.} tileUrlFunctions Tile URL Functions. - * @return {ol.TileUrlFunctionType} Tile URL function. + * @param {Array.} tileUrlFunctions Tile URL Functions. + * @return {module:ol/tileurlfunction~Type} Tile URL function. */ export function createFromTileUrlFunctions(tileUrlFunctions) { if (tileUrlFunctions.length === 1) { @@ -71,9 +71,9 @@ export function createFromTileUrlFunctions(tileUrlFunctions) { } return ( /** - * @param {ol.TileCoord} tileCoord Tile Coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile Coordinate. * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. + * @param {module:ol/proj/Projection~Projection} projection Projection. * @return {string|undefined} Tile URL. */ function(tileCoord, pixelRatio, projection) { @@ -90,9 +90,9 @@ export function createFromTileUrlFunctions(tileUrlFunctions) { /** - * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate. * @param {number} pixelRatio Pixel ratio. - * @param {ol.proj.Projection} projection Projection. + * @param {module:ol/proj/Projection~Projection} projection Projection. * @return {string|undefined} Tile URL. */ export function nullTileUrlFunction(tileCoord, pixelRatio, projection) { diff --git a/src/ol/transform.js b/src/ol/transform.js index 968b1c4c10..3ce1d35857 100644 --- a/src/ol/transform.js +++ b/src/ol/transform.js @@ -4,6 +4,13 @@ import {assert} from './asserts.js'; +/** + * An array representing an affine 2d transformation for use with + * {@link module:ol/transform} functions. The array has 6 elements. + * @typedef {!Array.} Transform + */ + + /** * Collection of affine 2d transformation functions. The functions work on an * array of 6 elements. The element order is compatible with the [SVGMatrix @@ -19,14 +26,14 @@ import {assert} from './asserts.js'; /** * @private - * @type {ol.Transform} + * @type {module:ol/transform~Transform} */ const tmp_ = new Array(6); /** * Create an identity transform. - * @return {!ol.Transform} Identity transform. + * @return {!module:ol/transform~Transform} Identity transform. */ export function create() { return [1, 0, 0, 1, 0, 0]; @@ -35,8 +42,8 @@ export function create() { /** * Resets the given transform to an identity transform. - * @param {!ol.Transform} transform Transform. - * @return {!ol.Transform} Transform. + * @param {!module:ol/transform~Transform} transform Transform. + * @return {!module:ol/transform~Transform} Transform. */ export function reset(transform) { return set(transform, 1, 0, 0, 1, 0, 0); @@ -46,9 +53,9 @@ export function reset(transform) { /** * Multiply the underlying matrices of two transforms and return the result in * the first transform. - * @param {!ol.Transform} transform1 Transform parameters of matrix 1. - * @param {!ol.Transform} transform2 Transform parameters of matrix 2. - * @return {!ol.Transform} transform1 multiplied with transform2. + * @param {!module:ol/transform~Transform} transform1 Transform parameters of matrix 1. + * @param {!module:ol/transform~Transform} transform2 Transform parameters of matrix 2. + * @return {!module:ol/transform~Transform} transform1 multiplied with transform2. */ export function multiply(transform1, transform2) { const a1 = transform1[0]; @@ -76,14 +83,14 @@ export function multiply(transform1, transform2) { /** * Set the transform components a-f on a given transform. - * @param {!ol.Transform} transform Transform. + * @param {!module:ol/transform~Transform} transform Transform. * @param {number} a The a component of the transform. * @param {number} b The b component of the transform. * @param {number} c The c component of the transform. * @param {number} d The d component of the transform. * @param {number} e The e component of the transform. * @param {number} f The f component of the transform. - * @return {!ol.Transform} Matrix with transform applied. + * @return {!module:ol/transform~Transform} Matrix with transform applied. */ export function set(transform, a, b, c, d, e, f) { transform[0] = a; @@ -98,9 +105,9 @@ export function set(transform, a, b, c, d, e, f) { /** * Set transform on one matrix from another matrix. - * @param {!ol.Transform} transform1 Matrix to set transform to. - * @param {!ol.Transform} transform2 Matrix to set transform from. - * @return {!ol.Transform} transform1 with transform from transform2 applied. + * @param {!module:ol/transform~Transform} transform1 Matrix to set transform to. + * @param {!module:ol/transform~Transform} transform2 Matrix to set transform from. + * @return {!module:ol/transform~Transform} transform1 with transform from transform2 applied. */ export function setFromArray(transform1, transform2) { transform1[0] = transform2[0]; @@ -117,9 +124,9 @@ export function setFromArray(transform1, transform2) { * Transforms the given coordinate with the given transform returning the * resulting, transformed coordinate. The coordinate will be modified in-place. * - * @param {ol.Transform} transform The transformation. - * @param {ol.Coordinate|ol.Pixel} coordinate The coordinate to transform. - * @return {ol.Coordinate|ol.Pixel} return coordinate so that operations can be + * @param {module:ol/transform~Transform} transform The transformation. + * @param {module:ol/coordinate~Coordinate|module:ol~Pixel} coordinate The coordinate to transform. + * @return {module:ol/coordinate~Coordinate|module:ol~Pixel} return coordinate so that operations can be * chained together. */ export function apply(transform, coordinate) { @@ -133,9 +140,9 @@ export function apply(transform, coordinate) { /** * Applies rotation to the given transform. - * @param {!ol.Transform} transform Transform. + * @param {!module:ol/transform~Transform} transform Transform. * @param {number} angle Angle in radians. - * @return {!ol.Transform} The rotated transform. + * @return {!module:ol/transform~Transform} The rotated transform. */ export function rotate(transform, angle) { const cos = Math.cos(angle); @@ -146,10 +153,10 @@ export function rotate(transform, angle) { /** * Applies scale to a given transform. - * @param {!ol.Transform} transform Transform. + * @param {!module:ol/transform~Transform} transform Transform. * @param {number} x Scale factor x. * @param {number} y Scale factor y. - * @return {!ol.Transform} The scaled transform. + * @return {!module:ol/transform~Transform} The scaled transform. */ export function scale(transform, x, y) { return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0)); @@ -158,10 +165,10 @@ export function scale(transform, x, y) { /** * Applies translation to the given transform. - * @param {!ol.Transform} transform Transform. + * @param {!module:ol/transform~Transform} transform Transform. * @param {number} dx Translation x. * @param {number} dy Translation y. - * @return {!ol.Transform} The translated transform. + * @return {!module:ol/transform~Transform} The translated transform. */ export function translate(transform, dx, dy) { return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy)); @@ -171,7 +178,7 @@ export function translate(transform, dx, dy) { /** * Creates a composite transform given an initial translation, scale, rotation, and * final translation (in that order only, not commutative). - * @param {!ol.Transform} transform The transform (will be modified in place). + * @param {!module:ol/transform~Transform} transform The transform (will be modified in place). * @param {number} dx1 Initial translation x. * @param {number} dy1 Initial translation y. * @param {number} sx Scale factor x. @@ -179,7 +186,7 @@ export function translate(transform, dx, dy) { * @param {number} angle Rotation (in counter-clockwise radians). * @param {number} dx2 Final translation x. * @param {number} dy2 Final translation y. - * @return {!ol.Transform} The composite transform. + * @return {!module:ol/transform~Transform} The composite transform. */ export function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) { const sin = Math.sin(angle); @@ -196,8 +203,8 @@ export function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) { /** * Invert the given transform. - * @param {!ol.Transform} transform Transform. - * @return {!ol.Transform} Inverse of the transform. + * @param {!module:ol/transform~Transform} transform Transform. + * @return {!module:ol/transform~Transform} Inverse of the transform. */ export function invert(transform) { const det = determinant(transform); @@ -223,7 +230,7 @@ export function invert(transform) { /** * Returns the determinant of the given matrix. - * @param {!ol.Transform} mat Matrix. + * @param {!module:ol/transform~Transform} mat Matrix. * @return {number} Determinant. */ export function determinant(mat) { diff --git a/src/ol/typedefs.js b/src/ol/typedefs.js index 88c9a8c950..d4e346bc4a 100644 --- a/src/ol/typedefs.js +++ b/src/ol/typedefs.js @@ -78,14 +78,14 @@ ol.CanvasFillState; /** * A function returning the canvas element (`{HTMLCanvasElement}`) * used by the source as an image. The arguments passed to the function are: - * {@link ol.Extent} the image extent, `{number}` the image resolution, - * `{number}` the device pixel ratio, {@link ol.Size} the image size, and + * {@link module:ol/extent~Extent} the image extent, `{number}` the image resolution, + * `{number}` the device pixel ratio, {@link module:ol/size~Size} the image size, and * {@link ol.proj.Projection} the image projection. The canvas returned by * this function is cached by the source. The this keyword inside the function * references the {@link ol.source.ImageCanvas}. * - * @typedef {function(this:ol.source.ImageCanvas, ol.Extent, number, - * number, ol.Size, ol.proj.Projection): HTMLCanvasElement} + * @typedef {function(this:ol.source.ImageCanvas, module:ol/extent~Extent, number, + * number, module:ol/size~Size, ol.proj.Projection): HTMLCanvasElement} */ ol.CanvasFunctionType; @@ -132,12 +132,6 @@ ol.CanvasStrokeState; ol.CanvasTextState; -/** - * @typedef {function((ol.Coordinate|undefined)): (ol.Coordinate|undefined)} - */ -ol.CenterConstraintType; - - /** * @typedef {{strokeStyle: (ol.ColorLike|undefined), strokeWidth: number, * size: number, lineDash: Array.}} @@ -145,47 +139,6 @@ ol.CenterConstraintType; ol.CircleRenderOptions; -/** - * A color represented as a short array [red, green, blue, alpha]. - * red, green, and blue should be integers in the range 0..255 inclusive. - * alpha should be a float in the range 0..1 inclusive. If no alpha value is - * given then `1` will be used. - * @typedef {Array.} - */ -ol.Color; - - -/** - * A type accepted by CanvasRenderingContext2D.fillStyle - * or CanvasRenderingContext2D.strokeStyle. - * Represents a color, pattern, or gradient. The origin for patterns and - * gradients as fill style is the top-left corner of the extent of the geometry - * being filled. - * - * @typedef {string|CanvasPattern|CanvasGradient} - */ -ol.ColorLike; - - -/** - * @typedef {{ - * center: ol.CenterConstraintType, - * resolution: ol.ResolutionConstraintType, - * rotation: ol.RotationConstraintType - * }} - */ -ol.Constraints; - - -/** - * A function that takes a {@link ol.Coordinate} and transforms it into a - * `{string}`. - * - * @typedef {function((ol.Coordinate|undefined)): string} - */ -ol.CoordinateFormatType; - - /** * Container for decluttered replay instructions that need to be rendered or * omitted together, i.e. when styles render both an image and text, or for the @@ -202,9 +155,9 @@ ol.DeclutterGroup; /** * A function that takes a {@link ol.MapBrowserEvent} and two - * {@link ol.Pixel}s and returns a `{boolean}`. If the condition is met, + * {@link module:ol~Pixel}s and returns a `{boolean}`. If the condition is met, * true should be returned. - * @typedef {function(ol.MapBrowserEvent, ol.Pixel, ol.Pixel):boolean} + * @typedef {function(ol.MapBrowserEvent, module:ol~Pixel, module:ol~Pixel):boolean} */ ol.DragBoxEndConditionType; @@ -214,7 +167,7 @@ ol.DragBoxEndConditionType; * arguments, and returns a geometry. The optional existing geometry is the * geometry that is returned when the function is called without a second * argument. - * @typedef {function(!Array., ol.geom.SimpleGeometry=): + * @typedef {function(!Array., ol.geom.SimpleGeometry=): * ol.geom.SimpleGeometry} */ ol.DrawGeometryFunctionType; @@ -229,81 +182,6 @@ ol.DrawGeometryFunctionType; ol.EventsConditionType; -/** - * Listener function. This function is called with an event object as argument. - * When the function returns `false`, event propagation will stop. - * - * @typedef {function(ol.events.Event)|function(ol.events.Event): boolean} - */ -ol.EventsListenerFunctionType; - - -/** - * @typedef {EventTarget|ol.events.EventTarget} - */ -ol.EventTargetLike; - - -/** - * {@link ol.source.Vector} sources use a function of this type to load - * features. - * - * This function takes an {@link ol.Extent} representing the area to be loaded, - * a `{number}` representing the resolution (map units per pixel) and an - * {@link ol.proj.Projection} for the projection as arguments. `this` within - * the function is bound to the {@link ol.source.Vector} it's called from. - * - * The function is responsible for loading the features and adding them to the - * source. - * @typedef {function(this:ol.source.Vector, ol.Extent, number, - * ol.proj.Projection)} - */ -ol.FeatureLoader; - - -/** - * {@link ol.source.Vector} sources use a function of this type to get the url - * to load features from. - * - * This function takes an {@link ol.Extent} representing the area to be loaded, - * a `{number}` representing the resolution (map units per pixel) and an - * {@link ol.proj.Projection} for the projection as arguments and returns a - * `{string}` representing the URL. - * @typedef {function(ol.Extent, number, ol.proj.Projection) : string} - */ -ol.FeatureUrlFunction; - - -/** - * A function that is called to trigger asynchronous canvas drawing. It is - * called with a "done" callback that should be called when drawing is done. - * If any error occurs during drawing, the "done" callback should be called with - * that error. - * - * @typedef {function(function(Error))} - */ -ol.ImageCanvasLoader; - - -/** - * A function that takes an {@link ol.Image} for the image and a `{string}` for - * the src as arguments. It is supposed to make it so the underlying image - * {@link ol.Image#getImage} is assigned the content specified by the src. If - * not specified, the default is - * - * function(image, src) { - * image.getImage().src = src; - * } - * - * Providing a custom `imageLoadFunction` can be useful to load images with - * post requests or - in general - through XHR requests, where the src of the - * image element would be set to a data URI when the content is loaded. - * - * @typedef {function(ol.Image, string)} - */ -ol.ImageLoadFunctionType; - - /** * @typedef {{x: number, xunits: (ol.style.IconAnchorUnits|undefined), * y: number, yunits: (ol.style.IconAnchorUnits|undefined), @@ -319,20 +197,6 @@ ol.KMLVec2_; ol.KMLGxTrackObject_; -/** - * @typedef {{layer: ol.layer.Layer, - * opacity: number, - * sourceState: ol.source.State, - * visible: boolean, - * managed: boolean, - * extent: (ol.Extent|undefined), - * zIndex: number, - * maxResolution: number, - * minResolution: number}} - */ -ol.LayerState; - - /** * @typedef {{hasZ: (boolean|undefined), hasM: (boolean|undefined)}} */ @@ -348,11 +212,11 @@ ol.LinkedListItem; /** - * A function that takes an {@link ol.Extent} and a resolution as arguments, and - * returns an array of {@link ol.Extent} with the extents to load. Usually this + * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and + * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this * is one of the standard {@link ol.loadingstrategy} strategies. * - * @typedef {function(ol.Extent, number): Array.} + * @typedef {function(module:ol/extent~Extent, number): Array.} */ ol.LoadingStrategy; @@ -371,7 +235,7 @@ ol.LRUCacheEntry; * feature: ol.Feature, * geometry: ol.geom.SimpleGeometry, * index: (number), - * segment: Array., + * segment: Array., * featureSegments: (Array.|undefined)}} */ ol.ModifySegmentDataType; @@ -422,18 +286,7 @@ ol.RegularShapeRenderOptions; /** - * A function to be used when sorting features before rendering. - * It takes two instances of {@link ol.Feature} or {@link ol.render.Feature} and - * returns a `{number}`. - * - * @typedef {function((ol.Feature|ol.render.Feature), (ol.Feature|ol.render.Feature)): - * number} - */ -ol.RenderOrderFunction; - - -/** - * @typedef {function(ol.Extent, number, number) : ol.ImageBase} + * @typedef {function(module:ol/extent~Extent, number, number) : ol.ImageBase} */ ol.ReprojImageFunctionType; @@ -447,24 +300,12 @@ ol.ReprojTileFunctionType; /** * Single triangle; consists of 3 source points and 3 target points. * - * @typedef {{source: Array., - * target: Array.}} + * @typedef {{source: Array., + * target: Array.}} */ ol.ReprojTriangle; -/** - * @typedef {function((number|undefined), number, number): (number|undefined)} - */ -ol.ResolutionConstraintType; - - -/** - * @typedef {function((number|undefined), number): (number|undefined)} - */ -ol.RotationConstraintType; - - /** * A function that takes an {@link ol.Feature} or {@link ol.render.Feature} and * an {@link ol.layer.Layer} and returns `true` if the feature may be selected @@ -478,8 +319,8 @@ ol.SelectFilterFunction; /** * @typedef {{ * snapped: {boolean}, - * vertex: (ol.Coordinate|null), - * vertexPixel: (ol.Pixel|null) + * vertex: (module:ol/coordinate~Coordinate|null), + * vertexPixel: (module:ol~Pixel|null) * }} */ ol.SnapResultType; @@ -488,7 +329,7 @@ ol.SnapResultType; /** * @typedef {{ * feature: ol.Feature, - * segment: Array. + * segment: Array. * }} */ ol.SnapSegmentDataType; @@ -496,8 +337,8 @@ ol.SnapSegmentDataType; /** * @typedef {{attributions: (ol.AttributionLike|undefined), - * extent: (null|ol.Extent|undefined), - * projection: ol.ProjectionLike, + * extent: (null|module:ol/extent~Extent|undefined), + * projection: module:ol/proj~ProjectionLike, * resolutions: (Array.|undefined), * state: (ol.source.State|undefined)}} */ @@ -507,14 +348,14 @@ ol.SourceImageOptions; /** * @typedef {{revision: number, * resolution: number, - * extent: ol.Extent}} + * extent: module:ol/extent~Extent}} */ ol.SourceRasterRenderedState; /** * @typedef {{attributions: (ol.AttributionLike|undefined), - * projection: ol.ProjectionLike, + * projection: module:ol/proj~ProjectionLike, * state: (ol.source.State|undefined), * wrapX: (boolean|undefined)}} */ @@ -524,10 +365,10 @@ ol.SourceSourceOptions; /** * @typedef {{attributions: (ol.AttributionLike|undefined), * cacheSize: (number|undefined), - * extent: (ol.Extent|undefined), + * extent: (module:ol/extent~Extent|undefined), * opaque: (boolean|undefined), * tilePixelRatio: (number|undefined), - * projection: ol.ProjectionLike, + * projection: module:ol/proj~ProjectionLike, * state: (ol.source.State|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined), * wrapX: (boolean|undefined), @@ -539,14 +380,14 @@ ol.SourceTileOptions; /** * @typedef {{attributions: (ol.AttributionLike|undefined), * cacheSize: (number|undefined), - * extent: (ol.Extent|undefined), + * extent: (module:ol/extent~Extent|undefined), * opaque: (boolean|undefined), - * projection: ol.ProjectionLike, + * projection: module:ol/proj~ProjectionLike, * state: (ol.source.State|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined), - * tileLoadFunction: ol.TileLoadFunctionType, + * tileLoadFunction: module:ol/Tile~LoadFunction, * tilePixelRatio: (number|undefined), - * tileUrlFunction: (ol.TileUrlFunctionType|undefined), + * tileUrlFunction: (module:ol/tileurlfunction~Type|undefined), * url: (string|undefined), * urls: (Array.|undefined), * wrapX: (boolean|undefined), @@ -555,17 +396,6 @@ ol.SourceTileOptions; ol.SourceUrlTileOptions; -/** - * A function that takes an {@link ol.Feature} and a `{number}` representing - * the view's resolution. The function should return a {@link ol.style.Style} - * or an array of them. This way e.g. a vector layer can be styled. - * - * @typedef {function((ol.Feature|ol.render.Feature), number): - * (ol.style.Style|Array.)} - */ -ol.StyleFunction; - - /** * A function that takes an {@link ol.Feature} as argument and returns an * {@link ol.geom.Geometry} that will be rendered and styled for the feature. @@ -582,7 +412,7 @@ ol.StyleGeometryFunction; * 1. The pixel coordinates of the geometry in GeoJSON notation. * 2. The {@link olx.render.State} of the layer renderer. * - * @typedef {function((ol.Coordinate|Array|Array.>),olx.render.State)} + * @typedef {function((module:ol/coordinate~Coordinate|Array|Array.>),olx.render.State)} */ ol.StyleRenderFunction; @@ -597,76 +427,6 @@ ol.StyleRenderFunction; ol.StyleImageOptions; -/** - * An array of three numbers representing the location of a tile in a tile - * grid. The order is `z`, `x`, and `y`. `z` is the zoom level. - * @typedef {Array.} - */ -ol.TileCoord; - - -/** - * A function that takes an {@link ol.Tile} for the tile and a `{string}` for - * the url as arguments. - * - * @typedef {function(ol.Tile, string)} - */ -ol.TileLoadFunctionType; - - -/** - * @typedef {function(ol.Tile, string, ol.Coordinate, number): number} - */ -ol.TilePriorityFunction; - - -/** - * @typedef {{ - * dirty: boolean, - * renderedRenderOrder: (null|ol.RenderOrderFunction), - * renderedTileRevision: number, - * renderedRevision: number}} - */ -ol.TileReplayState; - - -/** - * {@link ol.source.Tile} sources use a function of this type to get the url - * that provides a tile for a given tile coordinate. - * - * This function takes an {@link ol.TileCoord} for the tile coordinate, a - * `{number}` representing the pixel ratio and an {@link ol.proj.Projection} for - * the projection as arguments and returns a `{string}` representing the tile - * URL, or undefined if no tile should be requested for the passed tile - * coordinate. - * - * @typedef {function(ol.TileCoord, number, - * ol.proj.Projection): (string|undefined)} - */ -ol.TileUrlFunctionType; - - -/** - * An animation configuration - * - * @typedef {{ - * sourceCenter: (ol.Coordinate|undefined), - * targetCenter: (ol.Coordinate|undefined), - * sourceResolution: (number|undefined), - * targetResolution: (number|undefined), - * sourceRotation: (number|undefined), - * targetRotation: (number|undefined), - * anchor: (ol.Coordinate|undefined), - * start: number, - * duration: number, - * complete: boolean, - * easing: function(number):number, - * callback: (function(boolean)|undefined) - * }} - */ -ol.ViewAnimation; - - /** * @typedef {{buf: ol.webgl.Buffer, * buffer: WebGLBuffer}} @@ -706,7 +466,7 @@ ol.WebglTextureCacheEntry; /** * Number of features; bounds/extent. * @typedef {{numberOfFeatures: number, - * bounds: ol.Extent}} + * bounds: module:ol/extent~Extent}} */ ol.WFSFeatureCollectionMetadata; @@ -727,27 +487,6 @@ ol.WFSTransactionResponse; ol.WKTToken; -/** - * When using {@link ol.xml.makeChildAppender} or - * {@link ol.xml.makeSimpleNodeFactory}, the top `objectStack` item needs to - * have this structure. - * @typedef {{node:Node}} - */ -ol.XmlNodeStackItem; - - -/** - * @typedef {function(Node, Array.<*>)} - */ -ol.XmlParser; - - -/** - * @typedef {function(Node, *, Array.<*>)} - */ -ol.XmlSerializer; - - /** * @typedef {{minX: number, minY: number, maxX: number, maxY: number, * value: (Object|undefined)}} diff --git a/src/ol/types.js b/src/ol/types.js deleted file mode 100644 index 50eda27d03..0000000000 --- a/src/ol/types.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @module ol/types - */ - - -/** - * An array of numbers representing an xy coordinate. Example: `[16, 48]`. - * @typedef {Array.} Coordinate - * @api - */ - -/** - * Key to use with {@link module:ol/Observable~Observable#unByKey}. - * @typedef {Object} EventsKey - * @property {Object} [bindTo] - * @property {ol.EventsListenerFunctionType} [boundListener] - * @property {boolean} callOnce - * @property {number} [deleteIndex] - * @property {ol.EventsListenerFunctionType} listener - * @property {EventTarget|ol.events.EventTarget} target - * @property {string} type - */ - -/** - * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. - * @typedef {Array.} Extent - * @api - */ - -/** - * An array with two elements, representing a pixel. The first element is the - * x-coordinate, the second the y-coordinate of the pixel. - * @typedef {Array.} Pixel - * @api - */ - -/** - * @typedef {function(module:ol/PluggableMap~PluggableMap, ?olx.FrameState): boolean} PostRenderFunction - */ - -/** - * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier - * string or undefined. - * @typedef {module:ol/proj/Projection~Projection|string|undefined} ProjectionLike - * @api - */ - -/** - * An array of numbers representing a size: `[width, height]`. - * @typedef {Array.} Size - * @api - */ - -/** - * An array representing an affine 2d transformation for use with - * {@link module:ol/transform} functions. The array has 6 elements. - * @typedef {!Array.} Transform - */ - -/** - * A transform function accepts an array of input coordinate values, an optional - * output array, and an optional dimension (default should be 2). The function - * transforms the input coordinate values, populates the output array, and - * returns the output array. - * - * @typedef {function(Array., Array.=, number=): Array.} TransformFunction - * @api - */ diff --git a/src/ol/vec/mat4.js b/src/ol/vec/mat4.js index 1ab9600ea6..37aa91cab4 100644 --- a/src/ol/vec/mat4.js +++ b/src/ol/vec/mat4.js @@ -13,7 +13,7 @@ export function create() { /** * @param {Array.} mat4 Flattened 4x4 matrix receiving the result. - * @param {ol.Transform} transform Transformation matrix. + * @param {module:ol/transform~Transform} transform Transformation matrix. * @return {Array.} 2D transformation matrix as flattened 4x4 matrix. */ export function fromTransform(mat4, transform) { diff --git a/src/ol/xml.js b/src/ol/xml.js index c7194f0e1d..d62c477e39 100644 --- a/src/ol/xml.js +++ b/src/ol/xml.js @@ -4,10 +4,29 @@ import {extend} from './array.js'; +/** + * When using {@link module:ol/xml~makeChildAppender} or + * {@link module:ol/xml~makeSimpleNodeFactory}, the top `objectStack` item needs + * to have this structure. + * @typedef {Object} NodeStackItem + * @property {Node} node + */ + + +/** + * @typedef {function(Node, Array.<*>)} Parser + */ + + +/** + * @typedef {function(Node, *, Array.<*>)} Serializer + */ + + /** * This document should be used when creating nodes for XML serializations. This - * document is also used by {@link ol.xml.createElementNS} and - * {@link ol.xml.setAttributeNS} + * document is also used by {@link module:ol/xml~createElementNS} and + * {@link module:ol/xml~setAttributeNS} * @const * @type {Document} */ @@ -121,7 +140,7 @@ export function parse(xml) { * @param {function(this: T, Node, Array.<*>): (Array.<*>|undefined)} * valueReader Value reader. * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.XmlParser} Parser. + * @return {module:ol/xml~Parser} Parser. * @template T */ export function makeArrayExtender(valueReader, opt_this) { @@ -146,7 +165,7 @@ export function makeArrayExtender(valueReader, opt_this) { * object stack. * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.XmlParser} Parser. + * @return {module:ol/xml~Parser} Parser. * @template T */ export function makeArrayPusher(valueReader, opt_this) { @@ -170,7 +189,7 @@ export function makeArrayPusher(valueReader, opt_this) { * top of the stack. * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.XmlParser} Parser. + * @return {module:ol/xml~Parser} Parser. * @template T */ export function makeReplacer(valueReader, opt_this) { @@ -194,7 +213,7 @@ export function makeReplacer(valueReader, opt_this) { * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. * @param {string=} opt_property Property. * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.XmlParser} Parser. + * @return {module:ol/xml~Parser} Parser. * @template T */ export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) { @@ -225,7 +244,7 @@ export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) { * @param {function(this: T, Node, Array.<*>): *} valueReader Value reader. * @param {string=} opt_property Property. * @param {T=} opt_this The object to use as `this` in `valueReader`. - * @return {ol.XmlParser} Parser. + * @return {module:ol/xml~Parser} Parser. * @template T */ export function makeObjectPropertySetter(valueReader, opt_property, opt_this) { @@ -248,11 +267,11 @@ export function makeObjectPropertySetter(valueReader, opt_property, opt_this) { /** * Create a serializer that appends nodes written by its `nodeWriter` to its * designated parent. The parent is the `node` of the - * {@link ol.XmlNodeStackItem} at the top of the `objectStack`. + * {@link module:ol/xml~NodeStackItem} at the top of the `objectStack`. * @param {function(this: T, Node, V, Array.<*>)} * nodeWriter Node writer. * @param {T=} opt_this The object to use as `this` in `nodeWriter`. - * @return {ol.XmlSerializer} Serializer. + * @return {module:ol/xml~Serializer} Serializer. * @template T, V */ export function makeChildAppender(nodeWriter, opt_this) { @@ -267,7 +286,7 @@ export function makeChildAppender(nodeWriter, opt_this) { /** * Create a serializer that calls the provided `nodeWriter` from - * {@link ol.xml.serialize}. This can be used by the parent writer to have the + * {@link module:ol/xml~serialize}. This can be used by the parent writer to have the * 'nodeWriter' called with an array of values when the `nodeWriter` was * designed to serialize a single item. An example would be a LineString * geometry writer, which could be reused for writing MultiLineString @@ -275,7 +294,7 @@ export function makeChildAppender(nodeWriter, opt_this) { * @param {function(this: T, Node, V, Array.<*>)} * nodeWriter Node writer. * @param {T=} opt_this The object to use as `this` in `nodeWriter`. - * @return {ol.XmlSerializer} Serializer. + * @return {module:ol/xml~Serializer} Serializer. * @template T, V */ export function makeArraySerializer(nodeWriter, opt_this) { @@ -295,7 +314,7 @@ export function makeArraySerializer(nodeWriter, opt_this) { /** * Create a node factory which can use the `opt_keys` passed to - * {@link ol.xml.serialize} or {@link ol.xml.pushSerializeAndPop} as node names, + * {@link module:ol/xml~serialize} or {@link module:ol/xml~pushSerializeAndPop} as node names, * or a fixed node name. The namespace of the created nodes can either be fixed, * or the parent namespace will be used. * @param {string=} opt_nodeName Fixed node name which will be used for all @@ -334,8 +353,8 @@ export function makeSimpleNodeFactory(opt_nodeName, opt_namespaceURI) { /** * A node factory that creates a node using the parent's `namespaceURI` and the - * `nodeName` passed by {@link ol.xml.serialize} or - * {@link ol.xml.pushSerializeAndPop} to the node factory. + * `nodeName` passed by {@link module:ol/xml~serialize} or + * {@link module:ol/xml~pushSerializeAndPop} to the node factory. * @const * @type {function(*, Array.<*>, string=): (Node|undefined)} */ @@ -343,8 +362,8 @@ export const OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory(); /** - * Create an array of `values` to be used with {@link ol.xml.serialize} or - * {@link ol.xml.pushSerializeAndPop}, where `orderedKeys` has to be provided as + * Create an array of `values` to be used with {@link module:ol/xml~serialize} or + * {@link module:ol/xml~pushSerializeAndPop}, where `orderedKeys` has to be provided as * `opt_key` argument. * @param {Object.} object Key-value pairs for the sequence. Keys can * be a subset of the `orderedKeys`. @@ -389,7 +408,7 @@ export function makeStructureNS(namespaceURIs, structure, opt_structureNS) { /** * Parse a node using the parsers and object stack. - * @param {Object.>} parsersNS + * @param {Object.>} parsersNS * Parsers by namespace. * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. @@ -412,7 +431,7 @@ export function parseNode(parsersNS, node, objectStack, opt_this) { /** * Push an object on top of the stack, parse and return the popped object. * @param {T} object Object. - * @param {Object.>} parsersNS + * @param {Object.>} parsersNS * Parsers by namespace. * @param {Node} node Node. * @param {Array.<*>} objectStack Object stack. @@ -429,7 +448,7 @@ export function pushParseAndPop(object, parsersNS, node, objectStack, opt_this) /** * Walk through an array of `values` and call a serializer for each value. - * @param {Object.>} serializersNS + * @param {Object.>} serializersNS * Namespaced serializers. * @param {function(this: T, *, Array.<*>, (string|undefined)): (Node|undefined)} nodeFactory * Node factory. The `nodeFactory` creates the node whose namespace and name @@ -438,7 +457,7 @@ export function pushParseAndPop(object, parsersNS, node, objectStack, opt_this) * the value we want to serialize. An example for this would be different * geometry writers based on the geometry type. * @param {Array.<*>} values Values to serialize. An example would be an array - * of {@link ol.Feature} instances. + * of {@link module:ol/Feature~Feature} instances. * @param {Array.<*>} objectStack Node stack. * @param {Array.=} opt_keys Keys of the `values`. Will be passed to the * `nodeFactory`. This is used for serializing object literals where the @@ -469,7 +488,7 @@ export function serialize( /** * @param {O} object Object. - * @param {Object.>} serializersNS + * @param {Object.>} serializersNS * Namespaced serializers. * @param {function(this: T, *, Array.<*>, (string|undefined)): (Node|undefined)} nodeFactory * Node factory. The `nodeFactory` creates the node whose namespace and name @@ -478,7 +497,7 @@ export function serialize( * the value we want to serialize. An example for this would be different * geometry writers based on the geometry type. * @param {Array.<*>} values Values to serialize. An example would be an array - * of {@link ol.Feature} instances. + * of {@link module:ol/Feature~Feature} instances. * @param {Array.<*>} objectStack Node stack. * @param {Array.=} opt_keys Keys of the `values`. Will be passed to the * `nodeFactory`. This is used for serializing object literals where the