Throw when calling abstract methods; fix abstract return types

This commit is contained in:
ahocevar
2018-10-30 18:45:42 +01:00
parent 2adac0b3e7
commit 1cdd040c96
22 changed files with 273 additions and 85 deletions

View File

@@ -1,6 +1,7 @@
/**
* @module ol/ImageBase
*/
import {abstract} from './util.js';
import EventTarget from './events/Target.js';
import EventType from './events/EventType.js';
@@ -63,7 +64,9 @@ class ImageBase extends EventTarget {
* @abstract
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
*/
getImage() {}
getImage() {
return abstract();
}
/**
* @return {number} PixelRatio.
@@ -90,7 +93,9 @@ class ImageBase extends EventTarget {
* Load not yet loaded URI.
* @abstract
*/
load() {}
load() {
abstract();
}
}

View File

@@ -2,6 +2,7 @@
* @module ol/format/Feature
*/
import {assign} from '../obj.js';
import {abstract} from '../util.js';
import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js';
@@ -122,7 +123,9 @@ class FeatureFormat {
* @abstract
* @return {import("./FormatType.js").default} Format.
*/
getType() {}
getType() {
return abstract();
}
/**
* Read a single feature from a source.
@@ -132,7 +135,9 @@ class FeatureFormat {
* @param {ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").FeatureLike} Feature.
*/
readFeature(source, opt_options) {}
readFeature(source, opt_options) {
return abstract();
}
/**
* Read all features from a source.
@@ -142,7 +147,9 @@ class FeatureFormat {
* @param {ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").FeatureLike>} Features.
*/
readFeatures(source, opt_options) {}
readFeatures(source, opt_options) {
return abstract();
}
/**
* Read a single geometry from a source.
@@ -152,7 +159,9 @@ class FeatureFormat {
* @param {ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometry(source, opt_options) {}
readGeometry(source, opt_options) {
return abstract();
}
/**
* Read the projection from a source.
@@ -161,7 +170,9 @@ class FeatureFormat {
* @param {Document|Node|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjection(source) {}
readProjection(source) {
return abstract();
}
/**
* Encode a feature in this format.
@@ -171,7 +182,9 @@ class FeatureFormat {
* @param {WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
writeFeature(feature, opt_options) {}
writeFeature(feature, opt_options) {
return abstract();
}
/**
* Encode an array of features in this format.
@@ -181,7 +194,9 @@ class FeatureFormat {
* @param {WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
writeFeatures(features, opt_options) {}
writeFeatures(features, opt_options) {
return abstract();
}
/**
* Write a single geometry in this format.
@@ -191,7 +206,9 @@ class FeatureFormat {
* @param {WriteOptions=} opt_options Write options.
* @return {string} Result.
*/
writeGeometry(geometry, opt_options) {}
writeGeometry(geometry, opt_options) {
return abstract();
}
}
export default FeatureFormat;

View File

@@ -1,6 +1,7 @@
/**
* @module ol/format/JSONFeature
*/
import {abstract} from '../util.js';
import FeatureFormat from '../format/Feature.js';
import FormatType from '../format/FormatType.js';
@@ -59,7 +60,9 @@ class JSONFeature extends FeatureFormat {
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromObject(object, opt_options) {}
readFeatureFromObject(object, opt_options) {
return abstract();
}
/**
* @abstract
@@ -68,7 +71,9 @@ class JSONFeature extends FeatureFormat {
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromObject(object, opt_options) {}
readFeaturesFromObject(object, opt_options) {
return abstract();
}
/**
* Read a geometry.
@@ -90,7 +95,9 @@ class JSONFeature extends FeatureFormat {
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromObject(object, opt_options) {}
readGeometryFromObject(object, opt_options) {
return abstract();
}
/**
* Read the projection.
@@ -109,7 +116,9 @@ class JSONFeature extends FeatureFormat {
* @protected
* @return {import("../proj/Projection.js").default} Projection.
*/
readProjectionFromObject(object) {}
readProjectionFromObject(object) {
return abstract();
}
/**
* Encode a feature as string.
@@ -129,7 +138,9 @@ class JSONFeature extends FeatureFormat {
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
writeFeatureObject(feature, opt_options) {}
writeFeatureObject(feature, opt_options) {
return abstract();
}
/**
* Encode an array of features as string.
@@ -149,7 +160,9 @@ class JSONFeature extends FeatureFormat {
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
writeFeaturesObject(features, opt_options) {}
writeFeaturesObject(features, opt_options) {
return abstract();
}
/**
* Encode a geometry as string.
@@ -169,7 +182,9 @@ class JSONFeature extends FeatureFormat {
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {Object} Object.
*/
writeGeometryObject(geometry, opt_options) {}
writeGeometryObject(geometry, opt_options) {
return abstract();
}
}

