Merge pull request #8041 from fgravin/remove-olx-typedefs-ol/source

Remove olx typedefs ol/source
This commit is contained in:
Frédéric Junod
2018-04-04 11:43:09 +02:00
committed by GitHub
24 changed files with 710 additions and 2505 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -11,13 +11,34 @@ import TileImage from '../source/TileImage.js';
import {createOrUpdate, quadKey} from '../tilecoord.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @typedef {Object} Options
* @property {number} [cacheSize=2048] Cache size.
* @property {boolean} [hidpi=false] If `true` hidpi tiles will be requested.
* @property {string} [culture='en-us'] Culture code.
* @property {string} key Bing Maps API key. Get yours at http://www.bingmapsportal.com/.
* @property {string} imagerySet Type of imagery.
* @property {number} [maxZoom=21] Max zoom. Default is what's advertized by the BingMaps service.
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for Bing Maps tile data.
*
* @constructor
* @extends {ol.source.TileImage}
* @param {olx.source.BingMapsOptions} options Bing Maps options.
* @param {module:ol/source/BingMaps~Options=} options Bing Maps options.
* @api
*/
const BingMaps = function(options) {

View File

@@ -6,13 +6,38 @@ import {assign} from '../obj.js';
import SourceState from '../source/State.js';
import XYZ from '../source/XYZ.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] Projection.
* @property {number} [maxZoom=18] Max zoom.
* @property {number} [minZoom] Minimum zoom.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* @property {Object} [config] If using anonymous maps, the CartoDB config to use. See
* {@link http://docs.cartodb.com/cartodb-platform/maps-api/anonymous-maps/}
* for more detail.
* If using named maps, a key-value lookup with the template parameters.
* See {@link http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/}
* for more detail.
* @property {string} [map] If using named maps, this will be the name of the template to load.
* See {@link http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/}
* for more detail.
* @property {string} account If using named maps, this will be the name of the template to load.
*/
/**
* @classdesc
* Layer source for the CartoDB Maps API.
*
* @constructor
* @extends {ol.source.XYZ}
* @param {olx.source.CartoDBOptions} options CartoDB options.
* @param {module:ol/source/CartoDB~Options=} options CartoDB options.
* @api
*/
const CartoDB = function(options) {

View File

@@ -12,6 +12,31 @@ import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
import Point from '../geom/Point.js';
import VectorSource from '../source/Vector.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [distance=20] Minimum distance in pixels between clusters.
* @property {ol.Extent} [extent] Extent.
* @property {ol.format.Feature} [format] Format.
* @property {function(module:ol/Feature~Feature):module:ol/geom/Point~Point} [geometryFunction]
* Function that takes an {@link module:ol/Feature~Feature} as argument and returns an
* {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a
* feature should not be considered for clustering, the function should return
* `null`. The default, which works when the underyling source contains point
* features only, is
* ```js
* function(feature) {
* return feature.getGeometry();
* }
* ```
* See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster
* calculation point for polygons.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {ol.source.Vector} source Source.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
*/
/**
* @classdesc
* Layer source to cluster vector data. Works out of the box with point
@@ -19,7 +44,7 @@ import VectorSource from '../source/Vector.js';
* considered for clustering, a custom `geometryFunction` can be defined.
*
* @constructor
* @param {olx.source.ClusterOptions} options Constructor options.
* @param {module:ol/source/Cluster~Options=} options Cluster options.
* @extends {ol.source.Vector}
* @api
*/

View File

@@ -6,13 +6,34 @@ import ImageCanvas from '../ImageCanvas.js';
import {containsExtent, getHeight, getWidth, scaleFromCenter} from '../extent.js';
import ImageSource from '../source/Image.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {ol.CanvasFunctionType} [canvasFunction] Canvas function.
* The function returning the canvas element used by the source
* as an image. The arguments passed to the function are: `{ol.Extent}` the
* image extent, `{number}` the image resolution, `{number}` the device pixel
* ratio, `{ol.Size}` the image size, and `{module:ol/proj/Projection~Projection}` the image
* projection. The canvas returned by this function is cached by the source. If
* the value returned by the function is later changed then
* `changed` should be called on the source for the source to
* invalidate the current cached image. See @link: {@link module:ol/Observable~Observable#changed}
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {number} [ratio=1.5] Ratio. 1 means canvases are the size of the map viewport, 2 means twice the
* width and height of the map viewport, and so on. Must be `1` or higher.
* @property {Array.<number>} [resolutions] Resolutions.
* If specified, new canvases will be created for these resolutions
* @property {ol.source.State} [state] Source state.
*/
/**
* @classdesc
* Base class for image sources where a canvas element is the image.
*
* @constructor
* @extends {ol.source.Image}
* @param {olx.source.ImageCanvasOptions} options Constructor options.
* @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options.
* @api
*/
const ImageCanvasSource = function(options) {

View File

@@ -10,6 +10,24 @@ import {assign} from '../obj.js';
import ImageSource, {defaultImageLoadFunction} from '../source/Image.js';
import {appendParams} from '../uri.js';
/**
* @typedef {Object} Options
* @property {string} [url] The mapagent url.
* @property {number} [displayDpi=96] The display resolution.
* @property {number} [metersPerUnit=1] The meters-per-unit value.
* @property {boolean} [hidpi=true] Use the `ol.Map#pixelRatio` value when requesting
* the image from the remote server.
* @property {boolean} [useOverlay] If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {number} [ratio=1] Ratio. `1` means image requests are the size of the map viewport, `2` means
* twice the width and height of the map viewport, and so on. Must be `1` or higher.
* @property {Array.<number>} [resolutions] Resolutions.
* If specified, requests will be made for these resolutions only.
* @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given a URL.
* @property {Object} [params] Additional parameters.
*/
/**
* @classdesc
* Source for images from Mapguide servers
@@ -17,7 +35,7 @@ import {appendParams} from '../uri.js';
* @constructor
* @fires ol.source.Image.Event
* @extends {ol.source.Image}
* @param {olx.source.ImageMapGuideOptions} options Options.
* @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options.
* @api
*/
const ImageMapGuide = function(options) {

View File

@@ -11,13 +11,30 @@ import {intersects, getHeight, getWidth} from '../extent.js';
import {get as getProjection} from '../proj.js';
import ImageSource, {defaultImageLoadFunction} from '../source/Image.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {ol.Extent} [imageExtent] Extent of the image in map coordinates.
* This is the [left, bottom, right, top] map coordinates of your image.
* @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given a URL.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {ol.Size} [imageSize] Size of the image in pixels. Usually the image size is auto-detected, so this
* only needs to be set if auto-detection fails for some reason.
* @property {string} url Image URL.
*/
/**
* @classdesc
* A layer source for displaying a single, static image.
*
* @constructor
* @extends {ol.source.Image}
* @param {olx.source.ImageStaticOptions} options Options.
* @param {module:ol/source/ImageStatic~Options=} options ImageStatic options.
* @api
*/
const Static = function(options) {

View File

@@ -17,6 +17,32 @@ import WMSServerType from '../source/WMSServerType.js';
import {compareVersions} from '../string.js';
import {appendParams} from '../uri.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {boolean} [hidpi=true] Use the `ol.Map#pixelRatio` value when requesting
* the image from the remote server.
* @property {ol.source.WMSServerType|string} [serverType] The type of
* the remote WMS server: `mapserver`, `geoserver` or `qgis`. Only needed if `hidpi` is `true`.
* @property {ol.ImageLoadFunctionType} [imageLoadFunction] Optional function to load an image given a URL.
* @property {Object.<string,*>} params WMS request parameters.
* At least a `LAYERS` param is required. `STYLES` is
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
* twice the width and height of the map viewport, and so on. Must be `1` or
* higher.
* @property {Array.<number>} [resolutions] Resolutions.
* If specified, requests will be made for these resolutions only.
* @property {string} url WMS service URL.
*/
/**
* @classdesc
* Source for WMS servers providing single, untiled images.
@@ -24,7 +50,7 @@ import {appendParams} from '../uri.js';
* @constructor
* @fires ol.source.Image.Event
* @extends {ol.source.Image}
* @param {olx.source.ImageWMSOptions=} opt_options Options.
* @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options.
* @api
*/
const ImageWMS = function(opt_options) {

View File

@@ -17,13 +17,37 @@ export const ATTRIBUTION = '&copy; ' +
'contributors.';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {number} [maxZoom=19] Max zoom.
* @property {boolean} [opaque=true] Whether the layer is opaque.
* @property {number} [reprojectionErrorThreshold=1.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template.
* Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
*/
/**
* @classdesc
* Layer source for the OpenStreetMap tile server.
*
* @constructor
* @extends {ol.source.XYZ}
* @param {olx.source.OSMOptions=} opt_options Open Street Map options.
* @param {module:ol/source/OSM~Options=} [opt_options] Open Street Map options.
* @api
*/
const OSM = function(opt_options) {

View File

@@ -82,6 +82,25 @@ const RasterSourceEvent = function(type, frameState, data) {
};
inherits(RasterSourceEvent, Event);
/**
* @typedef {Object} Options
* @property {Array.<ol.source.Source>} sources Input sources.
* @property {ol.RasterOperation} [operation] Raster operation.
* The operation will be called with data from input sources
* and the output will be assigned to the raster source.
* @property {Object} [lib] Functions that will be made available to operations run in a worker.
* @property {number} [threads] By default, operations will be run in a single worker thread.
* To avoid using workers altogether, set `threads: 0`. For pixel operations, operations can
* be run in multiple worker threads. Note that there is additional overhead in
* transferring data to multiple workers, and that depending on the user's
* system, it may not be possible to parallelize the work.
* @property {ol.source.RasterOperationType} [operationType] Operation type.
* Supported values are `'pixel'` and `'image'`. By default,
* `'pixel'` operations are assumed, and operations will be called with an
* array of pixels from input sources. If set to `'image'`, operations will
* be called with an array of ImageData objects from input sources.
*/
/**
* @classdesc
@@ -92,7 +111,7 @@ inherits(RasterSourceEvent, Event);
* @constructor
* @extends {ol.source.Image}
* @fires ol.source.Raster.Event
* @param {olx.source.RasterOptions} options Options.
* @param {module:ol/source/Raster~Options=} options Options.
* @api
*/
const RasterSource = function(options) {

View File

@@ -88,13 +88,34 @@ const ProviderConfig = {
};
/**
* @typedef {Object} Options
* @property {number} [cacheSize=2048] Cache size.
* @property {string} [layer] Layer.
* @property {number} [minZoom] Minimum zoom.
* @property {number} [maxZoom] Maximum zoom.
* @property {boolean} [opaque] Whether the layer is opaque.
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {ol.TileLoadFunctionType} [tileLoadFunction]
* Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
*/
/**
* @classdesc
* Layer source for the Stamen tile server.
*
* @constructor
* @extends {ol.source.XYZ}
* @param {olx.source.StamenOptions} options Stamen options.
* @param {module:ol/source/Stamen~Options=} options Stamen options.
* @api
*/
const Stamen = function(options) {

View File

@@ -12,6 +12,21 @@ import Source from '../source/Source.js';
import {getKeyZXY, withinExtentAndZ} from '../tilecoord.js';
import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions]
* @property {number} [cacheSize]
* @property {module:ol/extent~Extent} [extent]
* @property {boolean} [opaque]
* @property {number} [tilePixelRatio]
* @property {module:ol/proj~ProjectionLike} [projection]
* @property {ol.source.State} [state]
* @property {ol.tilegrid.TileGrid} [tileGrid]
* @property {boolean} [wrapX=true]
* @property {number} [transition]
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
@@ -21,7 +36,7 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j
* @constructor
* @abstract
* @extends {ol.source.Source}
* @param {ol.SourceTileOptions} options Tile source options.
* @param {module:ol/source/Tile~Options=} options SourceTile source options.
* @api
*/
const TileSource = function(options) {

View File

@@ -75,6 +75,14 @@ LabeledTile.prototype.getImage = function() {
LabeledTile.prototype.load = function() {};
/**
* @typedef {Object} Options
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
*/
/**
* @classdesc
* A pseudo tile source, which does not fetch tiles from a server, but renders
@@ -85,7 +93,7 @@ LabeledTile.prototype.load = function() {};
*
* @constructor
* @extends {ol.source.Tile}
* @param {olx.source.TileDebugOptions} options Debug tile options.
* @param {module:ol/source/TileDebug~Options=} options Debug tile options.
* @api
*/
const TileDebug = function(options) {

View File

@@ -14,6 +14,48 @@ import UrlTile from '../source/UrlTile.js';
import {getKey, getKeyZXY} from '../tilecoord.js';
import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {boolean} [opaque=true] Whether the layer is opaque.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {ol.source.State} [state] Source state.
* @property {function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles.
* Default is {@link ol.ImageTile}.
* @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile
* service advertizes 256px by 256px tiles but actually sends 512px
* by 512px images (for retina/hidpi devices) then `tilePixelRatio`
* should be set to `2`.
* @property {ol.TileUrlFunctionType} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
* @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
* used instead of defining each one separately in the `urls` option.
* @property {Array.<string>} [urls] An array of URL templates.
* @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to
* request out-of-bounds tiles from the server. When set to `false`, only one
* world will be rendered. When set to `true`, tiles will be requested for one
* world only, but they will be wrapped horizontally to render multiple worlds.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Base class for sources providing images divided into a tile grid.
@@ -21,7 +63,7 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
* @constructor
* @fires ol.source.Tile.Event
* @extends {ol.source.UrlTile}
* @param {olx.source.TileImageOptions} options Image tile options.
* @param {module:ol/source/TileImage~Options=} options Image tile options.
* @api
*/
const TileImage = function(options) {

View File

@@ -17,13 +17,40 @@ import SourceState from '../source/State.js';
import TileImage from '../source/TileImage.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.
* Useful when the server does not support CORS..
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {tileJSON} [tileJSON] TileJSON configuration for this source.
* If not provided, `url` must be configured.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {string} [url] URL to the TileJSON file. If not provided, `tileJSON` must be configured.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for tile data in TileJSON format.
*
* @constructor
* @extends {ol.source.TileImage}
* @param {olx.source.TileJSONOptions} options TileJSON options.
* @param {module:ol/source/TileJSON~Options=} options TileJSON options.
* @api
*/
const TileJSON = function(options) {

View File

@@ -249,13 +249,30 @@ CustomTile.prototype.load = function() {
};
/**
* @typedef {Object} Options
* @property {boolean} [preemptive=true]
* If `true` the TileUTFGrid source loads the tiles based on their "visibility".
* This improves the speed of response, but increases traffic.
* Note that if set to `false`, you need to pass `true` as `opt_request`
* to the `forDataAtCoordinateAndResolution` method otherwise no data
* will ever be loaded.
* @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.
* Useful when the server does not support CORS..
* @property {tileJSON} [tileJSON] TileJSON configuration for this source.
* If not provided, `url` must be configured.
* @property {string} [url] TileJSON endpoint that provides the configuration for this source.
* Request will be made through JSONP. If not provided, `tileJSON` must be configured.
*/
/**
* @classdesc
* Layer source for UTFGrid interaction data loaded from TileJSON format.
*
* @constructor
* @extends {ol.source.Tile}
* @param {olx.source.TileUTFGridOptions} options Source options.
* @param {module:ol/source/TileUTFGrid~Options=} options Source options.
* @api
*/
const UTFGrid = function(options) {

View File

@@ -17,13 +17,69 @@ import {hash as tileCoordHash} from '../tilecoord.js';
import {compareVersions} from '../string.js';
import {appendParams} from '../uri.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {Object.<string,*>} params WMS request parameters.
* At least a `LAYERS` param is required. `STYLES` is
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
* @property {number} [gutter=0]
* The size in pixels of the gutter around image tiles to ignore. By setting
* this property to a non-zero value, images will be requested that are wider
* and taller than the tile size by a value of `2 x gutter`.
* Using a non-zero value allows artifacts of rendering at tile edges to be
* ignored. If you control the WMS service it is recommended to address
* "artifacts at tile edges" issues by properly configuring the WMS service. For
* example, MapServer has a `tile_map_edge_buffer` configuration parameter for
* this. See http://mapserver.org/output/tile_mode.html.
* @property {boolean} [hidpi=true] Use the `ol.Map#pixelRatio` value when requesting
* the image from the remote server.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles.
* Default is {@link ol.ImageTile}.
* @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid. Base this on the resolutions,
* tilesize and extent supported by the server.
* If this is not defined, a default grid will be used: if there is a projection
* extent, the grid will be based on that; if not, a grid based on a global
* extent with origin at 0,0 will be used..
* @property {ol.source.WMSServerType|string} [serverType]
* The type of the remote WMS server. Currently only used when `hidpi` is
* `true`.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {string} [url] WMS service URL.
* @property {Array.<string>} [urls] WMS service urls.
* Use this instead of `url` when the WMS supports multiple urls for GetMap requests.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* When set to `false`, only one world
* will be rendered. When `true`, tiles will be requested for one world only,
* but they will be wrapped horizontally to render multiple worlds.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for tile data from WMS servers.
*
* @constructor
* @extends {ol.source.TileImage}
* @param {olx.source.TileWMSOptions=} opt_options Tile WMS options.
* @param {module:ol/source/TileWMS~Options=} [opt_options] Tile WMS options.
* @api
*/
const TileWMS = function(opt_options) {

View File

@@ -8,6 +8,25 @@ import TileSource, {TileSourceEvent} from '../source/Tile.js';
import TileEventType from '../source/TileEventType.js';
import {getKeyZXY} from '../tilecoord.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions]
* @property {number} [cacheSize]
* @property {module:ol/extent~Extent} [extent]
* @property {boolean} [opaque]
* @property {module:ol/proj~ProjectionLike} [projection]
* @property {ol.source.State} [state]
* @property {ol.tilegrid.TileGrid} [tileGrid]
* @property {module:ol/Tile~LoadFunction} tileLoadFunction
* @property {number} [tilePixelRatio]
* @property {module:ol/Tile~UrlFunction} [tileUrlFunction]
* @property {string} [url]
* @property {Array.<string>} [urls]
* @property {boolean} [wrapX=true]
* @property {number} [transition]
*/
/**
* @classdesc
* Base class for sources providing tiles divided into a tile grid over http.
@@ -16,7 +35,7 @@ import {getKeyZXY} from '../tilecoord.js';
* @abstract
* @fires ol.source.Tile.Event
* @extends {ol.source.Tile}
* @param {ol.SourceUrlTileOptions} options Image tile options.
* @param {module:ol/source/UrlTile~Options=} options Image tile options.
*/
const UrlTile = function(options) {

View File

@@ -48,6 +48,92 @@ export const VectorSourceEvent = function(type, opt_feature) {
inherits(VectorSourceEvent, Event);
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {Array.<module:ol/Feature~Feature>|ol.Collection.<module:ol/Feature~Feature>} [features]
* Features. If provided as {@link ol.Collection}, the features in the source
* and the collection will stay in sync.
* @property {ol.format.Feature} [format] The feature format used by the XHR
* feature loader when `url` is set. Required if `url` is set, otherwise ignored.
* @property {module:ol/Feature~FeatureLoader} [loader]
* The loader function used to load features, from a remote source for example.
* If this is not set and `url` is set, the source will create and use an XHR
* feature loader.
*
* Example:
*
* ```js
* var vectorSource = new ol.source.Vector({
* format: new ol.format.GeoJSON(),
* loader: function(extent, resolution, projection) {
* var proj = projection.getCode();
* var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
* 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
* 'outputFormat=application/json&srsname=' + proj + '&' +
* 'bbox=' + extent.join(',') + ',' + proj;
* var xhr = new XMLHttpRequest();
* xhr.open('GET', url);
* var onError = function() {
* vectorSource.removeLoadedExtent(extent);
* }
* xhr.onerror = onError;
* xhr.onload = function() {
* if (xhr.status == 200) {
* vectorSource.addFeatures(
* vectorSource.getFormat().readFeatures(xhr.responseText));
* } else {
* onError();
* }
* }
* xhr.send();
* },
* strategy: ol.loadingstrategy.bbox
* });
* ```
* @property {boolean} [overlaps=true] This source may have overlapping geometries.
* Setting this to `false` (e.g. for sources with polygons that represent administrative
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
* stroke operations.
* @property {ol.LoadingStrategy} [strategy] The loading strategy to use.
* By default an {@link ol.loadingstrategy.all}
* strategy is used, a one-off strategy which loads all features at once.
* @property {string|module:ol/Feature~FeatureUrlFunction} [url]
* Setting this option instructs the source to load features using an XHR loader
* (see {@link ol.featureloader.xhr}). Use a `string` and an
* {@link ol.loadingstrategy.all} for a one-off download of all features from
* the given URL. Use a {@link module:ol/Feature~FeatureUrlFunction} to generate the url with
* other loading strategies.
* Requires `format` to be set as well.
* When default XHR feature loader is provided, the features will
* be transformed from the data projection to the view projection
* during parsing. If your remote data source does not advertise its projection
* properly, this transformation will be incorrect. For some formats, the
* default projection (usually EPSG:4326) can be overridden by setting the
* defaultDataProjection constructor option on the format.
* Note that if a source contains non-feature data, such as a GeoJSON geometry
* or a KML NetworkLink, these will be ignored. Use a custom loader to load these.
* @property {boolean} [useSpatialIndex=true]
* By default, an RTree is used as spatial index. When features are removed and
* added frequently, and the total number of features is low, setting this to
* `false` may improve performance.
*
* Note that
* {@link ol.source.Vector#getFeaturesInExtent},
* {@link ol.source.Vector#getClosestFeatureToCoordinate} and
* {@link ol.source.Vector#getExtent} cannot be used when `useSpatialIndex` is
* set to `false`, and {@link ol.source.Vector#forEachFeatureInExtent} will loop
* through all features.
*
* When set to `false`, the features will be maintained in an
* {@link ol.Collection}, which can be retrieved through
* {@link ol.source.Vector#getFeaturesCollection}.
* @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the
* -180° and 180° meridians to work properly, this should be set to `false`. The
* resulting geometry coordinates will then exceed the world bounds.
*/
/**
* @classdesc
* Provides a source of features for vector layers. Vector features provided
@@ -57,7 +143,7 @@ inherits(VectorSourceEvent, Event);
* @constructor
* @extends {ol.source.Source}
* @fires ol.source.Vector.Event
* @param {olx.source.VectorOptions=} opt_options Vector source options.
* @param {module:ol/source/Vector~Options=} opt_options Vector source options.
* @api
*/
const VectorSource = function(opt_options) {

View File

@@ -10,6 +10,50 @@ import UrlTile from '../source/UrlTile.js';
import {getKeyZXY} from '../tilecoord.js';
import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=128] Cache size.
* @property {ol.format.Feature} [format] Feature format for tiles. Used and required by the default.
* @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this
* to `false` (e.g. for sources with polygons that represent administrative
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
* stroke operations.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {ol.source.State} [state] Source state.
* @property {function(new: ol.VectorTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles.
* Default is {@link ol.VectorTile}.
* @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid.
* @property {ol.TileLoadFunctionType} [tileLoadFunction]
* Optional function to load a tile given a URL. Could look like this:
* ```js
* function(tile, url) {
* tile.setLoader(function() {
* var data = // ... fetch data
* var format = tile.getFormat();
* tile.setFeatures(format.readFeatures(data, {
* // uncomment the line below for ol.format.MVT only
* extent: tile.getExtent(),
* featureProjection: map.getView().getProjection()
* }));
* };
* });
* @property {ol.TileUrlFunctionType} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
* @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
* used instead of defining each one separately in the `urls` option.
* @property {Array.<string>} [urls] An array of URL templates.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* When set to `false`, only one world
* will be rendered. When set to `true`, tiles will be wrapped horizontally to
* render multiple worlds.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Class for layer sources providing vector data divided into a tile grid, to be
@@ -23,7 +67,7 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
* @constructor
* @fires ol.source.Tile.Event
* @extends {ol.source.UrlTile}
* @param {olx.source.VectorTileOptions} options Vector tile options.
* @param {module:ol/source/VectorTile~Options=} options Vector tile options.
* @api
*/
const VectorTileSource = function(options) {

View File

@@ -12,13 +12,96 @@ import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js';
import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js';
import {appendParams} from '../uri.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {ol.tilegrid.WMTS} tileGrid Tile grid.
* @property {module:ol/proj~ProjectionLike} projection Projection.
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {ol.source.WMTSRequestEncoding|string} [requestEncoding='KVP'] Request encoding.
* @property {string} layer Layer name as advertised in the WMTS capabilities.
* @property {string} style Style name as advertised in the WMTS capabilities.
* @property {function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles. Default is {@link ol.ImageTile}.
* @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.
* For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
* by 512px images (for retina/hidpi devices) then `tilePixelRatio`
* should be set to `2`.
* @property {string} [version='image/jpeg'] Image format.
* @property {string} [format='1.0.0'] WMTS version.
* @property {string} matrixSet Matrix set.
* @property {!Object} [dimensions] Additional "dimensions" for tile requests.
* This is an object with properties named like the advertised WMTS dimensions.
* @property {string} [url] A URL for the service.
* For the RESTful request encoding, this is a URL
* template. For KVP encoding, it is normal URL. A `{?-?}` template pattern,
* for example `subdomain{a-f}.domain.com`, may be used instead of defining
* each one separately in the `urls` option.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {Array.<string>} [urls] An array of URLs.
* Requests will be distributed among the URLs in this array.
* @property {boolean} [wrapX=false] Whether to wrap the world horizontally.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
* At least a `LAYERS` param is required. `STYLES` is
* `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
* @property {number} [gutter=0]
* The size in pixels of the gutter around image tiles to ignore. By setting
* this property to a non-zero value, images will be requested that are wider
* and taller than the tile size by a value of `2 x gutter`.
* Using a non-zero value allows artifacts of rendering at tile edges to be
* ignored. If you control the WMS service it is recommended to address
* "artifacts at tile edges" issues by properly configuring the WMS service. For
* example, MapServer has a `tile_map_edge_buffer` configuration parameter for
* this. See http://mapserver.org/output/tile_mode.html.
* @property {boolean} [hidpi=true] Use the `ol.Map#pixelRatio` value when requesting
* the image from the remote server.
* @property {function(new: ol.ImageTile, ol.TileCoord,
* ol.TileState, string, ?string,
* ol.TileLoadFunctionType)} [tileClass] Class used to instantiate image tiles.
* Default is {@link ol.ImageTile}.
* @property {ol.tilegrid.TileGrid} [tileGrid] Tile grid. Base this on the resolutions,
* tilesize and extent supported by the server.
* If this is not defined, a default grid will be used: if there is a projection
* extent, the grid will be based on that; if not, a grid based on a global
* extent with origin at 0,0 will be used..
* @property {ol.source.WMSServerType|string} [serverType]
* The type of the remote WMS server. Currently only used when `hidpi` is
* `true`.
* @property {string} [url] WMS service URL.
* @property {Array.<string>} [urls] WMS service urls.
* Use this instead of `url` when the WMS supports multiple urls for GetMap requests.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* When set to `false`, only one world
* will be rendered. When `true`, tiles will be requested for one world only,
* but they will be wrapped horizontally to render multiple worlds.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for tile data from WMTS servers.
*
* @constructor
* @extends {ol.source.TileImage}
* @param {olx.source.WMTSOptions} options WMTS options.
* @param {module:ol/source/WMTS~Options=} options WMTS options.
* @api
*/
const WMTS = function(options) {

View File

@@ -5,6 +5,45 @@ import {inherits} from '../index.js';
import TileImage from '../source/TileImage.js';
import {createXYZ, extentFromProjection} from '../tilegrid.js';
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {boolean} [opaque=true] Whether the layer is opaque.
* @property {module:ol/proj~ProjectionLike} [projection='EPSG:3857'] Projection.
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {number} [maxZoom=18] Optional max zoom level.
* @property {number} [maxZoom=0] Optional min zoom level.
* @property {ol.tilegrid.WMTS} tileGrid Tile grid.
* @property {ol.TileLoadFunctionType} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.
* For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
* by 512px images (for retina/hidpi devices) then `tilePixelRatio`
* should be set to `2`.
* @property {number|ol.Size} [tileSize=[256, 256]] The tile size used by the tile service.
* @property {ol.TileUrlFunctionType} [tileUrlFunction] Optional function to get
* tile URL given a tile coordinate and the projection.
* Required if url or urls are not provided.
* @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`,
* and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`,
* may be used instead of defining each one separately in the `urls` option.
* @property {Array.<string>} [urls] An array of URL templates.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for tile data with URLs in a set XYZ format that are
@@ -24,7 +63,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
*
* @constructor
* @extends {ol.source.TileImage}
* @param {olx.source.XYZOptions=} opt_options XYZ options.
* @param {module:ol/source/XYZ~Options=} opt_options XYZ options.
* @api
*/
const XYZ = function(opt_options) {

View File

@@ -79,6 +79,41 @@ CustomTile.prototype.getImage = function() {
};
/**
* @typedef {Object} Options
* @property {ol.AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize=2048] Cache size.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
* access pixel data with the Canvas renderer. See
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image} for more detail.
* @property {module:ol/proj~ProjectionLike} [projection] Projection.
* @property {boolean} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {string} [url] URL template or base URL of the Zoomify service.
* A base URL is the fixed part
* of the URL, excluding the tile group, z, x, and y folder structure, e.g.
* `http://my.zoomify.info/IMAGE.TIF/`. A URL template must include
* `{TileGroup}`, `{x}`, `{y}`, and `{z}` placeholders, e.g.
* `http://my.zoomify.info/IMAGE.TIF/{TileGroup}/{z}-{x}-{y}.jpg`.
* Internet Imaging Protocol (IIP) with JTL extension can be also used with
* `{tileIndex}` and `{z}` placeholders, e.g.
* `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`.
* A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
* used instead of defining each one separately in the `urls` option.
* @property {string} [tierSizeCalculation] Tier size calculation method: `default` or `truncated`.
* @property {ol.Size} [size] Size of the image.
* @property {ol.Extent} [extent] Extent for the TileGrid that is created.
* Default sets the TileGrid in the
* fourth quadrant, meaning extent is `[0, -height, width, 0]`. To change the
* extent to the first quadrant (the default for OpenLayers 2) set the extent
* as `[0, 0, width, height]`.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
* @property {number} [tileSize=256] Tile size. Same tile size is used for all zoom levels.
*/
/**
* @classdesc
* Layer source for tile data in Zoomify format (both Zoomify and Internet
@@ -86,7 +121,7 @@ CustomTile.prototype.getImage = function() {
*
* @constructor
* @extends {ol.source.TileImage}
* @param {olx.source.ZoomifyOptions=} opt_options Options.
* @param {module:ol/source/Zoomify~Options=} opt_options Options.
* @api
*/
const Zoomify = function(opt_options) {

View File

@@ -217,40 +217,6 @@ ol.ReprojTriangle;
ol.SourceRasterRenderedState;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* extent: (module:ol/extent~Extent|undefined),
* opaque: (boolean|undefined),
* tilePixelRatio: (number|undefined),
* projection: module:ol/proj~ProjectionLike,
* state: (ol.source.State|undefined),
* tileGrid: (ol.tilegrid.TileGrid|undefined),
* wrapX: (boolean|undefined),
* transition: (number|undefined)}}
*/
ol.SourceTileOptions;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* cacheSize: (number|undefined),
* extent: (module:ol/extent~Extent|undefined),
* opaque: (boolean|undefined),
* projection: module:ol/proj~ProjectionLike,
* state: (ol.source.State|undefined),
* tileGrid: (ol.tilegrid.TileGrid|undefined),
* tileLoadFunction: module:ol/Tile~LoadFunction,
* tilePixelRatio: (number|undefined),
* tileUrlFunction: (module:ol/Tile~UrlFunction|undefined),
* url: (string|undefined),
* urls: (Array.<string>|undefined),
* wrapX: (boolean|undefined),
* transition: (number|undefined)}}
*/
ol.SourceUrlTileOptions;
/**
* A function that takes an {@link module:ol/Feature~Feature} as argument and returns an
* {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.