diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index 5ad9e1ef4f..3d28104798 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -891,7 +891,7 @@ class Draw extends PointerInteraction { this.sketchFeature_ = null; this.sketchPoint_ = null; this.sketchLine_ = null; - /** @type {VectorSource} */ (this.overlay_.getSource()).clear(true); + this.overlay_.getSource().clear(true); } return sketchFeature; } @@ -930,7 +930,7 @@ class Draw extends PointerInteraction { if (this.sketchPoint_) { sketchFeatures.push(this.sketchPoint_); } - const overlaySource = /** @type {VectorSource} */ (this.overlay_.getSource()); + const overlaySource = this.overlay_.getSource(); overlaySource.clear(true); overlaySource.addFeatures(sketchFeatures); } diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 1d130c9f91..aba6b4d69e 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -242,7 +242,7 @@ class ExtentInteraction extends PointerInteraction { extentFeature = new Feature(polygonFromExtent(extent)); } this.extentFeature_ = extentFeature; - /** @type {VectorSource} */ (this.extentOverlay_.getSource()).addFeature(extentFeature); + this.extentOverlay_.getSource().addFeature(extentFeature); } else { if (!extent) { extentFeature.setGeometry(undefined); @@ -263,7 +263,7 @@ class ExtentInteraction extends PointerInteraction { if (!vertexFeature) { vertexFeature = new Feature(new Point(vertex)); this.vertexFeature_ = vertexFeature; - /** @type {VectorSource} */ (this.vertexOverlay_.getSource()).addFeature(vertexFeature); + this.vertexOverlay_.getSource().addFeature(vertexFeature); } else { const geometry = /** @type {Point} */ (vertexFeature.getGeometry()); geometry.setCoordinates(vertex); diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 3dbf7b8bd7..8a2382cb25 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -368,7 +368,7 @@ class Modify extends PointerInteraction { // Remove the vertex feature if the collection of canditate features // is empty. if (this.vertexFeature_ && this.features_.getLength() === 0) { - /** @type {VectorSource} */ (this.overlay_.getSource()).removeFeature(this.vertexFeature_); + this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; } unlisten(feature, EventType.CHANGE, @@ -407,7 +407,7 @@ class Modify extends PointerInteraction { */ setActive(active) { if (this.vertexFeature_ && !active) { - /** @type {VectorSource} */ (this.overlay_.getSource()).removeFeature(this.vertexFeature_); + this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; } super.setActive(active); @@ -658,7 +658,7 @@ class Modify extends PointerInteraction { if (!vertexFeature) { vertexFeature = new Feature(new Point(coordinates)); this.vertexFeature_ = vertexFeature; - /** @type {VectorSource} */ (this.overlay_.getSource()).addFeature(vertexFeature); + this.overlay_.getSource().addFeature(vertexFeature); } else { const geometry = /** @type {Point} */ (vertexFeature.getGeometry()); geometry.setCoordinates(coordinates); @@ -944,7 +944,7 @@ class Modify extends PointerInteraction { } } if (this.vertexFeature_) { - /** @type {VectorSource} */ (this.overlay_.getSource()).removeFeature(this.vertexFeature_); + this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; } } @@ -1139,7 +1139,7 @@ class Modify extends PointerInteraction { } this.updateSegmentIndices_(geometry, index, segmentData.depth, -1); if (this.vertexFeature_) { - /** @type {VectorSource} */ (this.overlay_.getSource()).removeFeature(this.vertexFeature_); + this.overlay_.getSource().removeFeature(this.vertexFeature_); this.vertexFeature_ = null; } dragSegments.length = 0; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index c037025705..f1832eb5df 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -275,7 +275,7 @@ class Select extends Interaction { * @api */ getFeatures() { - return /** @type {VectorSource} */ (this.featureOverlay_.getSource()).getFeaturesCollection(); + return this.featureOverlay_.getSource().getFeaturesCollection(); } /** diff --git a/src/ol/layer/Graticule.js b/src/ol/layer/Graticule.js index 7247d8fe3b..8555c2d346 100644 --- a/src/ol/layer/Graticule.js +++ b/src/ol/layer/Graticule.js @@ -437,7 +437,7 @@ class Graticule extends VectorLayer { * @param {import("../proj/Projection.js").default} projection Projection */ loaderFunction(extent, resolution, projection) { - const source = /** @type {import("../source/Vector.js").default} */ (this.getSource()); + const source = this.getSource(); // only consider the intersection between our own extent & the requested one const layerExtent = this.getExtent() || [-Infinity, -Infinity, Infinity, Infinity]; diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index 72cbaaeb10..58e52f10dc 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -44,7 +44,7 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer { const viewResolution = viewState.resolution; const imageLayer = /** @type {import("../../layer/Image.js").default} */ (this.getLayer()); - const imageSource = /** @type {import("../../source/Image.js").default} */ (imageLayer.getSource()); + const imageSource = imageLayer.getSource(); const hints = frameState.viewHints; diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index 43dcfba9cc..ac77df3d5e 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -88,7 +88,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { */ getTile(z, x, y, pixelRatio, projection) { const tileLayer = /** @type {import("../../layer/Tile.js").default} */ (this.getLayer()); - const tileSource = /** @type {import("../../source/Tile.js").default} */ (tileLayer.getSource()); + const tileSource = tileLayer.getSource(); let tile = tileSource.getTile(z, x, y, pixelRatio, projection); if (tile.getState() == TileState.ERROR) { if (!tileLayer.getUseInterimTilesOnError()) { @@ -130,7 +130,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { const pixelRatio = frameState.pixelRatio; const tileLayer = /** @type {import("../../layer/Tile.js").default} */ (this.getLayer()); - const tileSource = /** @type {import("../../source/Tile.js").default} */ (tileLayer.getSource()); + const tileSource = tileLayer.getSource(); const sourceRevision = tileSource.getRevision(); const tileGrid = tileSource.getTileGridForProjection(projection); const z = tileGrid.getZForResolution(viewResolution, this.zDirection); @@ -334,7 +334,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { const uid = getUid(this); const alpha = transition ? tile.getAlpha(uid, frameState.time) : 1; const tileLayer = /** @type {import("../../layer/Tile.js").default} */ (this.getLayer()); - const tileSource = /** @type {import("../../source/Tile.js").default} */ (tileLayer.getSource()); + const tileSource = tileLayer.getSource(); if (alpha === 1 && !tileSource.getOpaque(frameState.viewState.projection)) { this.context.clearRect(x, y, w, h); } diff --git a/src/ol/renderer/canvas/VectorLayer.js b/src/ol/renderer/canvas/VectorLayer.js index 2fcfcdf105..eea1dfa764 100644 --- a/src/ol/renderer/canvas/VectorLayer.js +++ b/src/ol/renderer/canvas/VectorLayer.js @@ -129,7 +129,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { const projection = viewState.projection; const rotation = viewState.rotation; const projectionExtent = projection.getExtent(); - const vectorSource = /** @type {import("../../source/Vector.js").default} */ (this.getLayer().getSource()); + const vectorSource = this.getLayer().getSource(); // clipped rendering if layer extent is set const clipExtent = layerState.extent; @@ -239,7 +239,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { */ prepareFrame(frameState, layerState) { const vectorLayer = /** @type {import("../../layer/Vector.js").default} */ (this.getLayer()); - const vectorSource = /** @type {import("../../source/Vector.js").default} */ (vectorLayer.getSource()); + const vectorSource = vectorLayer.getSource(); const animating = frameState.viewHints[ViewHint.ANIMATING]; const interacting = frameState.viewHints[ViewHint.INTERACTING]; diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js index 7c9c643fb9..bba7d651ab 100644 --- a/src/ol/renderer/canvas/VectorTileLayer.js +++ b/src/ol/renderer/canvas/VectorTileLayer.js @@ -229,7 +229,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { * @private */ updateExecutorGroup_(tile, pixelRatio, projection) { - const layer = /** @type {import("../../layer/Vector.js").default} */ (this.getLayer()); + const layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer()); const revision = layer.getRevision(); const renderOrder = /** @type {import("../../render.js").OrderFunction} */ (layer.getRenderOrder()) || null; @@ -239,7 +239,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { return; } - const source = /** @type {import("../../source/VectorTile.js").default} */ (layer.getSource()); + const source = layer.getSource(); const sourceTileGrid = source.getTileGrid(); const tileGrid = source.getTileGridForProjection(projection); const zoom = tile.tileCoord[0]; @@ -334,7 +334,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { const rotation = frameState.viewState.rotation; hitTolerance = hitTolerance == undefined ? 0 : hitTolerance; const layer = this.getLayer(); - const source = /** @type {import("../../source/VectorTile").default} */ (layer.getSource()); + const source = layer.getSource(); const tileGrid = source.getTileGridForProjection(frameState.viewState.projection); /** @type {!Object} */ const features = {}; @@ -378,7 +378,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { */ getReplayTransform_(tile, frameState) { const layer = this.getLayer(); - const source = /** @type {import("../../source/VectorTile.js").default} */ (layer.getSource()); + const source = layer.getSource(); const tileGrid = source.getTileGrid(); const tileCoord = tile.tileCoord; const tileResolution = tileGrid.getResolution(tileCoord[0]); @@ -435,7 +435,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { const context = this.overlayContext_; const declutterReplays = layer.getDeclutter() ? {} : null; - const source = /** @type {import("../../source/VectorTile.js").default} */ (layer.getSource()); + const source = layer.getSource(); const replayTypes = VECTOR_REPLAYS[renderMode]; const pixelRatio = frameState.pixelRatio; const rotation = frameState.viewState.rotation; @@ -608,7 +608,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { replayState.renderedTileZ = tile.sourceZ; const tileCoord = tile.wrappedTileCoord; const z = tileCoord[0]; - const source = /** @type {import("../../source/VectorTile.js").default} */ (layer.getSource()); + const source = layer.getSource(); const tileGrid = source.getTileGridForProjection(projection); const resolution = tileGrid.getResolution(z); const context = tile.getContext(layer); diff --git a/src/ol/renderer/webgl/PointsLayer.js b/src/ol/renderer/webgl/PointsLayer.js index 9cd2935c3f..a91473dd5f 100644 --- a/src/ol/renderer/webgl/PointsLayer.js +++ b/src/ol/renderer/webgl/PointsLayer.js @@ -264,7 +264,7 @@ class WebGLPointsLayerRenderer extends LayerRenderer { */ prepareFrame(frameState) { const vectorLayer = /** @type {import("../../layer/Vector.js").default} */ (this.getLayer()); - const vectorSource = /** @type {import("../../source/Vector.js").default} */ (vectorLayer.getSource()); + const vectorSource = vectorLayer.getSource(); const stride = 12;