View File

@@ -1,6 +1,7 @@
/**
* @module ol/format/TextFeature
*/
import {abstract} from '../util.js';
import FeatureFormat from '../format/Feature.js';
import FormatType from '../format/FormatType.js';
@@ -43,7 +44,9 @@ class TextFeature extends FeatureFormat {
* @protected
* @return {import("../Feature.js").default} Feature.
*/
readFeatureFromText(text, opt_options) {}
readFeatureFromText(text, opt_options) {
return abstract();
}
/**
* Read the features from the source.
@@ -64,7 +67,9 @@ class TextFeature extends FeatureFormat {
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromText(text, opt_options) {}
readFeaturesFromText(text, opt_options) {
return abstract();
}
/**
* Read the geometry from the source.
@@ -85,7 +90,9 @@ class TextFeature extends FeatureFormat {
* @protected
* @return {import("../geom/Geometry.js").default} Geometry.
*/
readGeometryFromText(text, opt_options) {}
readGeometryFromText(text, opt_options) {
return abstract();
}
/**
* Read the projection from the source.
@@ -126,7 +133,9 @@ class TextFeature extends FeatureFormat {
* @protected
* @return {string} Text.
*/
writeFeatureText(feature, opt_options) {}
writeFeatureText(feature, opt_options) {
return abstract();
}
/**
* Encode an array of features as string.
@@ -147,7 +156,9 @@ class TextFeature extends FeatureFormat {
* @protected
* @return {string} Text.
*/
writeFeaturesText(features, opt_options) {}
writeFeaturesText(features, opt_options) {
return abstract();
}
/**
* Write a single geometry.
@@ -168,7 +179,9 @@ class TextFeature extends FeatureFormat {
* @protected
* @return {string} Text.
*/
writeGeometryText(geometry, opt_options) {}
writeGeometryText(geometry, opt_options) {
return abstract();
}
}

View File

