@here/harp-mapview-decoder
Advanced tools
| import "@here/harp-fetch"; | ||
| import { TileKey } from "@here/harp-geoutils"; | ||
| /** | ||
| * Interface for all `DataProvider` subclasses. The `DataProvider` is an abstraction of the tile | ||
| * loader which is only responsible for loading the binary data of a specific tile, without any | ||
| * relation to displaying or even decoding the data. | ||
| * Interface for all `DataProvider` subclasses. | ||
| * | ||
| * @remarks | ||
| * The `DataProvider` is an abstraction of the tile | ||
| * loader which is only responsible for loading the data of a specific tile, | ||
| * without any relation to displaying or even decoding the data. | ||
| */ | ||
@@ -20,3 +23,3 @@ export interface DataProvider { | ||
| /** | ||
| * Load the data of a [[Tile]] asynchronously in form of an [[ArrayBufferLike]]. | ||
| * Load the data of a {@link @here/map-view@Tile} asynchronously. | ||
| * | ||
@@ -28,3 +31,17 @@ * @param tileKey - Address of a tile. | ||
| getTile(tileKey: TileKey, abortSignal?: AbortSignal): Promise<ArrayBufferLike | {}>; | ||
| /** | ||
| * An event which fires when this `DataProvider` is invalidated. | ||
| * | ||
| * @param listener - A function to call when this `DataProvider` is invalidated. | ||
| * @returns The function to call to unregister the listener from this event. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const dispose = dataProvider.onDidInvalidate?.(() => { | ||
| * console.log("invalidated"); | ||
| * }); | ||
| * ``` | ||
| */ | ||
| onDidInvalidate?(listener: () => void): () => void; | ||
| } | ||
| //# sourceMappingURL=DataProvider.d.ts.map |
+11
-4
@@ -7,8 +7,15 @@ "use strict"; | ||
| */ | ||
| var _a; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.GeoJsonTiler = void 0; | ||
| // tslint:disable-next-line:no-var-requires | ||
| // @ts-ignore | ||
| const geojsonvtExport = require("geojson-vt"); | ||
| // to be able to run tests on nodejs | ||
| const geojsonvt = geojsonvtExport.default || geojsonvtExport; | ||
| const geojsonvt = (_a = geojsonvtExport.default) !== null && _a !== void 0 ? _a : geojsonvtExport; | ||
| const EXTENT = 4096; | ||
| // the factor used to compute the size of the buffer. | ||
| const BUFFER_FACTOR = 0.05; | ||
| // align the buffer to the next integer multiple of 2. | ||
| // tslint:disable-next-line: no-bitwise | ||
| const BUFFER = -(-Math.ceil(EXTENT * BUFFER_FACTOR) & -2); | ||
| class GeoJsonTiler { | ||
@@ -46,4 +53,4 @@ constructor() { | ||
| tolerance: 3, | ||
| extent: 4096, | ||
| buffer: 0, | ||
| extent: EXTENT, | ||
| buffer: BUFFER, | ||
| lineMetrics: false, | ||
@@ -50,0 +57,0 @@ promoteId: null, |
@@ -51,3 +51,3 @@ import { Definitions, ITileDecoder, StyleSet, Theme, TileInfo } from "@here/harp-datasource-protocol"; | ||
| export declare class TileFactory<TileType extends Tile> { | ||
| private m_modelConstructor; | ||
| private readonly m_modelConstructor; | ||
| /** | ||
@@ -80,2 +80,3 @@ * Initialize the factory using the constructor of the element to be called when a [[Tile]] is | ||
| private m_isReady; | ||
| private readonly m_unregisterClearTileCache?; | ||
| /** | ||
@@ -122,5 +123,7 @@ * Set up the `TileDataSource`. | ||
| * @param tileKey - Quadtree address of the requested tile. | ||
| * @param delayLoad - If true, the Tile will be created, but Tile.load will not be called. | ||
| * @default false. | ||
| * @override | ||
| */ | ||
| getTile(tileKey: TileKey): TileType | undefined; | ||
| getTile(tileKey: TileKey, delayLoad?: boolean): TileType | undefined; | ||
| /** | ||
@@ -127,0 +130,0 @@ * Get [[TileInfo]] of a tile. |
@@ -50,2 +50,3 @@ "use strict"; | ||
| constructor(m_tileFactory, m_options) { | ||
| var _a, _b; | ||
| super({ | ||
@@ -81,5 +82,8 @@ name: m_options.name, | ||
| this.cacheable = true; | ||
| this.m_unregisterClearTileCache = (_b = (_a = this.dataProvider()).onDidInvalidate) === null || _b === void 0 ? void 0 : _b.call(_a, () => this.mapView.clearTileCache(this.name)); | ||
| } | ||
| /** @override */ | ||
| dispose() { | ||
| var _a; | ||
| (_a = this.m_unregisterClearTileCache) === null || _a === void 0 ? void 0 : _a.call(this); | ||
| this.decoder.dispose(); | ||
@@ -109,3 +113,3 @@ } | ||
| this.m_decoder.configure(styleSet, definitions, languages); | ||
| this.mapView.markTilesDirty(this); | ||
| this.mapView.clearTileCache(this.name); | ||
| } | ||
@@ -123,5 +127,3 @@ /** | ||
| : undefined; | ||
| if (styleSet !== undefined) { | ||
| this.setStyleSet(styleSet, theme.definitions, languages); | ||
| } | ||
| this.setStyleSet(styleSet, theme.definitions, languages); | ||
| } | ||
@@ -145,5 +147,7 @@ /** | ||
| * @param tileKey - Quadtree address of the requested tile. | ||
| * @param delayLoad - If true, the Tile will be created, but Tile.load will not be called. | ||
| * @default false. | ||
| * @override | ||
| */ | ||
| getTile(tileKey) { | ||
| getTile(tileKey, delayLoad = false) { | ||
| const tile = this.m_tileFactory.create(this, tileKey); | ||
@@ -163,3 +167,5 @@ tile.tileLoader = new TileLoader_1.TileLoader(this, tileKey, this.m_options.dataProvider, this.decoder, 0); | ||
| } | ||
| tile.load(); | ||
| if (!delayLoad) { | ||
| tile.load(); | ||
| } | ||
| return tile; | ||
@@ -166,0 +172,0 @@ } |
| import "@here/harp-fetch"; | ||
| import { DecodedTile, ITileDecoder, RequestController, TileInfo } from "@here/harp-datasource-protocol"; | ||
| import { TileKey } from "@here/harp-geoutils"; | ||
| import { DataSource, TileLoaderState } from "@here/harp-mapview"; | ||
| import { DataSource, ITileLoader, TileLoaderState } from "@here/harp-mapview"; | ||
| import { DataProvider } from "./DataProvider"; | ||
@@ -10,3 +10,3 @@ /** | ||
| */ | ||
| export declare class TileLoader { | ||
| export declare class TileLoader implements ITileLoader { | ||
| protected dataSource: DataSource; | ||
@@ -13,0 +13,0 @@ protected tileKey: TileKey; |
@@ -29,3 +29,3 @@ /** | ||
| readonly serviceId: string; | ||
| private m_pendingRequests; | ||
| private readonly m_pendingRequests; | ||
| /** | ||
@@ -61,3 +61,3 @@ * Sets up the `WorkerService` with the specified name, and starts processing messages. | ||
| */ | ||
| private onMessage; | ||
| private readonly onMessage; | ||
| /** | ||
@@ -64,0 +64,0 @@ * Safety belt over [[handleMessage]] for correct exception handling & logging. |
@@ -31,7 +31,7 @@ import { WorkerService, WorkerServiceResponse } from "./WorkerService"; | ||
| */ | ||
| private m_factories; | ||
| private readonly m_factories; | ||
| /** | ||
| * Contains all managed worker services indexed by their `serviceId`. | ||
| */ | ||
| private m_services; | ||
| private readonly m_services; | ||
| private constructor(); | ||
@@ -38,0 +38,0 @@ /** |
+9
-9
| { | ||
| "name": "@here/harp-mapview-decoder", | ||
| "version": "0.17.2", | ||
| "version": "0.18.0", | ||
| "description": "Decoder worker for mapview", | ||
@@ -29,12 +29,12 @@ "main": "index.js", | ||
| "dependencies": { | ||
| "@here/harp-datasource-protocol": "^0.17.2", | ||
| "@here/harp-fetch": "^0.17.2", | ||
| "@here/harp-geoutils": "^0.17.2", | ||
| "@here/harp-lrucache": "^0.17.2", | ||
| "@here/harp-mapview": "^0.17.2", | ||
| "@here/harp-utils": "^0.17.2", | ||
| "@here/harp-datasource-protocol": "^0.18.0", | ||
| "@here/harp-fetch": "^0.18.0", | ||
| "@here/harp-geoutils": "^0.18.0", | ||
| "@here/harp-lrucache": "^0.18.0", | ||
| "@here/harp-mapview": "^0.18.0", | ||
| "@here/harp-utils": "^0.18.0", | ||
| "geojson-vt": "^3.2.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@here/harp-test-utils": "^0.17.2", | ||
| "@here/harp-test-utils": "^0.18.0", | ||
| "@types/chai": "^4.2.11", | ||
@@ -55,3 +55,3 @@ "@types/chai-as-promised": "^7.1.2", | ||
| }, | ||
| "gitHead": "328eb765db506c4cf8d87315ee742afae4192290" | ||
| "gitHead": "25538cf6bb5d64df9fba84dea238f6e9ce2aa82a" | ||
| } |
84036
1.79%1820
1.85%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated