Remove remaining use of inherits in src

This commit is contained in:
Tim Schaub
2018-07-17 23:43:10 -06:00
parent f6046c023c
commit 1a5cf52b61
63 changed files with 837 additions and 982 deletions

View File

@@ -44,16 +44,16 @@ const TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for Bing Maps tile data.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/BingMaps~Options=} options Bing Maps options.
* @api
*/
class BingMaps {
class BingMaps extends TileImage {
/**
* @classdesc
* Layer source for Bing Maps tile data.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/BingMaps~Options=} options Bing Maps options.
* @api
*/
constructor(options) {
/**
@@ -62,7 +62,7 @@ class BingMaps {
*/
this.hidpi_ = options.hidpi !== undefined ? options.hidpi : false;
TileImage.call(this, {
super({
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
opaque: true,
@@ -223,6 +223,4 @@ class BingMaps {
}
}
inherits(BingMaps, TileImage);
export default BingMaps;

View File

@@ -31,16 +31,16 @@ import XYZ from '../source/XYZ.js';
*/
/**
* @classdesc
* Layer source for the CartoDB Maps API.
*
* @constructor
* @extends {module:ol/source/XYZ}
* @param {module:ol/source/CartoDB~Options=} options CartoDB options.
* @api
*/
class CartoDB {
class CartoDB extends XYZ {
/**
* @classdesc
* Layer source for the CartoDB Maps API.
*
* @constructor
* @extends {module:ol/source/XYZ}
* @param {module:ol/source/CartoDB~Options=} options CartoDB options.
* @api
*/
constructor(options) {
/**
@@ -67,7 +67,7 @@ class CartoDB {
*/
this.templateCache_ = {};
XYZ.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -182,7 +182,5 @@ class CartoDB {
}
}
inherits(CartoDB, XYZ);
export default CartoDB;

View File

@@ -36,20 +36,20 @@ import VectorSource from '../source/Vector.js';
*/
/**
* @classdesc
* Layer source to cluster vector data. Works out of the box with point
* geometries. For other geometry types, or if not all geometries should be
* considered for clustering, a custom `geometryFunction` can be defined.
*
* @constructor
* @param {module:ol/source/Cluster~Options=} options Cluster options.
* @extends {module:ol/source/Vector}
* @api
*/
class Cluster {
class Cluster extends VectorSource {
/**
* @classdesc
* Layer source to cluster vector data. Works out of the box with point
* geometries. For other geometry types, or if not all geometries should be
* considered for clustering, a custom `geometryFunction` can be defined.
*
* @constructor
* @param {module:ol/source/Cluster~Options=} options Cluster options.
* @extends {module:ol/source/Vector}
* @api
*/
constructor(options) {
VectorSource.call(this, {
super({
attributions: options.attributions,
extent: options.extent,
projection: options.projection,
@@ -212,7 +212,5 @@ class Cluster {
}
}
inherits(Cluster, VectorSource);
export default Cluster;

View File

@@ -41,21 +41,21 @@ const ImageSourceEventType = {
};
/**
* @classdesc
* Events emitted by {@link module:ol/source/Image~ImageSource} instances are instances of this
* type.
*
* @constructor
* @extends {module:ol/events/Event}
* @param {string} type Type.
* @param {module:ol/Image} image The image.
*/
class ImageSourceEvent {
class ImageSourceEvent extends Event {
/**
* @classdesc
* Events emitted by {@link module:ol/source/Image~ImageSource} instances are instances of this
* type.
*
* @constructor
* @extends {module:ol/events/Event}
* @param {string} type Type.
* @param {module:ol/Image} image The image.
*/
constructor(type, image) {
Event.call(this, type);
super(type);
/**
* The image related to the event.
@@ -68,8 +68,6 @@ class ImageSourceEvent {
}
inherits(ImageSourceEvent, Event);
/**
* @typedef {Object} Options
@@ -81,21 +79,21 @@ inherits(ImageSourceEvent, Event);
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for sources providing a single image.
*
* @constructor
* @abstract
* @extends {module:ol/source/Source}
* @param {module:ol/source/Image~Options} options Single image source options.
* @api
*/
class ImageSource {
class ImageSource extends Source {
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for sources providing a single image.
*
* @constructor
* @abstract
* @extends {module:ol/source/Source}
* @param {module:ol/source/Image~Options} options Single image source options.
* @api
*/
constructor(options) {
Source.call(this, {
super({
attributions: options.attributions,
extent: options.extent,
projection: options.projection,
@@ -227,8 +225,6 @@ class ImageSource {
}
}
inherits(ImageSource, Source);
/**
* Default image load function for image sources that use module:ol/Image~Image image

View File

@@ -39,27 +39,27 @@ import {appendParams} from '../uri.js';
*/
/**
* @classdesc
* Source for data from ArcGIS Rest services providing single, untiled images.
* Useful when underlying map service has labels.
*
* If underlying map service is not using labels,
* take advantage of ol image caching and use
* {@link module:ol/source/TileArcGISRest} data source.
*
* @constructor
* @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageArcGISRest~Options=} opt_options Image ArcGIS Rest Options.
* @api
*/
class ImageArcGISRest {
class ImageArcGISRest extends ImageSource {
/**
* @classdesc
* Source for data from ArcGIS Rest services providing single, untiled images.
* Useful when underlying map service has labels.
*
* If underlying map service is not using labels,
* take advantage of ol image caching and use
* {@link module:ol/source/TileArcGISRest} data source.
*
* @constructor
* @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageArcGISRest~Options=} opt_options Image ArcGIS Rest Options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
ImageSource.call(this, {
super({
attributions: options.attributions,
projection: options.projection,
resolutions: options.resolutions
@@ -289,7 +289,5 @@ class ImageArcGISRest {
}
}
inherits(ImageArcGISRest, ImageSource);
export default ImageArcGISRest;

View File

@@ -42,19 +42,19 @@ import ImageSource from '../source/Image.js';
*/
/**
* @classdesc
* Base class for image sources where a canvas element is the image.
*
* @constructor
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options.
* @api
*/
class ImageCanvasSource {
class ImageCanvasSource extends ImageSource {
/**
* @classdesc
* Base class for image sources where a canvas element is the image.
*
* @constructor
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options.
* @api
*/
constructor(options) {
ImageSource.call(this, {
super({
attributions: options.attributions,
projection: options.projection,
resolutions: options.resolutions,
@@ -121,7 +121,5 @@ class ImageCanvasSource {
}
}
inherits(ImageCanvasSource, ImageSource);
export default ImageCanvasSource;

View File

@@ -32,20 +32,20 @@ import {appendParams} from '../uri.js';
*/
/**
* @classdesc
* Source for images from Mapguide servers
*
* @constructor
* @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options.
* @api
*/
class ImageMapGuide {
class ImageMapGuide extends ImageSource {
/**
* @classdesc
* Source for images from Mapguide servers
*
* @constructor
* @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageMapGuide~Options=} options ImageMapGuide options.
* @api
*/
constructor(options) {
ImageSource.call(this, {
super({
projection: options.projection,
resolutions: options.resolutions
});
@@ -234,8 +234,6 @@ class ImageMapGuide {
}
}
inherits(ImageMapGuide, ImageSource);
/**
* @param {module:ol/extent~Extent} extent The map extents.

View File

@@ -28,16 +28,16 @@ import ImageSource, {defaultImageLoadFunction} from '../source/Image.js';
*/
/**
* @classdesc
* A layer source for displaying a single, static image.
*
* @constructor
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageStatic~Options=} options ImageStatic options.
* @api
*/
class Static {
class Static extends ImageSource {
/**
* @classdesc
* A layer source for displaying a single, static image.
*
* @constructor
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageStatic~Options=} options ImageStatic options.
* @api
*/
constructor(options) {
const imageExtent = options.imageExtent;
@@ -48,7 +48,7 @@ class Static {
options.imageLoadFunction !== undefined ?
options.imageLoadFunction : defaultImageLoadFunction;
ImageSource.call(this, {
super({
attributions: options.attributions,
projection: getProjection(options.projection)
});
@@ -109,7 +109,5 @@ class Static {
}
}
inherits(Static, ImageSource);
export default Static;

View File

@@ -51,22 +51,22 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
*/
/**
* @classdesc
* Source for WMS servers providing single, untiled images.
*
* @constructor
* @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options.
* @api
*/
class ImageWMS {
class ImageWMS extends ImageSource {
/**
* @classdesc
* Source for WMS servers providing single, untiled images.
*
* @constructor
* @fires ol/source/Image~ImageSourceEvent
* @extends {module:ol/source/Image}
* @param {module:ol/source/ImageWMS~Options=} [opt_options] ImageWMS options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
ImageSource.call(this, {
super({
attributions: options.attributions,
projection: options.projection,
resolutions: options.resolutions
@@ -385,7 +385,5 @@ class ImageWMS {
}
}
inherits(ImageWMS, ImageSource);
export default ImageWMS;

View File

@@ -41,17 +41,17 @@ export const ATTRIBUTION = '&copy; ' +
*/
/**
* @classdesc
* Layer source for the OpenStreetMap tile server.
*
* @constructor
* @extends {module:ol/source/XYZ}
* @param {module:ol/source/OSM~Options=} [opt_options] Open Street Map options.
* @api
*/
class OSM {
class OSM extends XYZ {
/**
* @classdesc
* Layer source for the OpenStreetMap tile server.
*
* @constructor
* @extends {module:ol/source/XYZ}
* @param {module:ol/source/OSM~Options=} [opt_options] Open Street Map options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
@@ -69,7 +69,7 @@ class OSM {
const url = options.url !== undefined ?
options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
XYZ.call(this, {
super({
attributions: attributions,
cacheSize: options.cacheSize,
crossOrigin: crossOrigin,
@@ -85,6 +85,4 @@ class OSM {
}
inherits(OSM, XYZ);
export default OSM;

View File

@@ -72,21 +72,21 @@ const RasterOperationType = {
};
/**
* @classdesc
* Events emitted by {@link module:ol/source/Raster} instances are instances of this
* type.
*
* @constructor
* @extends {module:ol/events/Event}
* @param {string} type Type.
* @param {module:ol/PluggableMap~FrameState} frameState The frame state.
* @param {Object} data An object made available to operations.
*/
class RasterSourceEvent {
class RasterSourceEvent extends Event {
/**
* @classdesc
* Events emitted by {@link module:ol/source/Raster} instances are instances of this
* type.
*
* @constructor
* @extends {module:ol/events/Event}
* @param {string} type Type.
* @param {module:ol/PluggableMap~FrameState} frameState The frame state.
* @param {Object} data An object made available to operations.
*/
constructor(type, frameState, data) {
Event.call(this, type);
super(type);
/**
* The raster extent.
@@ -114,8 +114,6 @@ class RasterSourceEvent {
}
inherits(RasterSourceEvent, Event);
/**
* @typedef {Object} Options
* @property {Array.<module:ol/source/Source|module:ol/layer/Layer>} sources Input
@@ -137,19 +135,19 @@ inherits(RasterSourceEvent, Event);
*/
/**
* @classdesc
* A source that transforms data from any number of input sources using an
* {@link module:ol/source/Raster~Operation} function to transform input pixel values into
* output pixel values.
*
* @constructor
* @extends {module:ol/source/Image}
* @fires ol/source/Raster~RasterSourceEvent
* @param {module:ol/source/Raster~Options=} options Options.
* @api
*/
class RasterSource {
class RasterSource extends ImageSource {
/**
* @classdesc
* A source that transforms data from any number of input sources using an
* {@link module:ol/source/Raster~Operation} function to transform input pixel values into
* output pixel values.
*
* @constructor
* @extends {module:ol/source/Image}
* @fires ol/source/Raster~RasterSourceEvent
* @param {module:ol/source/Raster~Options=} options Options.
* @api
*/
constructor(options) {
/**
@@ -245,7 +243,7 @@ class RasterSource {
wantedTiles: {}
};
ImageSource.call(this, {});
super({});
if (options.operation !== undefined) {
this.setOperation(options.operation, options.lib);
@@ -421,8 +419,6 @@ class RasterSource {
}
}
inherits(RasterSource, ImageSource);
/**
* A reusable canvas context.

View File

@@ -37,24 +37,24 @@ import SourceState from '../source/State.js';
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for {@link module:ol/layer/Layer~Layer} sources.
*
* A generic `change` event is triggered when the state of the source changes.
*
* @constructor
* @abstract
* @extends {module:ol/Object}
* @param {module:ol/source/Source~Options} options Source options.
* @api
*/
class Source {
class Source extends BaseObject {
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for {@link module:ol/layer/Layer~Layer} sources.
*
* A generic `change` event is triggered when the state of the source changes.
*
* @constructor
* @abstract
* @extends {module:ol/Object}
* @param {module:ol/source/Source~Options} options Source options.
* @api
*/
constructor(options) {
BaseObject.call(this);
super();
/**
* @private
@@ -177,8 +177,6 @@ class Source {
}
}
inherits(Source, BaseObject);
/**
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.

View File

@@ -109,17 +109,17 @@ const ProviderConfig = {
*/
/**
* @classdesc
* Layer source for the Stamen tile server.
*
* @constructor
* @extends {module:ol/source/XYZ}
* @param {module:ol/source/Stamen~Options=} options Stamen options.
* @api
*/
class Stamen {
class Stamen extends XYZ {
/**
* @classdesc
* Layer source for the Stamen tile server.
*
* @constructor
* @extends {module:ol/source/XYZ}
* @param {module:ol/source/Stamen~Options=} options Stamen options.
* @api
*/
constructor(options) {
const i = options.layer.indexOf('-');
const provider = i == -1 ? options.layer : options.layer.slice(0, i);
@@ -131,7 +131,7 @@ class Stamen {
'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' + options.layer +
'/{z}/{x}/{y}.' + layerConfig.extension;
XYZ.call(this, {
super({
attributions: ATTRIBUTIONS,
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
@@ -148,6 +148,4 @@ class Stamen {
}
inherits(Stamen, XYZ);
export default Stamen;

View File

@@ -27,22 +27,22 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j
*/
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for sources providing images divided into a tile grid.
*
* @constructor
* @abstract
* @extends {module:ol/source/Source}
* @param {module:ol/source/Tile~Options=} options SourceTile source options.
* @api
*/
class TileSource {
class TileSource extends Source {
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for sources providing images divided into a tile grid.
*
* @constructor
* @abstract
* @extends {module:ol/source/Source}
* @param {module:ol/source/Tile~Options=} options SourceTile source options.
* @api
*/
constructor(options) {
Source.call(this, {
super({
attributions: options.attributions,
extent: options.extent,
projection: options.projection,
@@ -295,8 +295,6 @@ class TileSource {
}
}
inherits(TileSource, Source);
/**
* Marks a tile coord as being used, without triggering a load.
@@ -318,11 +316,11 @@ TileSource.prototype.useTile = UNDEFINED;
* @param {string} type Type.
* @param {module:ol/Tile} tile The tile.
*/
export class TileSourceEvent {
export class TileSourceEvent extends Event {
constructor(type, tile) {
Event.call(this, type);
super(type);
/**
* The tile related to the event.
@@ -335,6 +333,4 @@ export class TileSourceEvent {
}
inherits(TileSourceEvent, Event);
export default TileSource;

View File

@@ -51,25 +51,25 @@ import {appendParams} from '../uri.js';
*/
/**
* @classdesc
* Layer source for tile data from ArcGIS Rest services. Map and Image
* Services are supported.
*
* For cached ArcGIS services, better performance is available using the
* {@link module:ol/source/XYZ~XYZ} data source.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/TileArcGISRest~Options=} opt_options Tile ArcGIS Rest options.
* @api
*/
class TileArcGISRest {
class TileArcGISRest extends TileImage {
/**
* @classdesc
* Layer source for tile data from ArcGIS Rest services. Map and Image
* Services are supported.
*
* For cached ArcGIS services, better performance is available using the
* {@link module:ol/source/XYZ~XYZ} data source.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/TileArcGISRest~Options=} opt_options Tile ArcGIS Rest options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
TileImage.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -216,7 +216,5 @@ class TileArcGISRest {
}
}
inherits(TileArcGISRest, TileImage);
export default TileArcGISRest;

View File

@@ -10,17 +10,17 @@ import TileSource from '../source/Tile.js';
import {getKeyZXY} from '../tilecoord.js';
/**
* @constructor
* @extends {module:ol/Tile}
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/size~Size} tileSize Tile size.
* @param {string} text Text.
*/
class LabeledTile {
class LabeledTile extends Tile {
/**
* @constructor
* @extends {module:ol/Tile}
* @param {module:ol/tilecoord~TileCoord} tileCoord Tile coordinate.
* @param {module:ol/size~Size} tileSize Tile size.
* @param {string} text Text.
*/
constructor(tileCoord, tileSize, text) {
Tile.call(this, tileCoord, TileState.LOADED);
super(tileCoord, TileState.LOADED);
/**
* @private
@@ -73,8 +73,6 @@ class LabeledTile {
load() {}
}
inherits(LabeledTile, Tile);
/**
* @typedef {Object} Options
@@ -84,23 +82,23 @@ inherits(LabeledTile, Tile);
*/
/**
* @classdesc
* A pseudo tile source, which does not fetch tiles from a server, but renders
* a grid outline for the tile grid/projection along with the coordinates for
* each tile. See examples/canvas-tiles for an example.
*
* Uses Canvas context2d, so requires Canvas support.
*
* @constructor
* @extends {module:ol/source/Tile}
* @param {module:ol/source/TileDebug~Options=} options Debug tile options.
* @api
*/
class TileDebug {
class TileDebug extends TileSource {
/**
* @classdesc
* A pseudo tile source, which does not fetch tiles from a server, but renders
* a grid outline for the tile grid/projection along with the coordinates for
* each tile. See examples/canvas-tiles for an example.
*
* Uses Canvas context2d, so requires Canvas support.
*
* @constructor
* @extends {module:ol/source/Tile}
* @param {module:ol/source/TileDebug~Options=} options Debug tile options.
* @api
*/
constructor(options) {
TileSource.call(this, {
super({
opaque: false,
projection: options.projection,
tileGrid: options.tileGrid,
@@ -129,7 +127,5 @@ class TileDebug {
}
}
inherits(TileDebug, TileSource);
export default TileDebug;

View File

@@ -54,20 +54,20 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
*/
/**
* @classdesc
* Base class for sources providing images divided into a tile grid.
*
* @constructor
* @fires module:ol/source/Tile~TileSourceEvent
* @extends {module:ol/source/UrlTile}
* @param {module:ol/source/TileImage~Options=} options Image tile options.
* @api
*/
class TileImage {
class TileImage extends UrlTile {
/**
* @classdesc
* Base class for sources providing images divided into a tile grid.
*
* @constructor
* @fires module:ol/source/Tile~TileSourceEvent
* @extends {module:ol/source/UrlTile}
* @param {module:ol/source/TileImage~Options=} options Image tile options.
* @api
*/
constructor(options) {
UrlTile.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
extent: options.extent,
@@ -389,8 +389,6 @@ class TileImage {
}
}
inherits(TileImage, UrlTile);
/**
* @param {module:ol/ImageTile} imageTile Image tile.

View File

@@ -44,16 +44,16 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
*/
/**
* @classdesc
* Layer source for tile data in TileJSON format.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/TileJSON~Options=} options TileJSON options.
* @api
*/
class TileJSON {
class TileJSON extends TileImage {
/**
* @classdesc
* Layer source for tile data in TileJSON format.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/TileJSON~Options=} options TileJSON options.
* @api
*/
constructor(options) {
/**
@@ -62,7 +62,7 @@ class TileJSON {
*/
this.tileJSON_ = null;
TileImage.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -182,7 +182,5 @@ class TileJSON {
}
}
inherits(TileJSON, TileImage);
export default TileJSON;

View File

@@ -71,16 +71,16 @@ import {appendParams} from '../uri.js';
*/
/**
* @classdesc
* Layer source for tile data from WMS servers.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/TileWMS~Options=} [opt_options] Tile WMS options.
* @api
*/
class TileWMS {
class TileWMS extends TileImage {
/**
* @classdesc
* Layer source for tile data from WMS servers.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/TileWMS~Options=} [opt_options] Tile WMS options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
@@ -89,7 +89,7 @@ class TileWMS {
const transparent = 'TRANSPARENT' in params ? params['TRANSPARENT'] : true;
TileImage.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -388,7 +388,5 @@ class TileWMS {
}
}
inherits(TileWMS, TileImage);
export default TileWMS;

View File

@@ -27,11 +27,11 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
* @param {boolean} preemptive Load the tile when visible (before it's needed).
* @param {boolean} jsonp Load the tile as a script.
*/
export class CustomTile {
export class CustomTile extends Tile {
constructor(tileCoord, state, src, extent, preemptive, jsonp) {
Tile.call(this, tileCoord, state);
super(tileCoord, state);
/**
* @private
@@ -80,8 +80,6 @@ export class CustomTile {
}
inherits(CustomTile, Tile);
/**
* Get the image element for this tile.
@@ -271,19 +269,19 @@ CustomTile.prototype.load = function() {
*/
/**
* @classdesc
* Layer source for UTFGrid interaction data loaded from TileJSON format.
*
* @constructor
* @extends {module:ol/source/Tile}
* @param {module:ol/source/UTFGrid~Options=} options Source options.
* @api
*/
class UTFGrid {
class UTFGrid extends TileSource {
/**
* @classdesc
* Layer source for UTFGrid interaction data loaded from TileJSON format.
*
* @constructor
* @extends {module:ol/source/Tile}
* @param {module:ol/source/UTFGrid~Options=} options Source options.
* @api
*/
constructor(options) {
TileSource.call(this, {
super({
projection: getProjection('EPSG:3857'),
state: SourceState.LOADING
});
@@ -334,8 +332,6 @@ class UTFGrid {
}
inherits(UTFGrid, TileSource);
/**
* @private

View File

@@ -27,20 +27,20 @@ import {getKeyZXY} from '../tilecoord.js';
*/
/**
* @classdesc
* Base class for sources providing tiles divided into a tile grid over http.
*
* @constructor
* @abstract
* @fires module:ol/source/TileEvent
* @extends {module:ol/source/Tile}
* @param {module:ol/source/UrlTile~Options=} options Image tile options.
*/
class UrlTile {
class UrlTile extends TileSource {
/**
* @classdesc
* Base class for sources providing tiles divided into a tile grid over http.
*
* @constructor
* @abstract
* @fires module:ol/source/TileEvent
* @extends {module:ol/source/Tile}
* @param {module:ol/source/UrlTile~Options=} options Image tile options.
*/
constructor(options) {
TileSource.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
extent: options.extent,
@@ -205,8 +205,6 @@ class UrlTile {
}
}
inherits(UrlTile, TileSource);
/**
* @type {module:ol/Tile~UrlFunction|undefined}

View File

@@ -41,11 +41,11 @@ import RBush from '../structs/RBush.js';
* @param {string} type Type.
* @param {module:ol/Feature=} opt_feature Feature.
*/
export class VectorSourceEvent {
export class VectorSourceEvent extends Event {
constructor(type, opt_feature) {
Event.call(this, type);
super(type);
/**
* The feature being added or removed.
@@ -58,8 +58,6 @@ export class VectorSourceEvent {
}
inherits(VectorSourceEvent, Event);
/**
* @typedef {Object} Options
@@ -151,25 +149,25 @@ inherits(VectorSourceEvent, Event);
*/
/**
* @classdesc
* Provides a source of features for vector layers. Vector features provided
* by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for
* vector data that is optimized for rendering.
*
* @constructor
* @extends {module:ol/source/Source}
* @fires ol/source/Vector~VectorSourceEvent
* @param {module:ol/source/Vector~Options=} opt_options Vector source options.
* @api
*/
class VectorSource {
class VectorSource extends Source {
/**
* @classdesc
* Provides a source of features for vector layers. Vector features provided
* by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for
* vector data that is optimized for rendering.
*
* @constructor
* @extends {module:ol/source/Source}
* @fires ol/source/Vector~VectorSourceEvent
* @param {module:ol/source/Vector~Options=} opt_options Vector source options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
Source.call(this, {
super({
attributions: options.attributions,
projection: undefined,
state: SourceState.READY,
@@ -282,8 +280,6 @@ class VectorSource {
}
inherits(VectorSource, Source);
/**
* Add a single feature to the source. If you want to add a batch of features

View File

@@ -58,24 +58,24 @@ import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.
*/
/**
* @classdesc
* Class for layer sources providing vector data divided into a tile grid, to be
* used with {@link module:ol/layer/VectorTile~VectorTile}. Although this source receives tiles
* with vector features from the server, it is not meant for feature editing.
* Features are optimized for rendering, their geometries are clipped at or near
* tile boundaries and simplified for a view resolution. See
* {@link module:ol/source/Vector} for vector sources that are suitable for feature
* editing.
*
* @constructor
* @fires module:ol/source/Tile~TileSourceEvent
* @extends {module:ol/source/UrlTile}
* @param {module:ol/source/VectorTile~Options=} options Vector tile options.
* @api
*/
class VectorTile {
class VectorTile extends UrlTile {
/**
* @classdesc
* Class for layer sources providing vector data divided into a tile grid, to be
* used with {@link module:ol/layer/VectorTile~VectorTile}. Although this source receives tiles
* with vector features from the server, it is not meant for feature editing.
* Features are optimized for rendering, their geometries are clipped at or near
* tile boundaries and simplified for a view resolution. See
* {@link module:ol/source/Vector} for vector sources that are suitable for feature
* editing.
*
* @constructor
* @fires module:ol/source/Tile~TileSourceEvent
* @extends {module:ol/source/UrlTile}
* @param {module:ol/source/VectorTile~Options=} options Vector tile options.
* @api
*/
constructor(options) {
const projection = options.projection || 'EPSG:3857';
@@ -88,7 +88,7 @@ class VectorTile {
tileSize: options.tileSize || 512
});
UrlTile.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize !== undefined ? options.cacheSize : 128,
extent: extent,
@@ -139,8 +139,6 @@ class VectorTile {
}
inherits(VectorTile, UrlTile);
/**
* @return {boolean} The source can have overlapping geometries.

View File

@@ -56,17 +56,17 @@ import {appendParams} from '../uri.js';
*/
/**
* @classdesc
* Layer source for tile data from WMTS servers.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/WMTS~Options=} options WMTS options.
* @api
*/
class WMTS {
class WMTS extends TileImage {
/**
* @classdesc
* Layer source for tile data from WMTS servers.
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/WMTS~Options=} options WMTS options.
* @api
*/
constructor(options) {
// TODO: add support for TileMatrixLimits
@@ -199,7 +199,7 @@ class WMTS {
const tileUrlFunction = (urls && urls.length > 0) ?
createFromTileUrlFunctions(urls.map(this.createFromWMTSTemplate_)) : nullTileUrlFunction;
TileImage.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -221,8 +221,6 @@ class WMTS {
}
inherits(WMTS, TileImage);
/**
* Set the URLs to use for requests.
* URLs may contain OCG conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}.

View File

@@ -44,30 +44,30 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
*/
/**
* @classdesc
* Layer source for tile data with URLs in a set XYZ format that are
* defined in a URL template. By default, this follows the widely-used
* Google grid where `x` 0 and `y` 0 are in the top left. Grids like
* TMS where `x` 0 and `y` 0 are in the bottom left can be used by
* using the `{-y}` placeholder in the URL template, so long as the
* source does not have a custom tile grid. In this case,
* {@link module:ol/source/TileImage} can be used with a `tileUrlFunction`
* such as:
*
* tileUrlFunction: function(coordinate) {
* return 'http://mapserver.com/' + coordinate[0] + '/' +
* coordinate[1] + '/' + coordinate[2] + '.png';
* }
*
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/XYZ~Options=} opt_options XYZ options.
* @api
*/
class XYZ {
class XYZ extends TileImage {
/**
* @classdesc
* Layer source for tile data with URLs in a set XYZ format that are
* defined in a URL template. By default, this follows the widely-used
* Google grid where `x` 0 and `y` 0 are in the top left. Grids like
* TMS where `x` 0 and `y` 0 are in the bottom left can be used by
* using the `{-y}` placeholder in the URL template, so long as the
* source does not have a custom tile grid. In this case,
* {@link module:ol/source/TileImage} can be used with a `tileUrlFunction`
* such as:
*
* tileUrlFunction: function(coordinate) {
* return 'http://mapserver.com/' + coordinate[0] + '/' +
* coordinate[1] + '/' + coordinate[2] + '.png';
* }
*
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/XYZ~Options=} opt_options XYZ options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
const projection = options.projection !== undefined ?
@@ -81,7 +81,7 @@ class XYZ {
tileSize: options.tileSize
});
TileImage.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -102,6 +102,4 @@ class XYZ {
}
inherits(XYZ, TileImage);
export default XYZ;

View File

@@ -34,11 +34,11 @@ const TierSizeCalculation = {
* @param {module:ol/Tile~LoadFunction} tileLoadFunction Tile load function.
* @param {module:ol/Tile~Options=} opt_options Tile options.
*/
export class CustomTile {
export class CustomTile extends ImageTile {
constructor(tileGrid, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options);
super(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options);
/**
* @private
@@ -56,8 +56,6 @@ export class CustomTile {
}
inherits(CustomTile, ImageTile);
/**
* @inheritDoc
@@ -119,18 +117,18 @@ CustomTile.prototype.getImage = function() {
*/
/**
* @classdesc
* Layer source for tile data in Zoomify format (both Zoomify and Internet
* Imaging Protocol are supported).
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/Zoomify~Options=} opt_options Options.
* @api
*/
class Zoomify {
class Zoomify extends TileImage {
/**
* @classdesc
* Layer source for tile data in Zoomify format (both Zoomify and Internet
* Imaging Protocol are supported).
*
* @constructor
* @extends {module:ol/source/TileImage}
* @param {module:ol/source/Zoomify~Options=} opt_options Options.
* @api
*/
constructor(opt_options) {
const options = opt_options || {};
@@ -245,7 +243,7 @@ class Zoomify {
const ZoomifyTileClass = CustomTile.bind(null, tileGrid);
TileImage.call(this, {
super({
attributions: options.attributions,
cacheSize: options.cacheSize,
crossOrigin: options.crossOrigin,
@@ -261,6 +259,4 @@ class Zoomify {
}
inherits(Zoomify, TileImage);
export default Zoomify;