@@ -1,6 +1,7 @@
/**
* @module ol/format/XMLFeature
*/
import {abstract} from '../util.js';
import {extend} from '../array.js';
import FeatureFormat from '../format/Feature.js';
import FormatType from '../format/FormatType.js';
@@ -122,7 +123,9 @@ class XMLFeature extends FeatureFormat {
* @protected
* @return {Array<import("../Feature.js").default>} Features.
*/
readFeaturesFromNode(node, opt_options) {}
readFeaturesFromNode(node, opt_options) {
return abstract();
}
/**
* @inheritDoc

View File

@@ -1,6 +1,7 @@
/**
* @module ol/geom/Geometry
*/
import {abstract} from '../util.js';
import BaseObject from '../Object.js';
import {createEmpty, getHeight, returnOrUpdate} from '../extent.js';
import {transform2D} from '../geom/flat/transform.js';
@@ -69,7 +70,9 @@ class Geometry extends BaseObject {
* @abstract
* @return {!Geometry} Clone.
*/
clone() {}
clone() {
return abstract();
}
/**
* @abstract
@@ -79,7 +82,9 @@ class Geometry extends BaseObject {
* @param {number} minSquaredDistance Minimum squared distance.
* @return {number} Minimum squared distance.
*/
closestPointXY(x, y, closestPoint, minSquaredDistance) {}
closestPointXY(x, y, closestPoint, minSquaredDistance) {
return abstract();
}
/**
* @param {number} x X.
@@ -121,7 +126,9 @@ class Geometry extends BaseObject {
* @protected
* @return {import("../extent.js").Extent} extent Extent.
*/
computeExtent(extent) {}
computeExtent(extent) {
return abstract();
}
/**
* Get the extent of the geometry.
@@ -145,7 +152,9 @@ class Geometry extends BaseObject {
* @param {import("../coordinate.js").Coordinate} anchor The rotation center.
* @api
*/
rotate(angle, anchor) {}
rotate(angle, anchor) {
abstract();
}
/**
* Scale the geometry (with an optional origin). This modifies the geometry
@@ -158,7 +167,9 @@ class Geometry extends BaseObject {
* of the geometry extent).
* @api
*/
scale(sx, opt_sy, opt_anchor) {}
scale(sx, opt_sy, opt_anchor) {
abstract();
}
/**
* Create a simplified version of this geometry. For linestrings, this uses
@@ -182,14 +193,18 @@ class Geometry extends BaseObject {
* @param {number} squaredTolerance Squared tolerance.
* @return {Geometry} Simplified geometry.
*/
getSimplifiedGeometry(squaredTolerance) {}
getSimplifiedGeometry(squaredTolerance) {
return abstract();
}
/**
* Get the type of this geometry.
* @abstract
* @return {import("./GeometryType.js").default} Geometry type.
*/
getType() {}
getType() {
return abstract();
}
/**
* Apply a transform function to each coordinate of the geometry.
@@ -199,7 +214,9 @@ class Geometry extends BaseObject {
* @abstract
* @param {import("../proj.js").TransformFunction} transformFn Transform.
*/
applyTransform(transformFn) {}
applyTransform(transformFn) {
abstract();
}
/**
* Test if the geometry and the passed extent intersect.
@@ -207,7 +224,9 @@ class Geometry extends BaseObject {
* @param {import("../extent.js").Extent} extent Extent.
* @return {boolean} `true` if the geometry and the extent intersect.
*/
intersectsExtent(extent) {}
intersectsExtent(extent) {
return abstract();
}
/**
* Translate the geometry. This modifies the geometry coordinates in place. If
@@ -217,7 +236,9 @@ class Geometry extends BaseObject {
* @param {number} deltaY Delta Y.
* @api
*/
translate(deltaX, deltaY) {}
translate(deltaX, deltaY) {
abstract();
}
/**
* Transform each coordinate of the geometry from one coordinate reference

View File

@@ -1,6 +1,7 @@
/**
* @module ol/geom/SimpleGeometry
*/
import {abstract} from '../util.js';
import {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js';
import Geometry from '../geom/Geometry.js';
import GeometryLayout from '../geom/GeometryLayout.js';
@@ -52,7 +53,9 @@ class SimpleGeometry extends Geometry {
* @abstract
* @return {Array} Coordinates.
*/
getCoordinates() {}
getCoordinates() {
return abstract();
}
/**
* Return the first coordinate of the geometry.
@@ -158,7 +161,9 @@ class SimpleGeometry extends Geometry {
* @param {!Array} coordinates Coordinates.
* @param {GeometryLayout=} opt_layout Layout.
*/
setCoordinates(coordinates, opt_layout) {}
setCoordinates(coordinates, opt_layout) {
abstract();
}
/**
* @param {GeometryLayout|undefined} layout Layout.

View File

@@ -1,6 +1,7 @@
/**
* @module ol/layer/Base
*/
import {abstract} from '../util.js';
import BaseObject from '../Object.js';
import LayerProperty from '../layer/Property.js';
import {clamp} from '../math.js';
@@ -105,7 +106,9 @@ class BaseLayer extends BaseObject {
* modified in place).
* @return {Array<import("./Layer.js").default>} Array of layers.
*/
getLayersArray(opt_array) {}
getLayersArray(opt_array) {
return abstract();
}
/**
* @abstract
@@ -113,7 +116,9 @@ class BaseLayer extends BaseObject {
* states (to be modified in place).
* @return {Array<import("./Layer.js").State>} List of layer states.
*/
getLayerStatesArray(opt_states) {}
getLayerStatesArray(opt_states) {
return abstract();
}
/**
* Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it
@@ -162,7 +167,9 @@ class BaseLayer extends BaseObject {
* @abstract
* @return {import("../source/State.js").default} Source state.
*/
getSourceState() {}
getSourceState() {
return abstract();
}
/**
* Return the visibility of the layer (`true` or `false`).

View File

@@ -1,6 +1,8 @@
/**
* @module ol/render/ReplayGroup
*/
import {abstract} from '../util.js';
/**
* Base class for replay groups.
*/
@@ -11,20 +13,26 @@ class ReplayGroup {
* @param {import("./ReplayType.js").default} replayType Replay type.
* @return {import("./VectorContext.js").default} Replay.
*/
getReplay(zIndex, replayType) {}
getReplay(zIndex, replayType) {
return abstract();
}
/**
* @abstract
* @return {boolean} Is empty.
*/
isEmpty() {}
isEmpty() {
return abstract();
}
/**
* @abstract
* @param {boolean} group Group with previous replay
* @return {Array<*>} The resulting instruction group
*/
addDeclutter(group) {}
addDeclutter(group) {
return abstract();
}
}
export default ReplayGroup;

View File

@@ -1,7 +1,7 @@
/**
* @module ol/render/webgl/Replay
*/
import {abstract} from '../../util.js';
import {getCenter} from '../../extent.js';
import VectorContext from '../VectorContext.js';
import {
@@ -122,13 +122,17 @@ class WebGLReplay extends VectorContext {
* @param {import("../../webgl/Context.js").default} context WebGL context.
* @return {function()} Delete resources function.
*/
getDeleteResourcesFunction(context) {}
getDeleteResourcesFunction(context) {
return abstract();
}
/**
* @abstract
* @param {import("../../webgl/Context.js").default} context Context.
*/
finish(context) {}
finish(context) {
abstract();
}
/**
* @abstract
@@ -142,7 +146,9 @@ class WebGLReplay extends VectorContext {
import("./polygonreplay/defaultshader/Locations.js").default|
import("./texturereplay/defaultshader/Locations.js").default} Locations.
*/
setUpProgram(gl, context, size, pixelRatio) {}
setUpProgram(gl, context, size, pixelRatio) {
return abstract();
}
/**
* @abstract
@@ -153,7 +159,9 @@ class WebGLReplay extends VectorContext {
import("./polygonreplay/defaultshader/Locations.js").default|
import("./texturereplay/defaultshader/Locations.js").default} locations Locations.
*/
shutDownProgram(gl, locations) {}
shutDownProgram(gl, locations) {
abstract();
}
/**
* @abstract
@@ -163,7 +171,9 @@ class WebGLReplay extends VectorContext {
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features to skip.
* @param {boolean} hitDetection Hit detection mode.
*/
drawReplay(gl, context, skippedFeaturesHash, hitDetection) {}
drawReplay(gl, context, skippedFeaturesHash, hitDetection) {
abstract();
}
/**
* @abstract
@@ -176,7 +186,9 @@ class WebGLReplay extends VectorContext {
* @return {T|undefined} Callback result.
* @template T
*/
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {}
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {
return abstract();
}
/**
* @protected

View File

@@ -1,7 +1,7 @@
/**
* @module ol/render/webgl/TextureReplay
*/
import {getUid} from '../../util.js';
import {abstract, getUid} from '../../util.js';
import {intersects} from '../../extent.js';
import {isEmpty} from '../../obj.js';
import {fragment, vertex} from '../webgl/texturereplay/defaultshader.js';
@@ -460,16 +460,20 @@ class WebGLTextureReplay extends WebGLReplay {
* @abstract
* @protected
* @param {boolean=} opt_all Return hit detection textures with regular ones.
* @returns {Array<WebGLTexture>} Textures.
* @return {Array<WebGLTexture>} Textures.
*/
getTextures(opt_all) {}
getTextures(opt_all) {
return abstract();
}
/**
* @abstract
* @protected
* @returns {Array<WebGLTexture>} Textures.
* @return {Array<WebGLTexture>} Textures.
*/
getHitDetectionTextures() {}
getHitDetectionTextures() {
return abstract();
}
}

View File

@@ -1,7 +1,7 @@
/**
* @module ol/renderer/Map
*/
import {getUid} from '../util.js';
import {abstract, getUid} from '../util.js';
import Disposable from '../Disposable.js';
import {listen, unlistenByKey} from '../events.js';
import EventType from '../events/EventType.js';
@@ -11,7 +11,9 @@ import {visibleAtResolution} from '../layer/Layer.js';
import {shared as iconImageCache} from '../style/IconImageCache.js';
import {compose as composeTransform, invert as invertTransform, setFromArray as transformSetFromArray} from '../transform.js';
/**
* @abstract
*/
class MapRenderer extends Disposable {
/**
@@ -51,7 +53,9 @@ class MapRenderer extends Disposable {
* @param {import("../render/EventType.js").default} type Event type.
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
*/
dispatchRenderEvent(type, frameState) {}
dispatchRenderEvent(type, frameState) {
abstract();
}
/**
* Register layer renderer constructors.
@@ -179,7 +183,9 @@ class MapRenderer extends Disposable {
* @return {T|undefined} Callback result.
* @template S,T,U
*/
forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, thisArg, layerFilter, thisArg2) {}
forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, thisArg, layerFilter, thisArg2) {
return abstract();
}
/**
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
@@ -290,11 +296,13 @@ class MapRenderer extends Disposable {
}
/**
* @abstract
* Render.
* @abstract
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
*/
renderFrame(frameState) {}
renderFrame(frameState) {
abstract();
}
/**
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.

View File

@@ -1,12 +1,16 @@
/**
* @module ol/renderer/canvas/IntermediateCanvas
*/
import {abstract} from '../../util.js';
import {scale as scaleCoordinate} from '../../coordinate.js';
import {createCanvasContext2D} from '../../dom.js';
import {containsExtent, intersects} from '../../extent.js';
import CanvasLayerRenderer from '../canvas/Layer.js';
import {create as createTransform, apply as applyTransform} from '../../transform.js';
/**
* @abstract
*/
class IntermediateCanvasRenderer extends CanvasLayerRenderer {
/**
@@ -80,13 +84,17 @@ class IntermediateCanvasRenderer extends CanvasLayerRenderer {
* @abstract
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Canvas.
*/
getImage() {}
getImage() {
return abstract();
}
/**
* @abstract
* @return {!import("../../transform.js").Transform} Image transform.
*/
getImageTransform() {}
getImageTransform() {
return abstract();
}
/**
* @inheritDoc

View File

@@ -1,6 +1,7 @@
/**
* @module ol/renderer/canvas/Layer
*/
import {abstract} from '../../util.js';
import {getBottomLeft, getBottomRight, getTopLeft, getTopRight} from '../../extent.js';
import {TRUE} from '../../functions.js';
import RenderEvent from '../../render/Event.js';
@@ -10,6 +11,9 @@ import CanvasImmediateRenderer from '../../render/canvas/Immediate.js';
import LayerRenderer from '../Layer.js';
import {create as createTransform, apply as applyTransform, compose as composeTransform} from '../../transform.js';
/**
* @abstract
*/
class CanvasLayerRenderer extends LayerRenderer {
/**
@@ -167,7 +171,9 @@ class CanvasLayerRenderer extends LayerRenderer {
* @param {import("../../layer/Layer.js").State} layerState Layer state.
* @param {CanvasRenderingContext2D} context Context.
*/
composeFrame(frameState, layerState, context) {}
composeFrame(frameState, layerState, context) {
abstract();
}
/**
* @abstract
@@ -175,7 +181,9 @@ class CanvasLayerRenderer extends LayerRenderer {
* @param {import("../../layer/Layer.js").State} layerState Layer state.
* @return {boolean} whether composeFrame should be called.
*/
prepareFrame(frameState, layerState) {}
prepareFrame(frameState, layerState) {
return abstract();
}
}
export default CanvasLayerRenderer;

View File

@@ -1,6 +1,7 @@
/**
* @module ol/renderer/webgl/Layer
*/
import {abstract} from '../../util.js';
import RenderEvent from '../../render/Event.js';
import RenderEventType from '../../render/EventType.js';
import WebGLImmediateRenderer from '../../render/webgl/Immediate.js';
@@ -14,6 +15,9 @@ import {ARRAY_BUFFER, FRAMEBUFFER, FLOAT, TEXTURE_2D,
import WebGLBuffer from '../../webgl/Buffer.js';
import {createEmptyTexture} from '../../webgl/Context.js';
/**
* @abstract
*/
class WebGLLayerRenderer extends LayerRenderer {
/**
@@ -236,7 +240,9 @@ class WebGLLayerRenderer extends LayerRenderer {
* @param {import("../../webgl/Context.js").default} context Context.
* @return {boolean} whether composeFrame should be called.
*/
prepareFrame(frameState, layerState, context) {}
prepareFrame(frameState, layerState, context) {
return abstract();
}
/**
* @abstract
@@ -248,7 +254,9 @@ class WebGLLayerRenderer extends LayerRenderer {
* @return {T|undefined} Callback result.
* @template S,T,U
*/
forEachLayerAtPixel(pixel, frameState, callback, thisArg) {}
forEachLayerAtPixel(pixel, frameState, callback, thisArg) {
return abstract();
}
}

View File

@@ -1,8 +1,8 @@
/**
* @module ol/source/Image
*/
import {abstract} from '../util.js';
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import ImageState from '../ImageState.js';
import {linearFindNearest} from '../array.js';
import Event from '../events/Event.js';
@@ -81,6 +81,7 @@ class ImageSourceEvent extends Event {
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* Base class for sources providing a single image.
* @abstract
* @api
*/
class ImageSource extends Source {
@@ -188,7 +189,9 @@ class ImageSource extends Source {
* @return {import("../ImageBase.js").default} Single image.
* @protected
*/
getImageInternal(extent, resolution, pixelRatio, projection) {}
getImageInternal(extent, resolution, pixelRatio, projection) {
return abstract();
}
/**
* Handle image change events.

View File

@@ -1,7 +1,7 @@
/**
* @module ol/source/Source
*/
import {abstract} from '../util.js';
import BaseObject from '../Object.js';
import {get as getProjection} from '../proj.js';
import SourceState from './State.js';
@@ -44,6 +44,7 @@ import SourceState from './State.js';
* Base class for {@link module:ol/layer/Layer~Layer} sources.
*
* A generic `change` event is triggered when the state of the source changes.
* @abstract
* @api
*/
class Source extends BaseObject {
@@ -123,7 +124,9 @@ class Source extends BaseObject {
* @abstract
* @return {Array<number>|undefined} Resolutions.
*/
getResolutions() {}
getResolutions() {
return abstract();
}
/**
* Get the state of the source, see {@link module:ol/source/State~State} for possible states.

View File

@@ -1,7 +1,7 @@
/**
* @module ol/source/Tile
*/
import {abstract} from '../util.js';
import TileCache from '../TileCache.js';
import TileState from '../TileState.js';
import Event from '../events/Event.js';
@@ -31,6 +31,7 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j
* 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.
* @abstract
* @api
*/
class TileSource extends Source {
@@ -199,7 +200,9 @@ class TileSource extends Source {
* @param {import("../proj/Projection.js").default} projection Projection.
* @return {!import("../Tile.js").default} Tile.
*/
getTile(z, x, y, pixelRatio, projection) {}
getTile(z, x, y, pixelRatio, projection) {
return abstract();
}
/**
* Return the tile grid of the tile source.
@@ -292,8 +295,8 @@ class TileSource extends Source {
}
/**
* @abstract
* Marks a tile coord as being used, without triggering a load.
* @abstract
* @param {number} z Tile coordinate z.
* @param {number} x Tile coordinate x.
* @param {number} y Tile coordinate y.

View File

@@ -1,6 +1,7 @@
/**
* @module ol/style/Image
*/
import {abstract} from '../util.js';
/**
@@ -17,6 +18,7 @@
* A base class used for creating subclasses and not instantiated in
* apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and
* {@link module:ol/style/RegularShape~RegularShape}.
* @abstract
* @api
*/
class ImageStyle {
@@ -117,7 +119,9 @@ class ImageStyle {
* @abstract
* @return {Array<number>} Anchor.
*/
getAnchor() {}
getAnchor() {
return abstract();
}
/**
* Get the image element for the symbolizer.
@@ -125,46 +129,60 @@ class ImageStyle {
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
*/
getImage(pixelRatio) {}
getImage(pixelRatio) {
return abstract();
}
/**
* @abstract
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
*/
getHitDetectionImage(pixelRatio) {}
getHitDetectionImage(pixelRatio) {
return abstract();
}
/**
* @abstract
* @return {import("../ImageState.js").default} Image state.
*/
getImageState() {}
getImageState() {
return abstract();
}
/**
* @abstract
* @return {import("../size.js").Size} Image size.
*/
getImageSize() {}
getImageSize() {
return abstract();
}
/**
* @abstract
* @return {import("../size.js").Size} Size of the hit-detection image.
*/
getHitDetectionImageSize() {}
getHitDetectionImageSize() {
return abstract();
}
/**
* Get the origin of the symbolizer.
* @abstract
* @return {Array<number>} Origin.
*/
getOrigin() {}
getOrigin() {
return abstract();
}
/**
* Get the size of the symbolizer (in pixels).
* @abstract
* @return {import("../size.js").Size} Size.
*/
getSize() {}
getSize() {
return abstract();
}
/**
* Set the opacity.
@@ -220,13 +238,17 @@ class ImageStyle {
* @return {import("../events.js").EventsKey|undefined} Listener key.
* @template T
*/
listenImageChange(listener, thisArg) {}
listenImageChange(listener, thisArg) {
return abstract();
}
/**
* Load not yet loaded URI.
* @abstract
*/
load() {}
load() {
abstract();
}
/**
* @abstract
@@ -234,7 +256,9 @@ class ImageStyle {
* @param {T} thisArg Value to use as `this` when executing `listener`.
* @template T
*/
unlistenImageChange(listener, thisArg) {}
unlistenImageChange(listener, thisArg) {
abstract();
}
}
export default ImageStyle;

View File

@@ -2,6 +2,15 @@
* @module ol/util
*/
/**
* @return {?} Any return.
*/
export function abstract() {
return /** @type {?} */ ((function() {
throw new Error('Unimplemented abstract method.');
})());
}
/**
* Inherit the prototype methods from one constructor into another.
*

View File

@@ -1,6 +1,7 @@
/**
* @module ol/webgl/Shader
*/
import {abstract} from '../util.js';
/**
* @abstract
@@ -31,7 +32,9 @@ class WebGLShader {
* @abstract
* @return {number} Type.
*/
getType() {}
getType() {
return abstract();
}
/**
* @return {string} Source.

View File

@@ -4,6 +4,7 @@ describe('ol.render.Replay', function() {
let replay;
beforeEach(function() {
replay = new WebGLReplay(5, [-180, -90, 180, 90]);
replay.drawReplay = replay.shutDownProgram = function() {};
});