@metoceanapi/wxtiles-leaflet 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +137 -305
- package/dist/es/defaults/styles.d.ts +2 -2
- package/dist/es/defaults/uconv.d.ts +2 -2
- package/dist/es/index.d.ts +31 -4
- package/dist/es/index.js +1 -1
- package/dist/es/utils/RawCLUT.d.ts +32 -22
- package/dist/es/utils/qtree.d.ts +11 -5
- package/dist/es/utils/wxtools.d.ts +221 -31
- package/dist/es/wxAPI/WxDataSetManager.d.ts +63 -33
- package/dist/es/wxAPI/wxAPI.d.ts +115 -43
- package/dist/es/wxlayer/WxImplementation.d.ts +74 -32
- package/dist/es/wxlayer/loader.d.ts +27 -3
- package/dist/es/wxlayer/loadertools.d.ts +41 -3
- package/dist/es/wxlayer/painter.d.ts +39 -0
- package/dist/es/wxlayer/wxlayer.d.ts +77 -9
- package/dist/es/wxsource/wxsource.d.ts +60 -20
- package/dist/es/wxsource/wxsourcetypes.d.ts +13 -0
- package/dist/web/index.js +1 -1
- package/docs/docs/assets/highlight.css +92 -0
- package/docs/docs/assets/main.js +54 -0
- package/docs/docs/assets/search.js +1 -0
- package/docs/docs/assets/style.css +1257 -0
- package/docs/docs/classes/FrameworkParentClass.html +86 -0
- package/docs/docs/classes/Loader.html +165 -0
- package/docs/docs/classes/Painter.html +161 -0
- package/docs/docs/classes/QTree.html +129 -0
- package/docs/docs/classes/RawCLUT.html +143 -0
- package/docs/docs/classes/WxAPI.html +336 -0
- package/docs/docs/classes/WxDataSetManager.html +389 -0
- package/docs/docs/classes/WxLayer.html +363 -0
- package/docs/docs/classes/WxLayerBaseImplementation.html +358 -0
- package/docs/docs/classes/WxTileSource.html +435 -0
- package/docs/docs/enums/TileType.html +80 -0
- package/docs/docs/functions/WXLOG.html +118 -0
- package/docs/docs/functions/WxCreateLegend.html +126 -0
- package/docs/docs/functions/WxGetColorSchemes.html +113 -0
- package/docs/docs/functions/WxGetColorStyles.html +113 -0
- package/docs/docs/functions/WxTilesLogging.html +118 -0
- package/docs/docs/index.html +199 -0
- package/docs/docs/interfaces/ColorStylesIncomplete.html +116 -0
- package/docs/docs/interfaces/Converter.html +81 -0
- package/docs/docs/interfaces/DataIntegral.html +112 -0
- package/docs/docs/interfaces/DataPicture.html +93 -0
- package/docs/docs/interfaces/FrameworkOptions.html +118 -0
- package/docs/docs/interfaces/IntegralPare.html +81 -0
- package/docs/docs/interfaces/SLinePoint.html +77 -0
- package/docs/docs/interfaces/Tree.html +70 -0
- package/docs/docs/interfaces/WxAPIOptions.html +164 -0
- package/docs/docs/interfaces/WxAllBoundariesMeta.html +85 -0
- package/docs/docs/interfaces/WxBoundaryMeta.html +91 -0
- package/docs/docs/interfaces/WxColorSchemes.html +117 -0
- package/docs/docs/interfaces/WxColorStyleStrict.html +299 -0
- package/docs/docs/interfaces/WxColorStyleWeak.html +325 -0
- package/docs/docs/interfaces/WxColorStylesStrict.html +74 -0
- package/docs/docs/interfaces/WxColorStylesWeakMixed.html +116 -0
- package/docs/docs/interfaces/WxData.html +81 -0
- package/docs/docs/interfaces/WxDataSetManagerOptions.html +108 -0
- package/docs/docs/interfaces/WxDataSetsMetasJSON.html +75 -0
- package/docs/docs/interfaces/WxDatasetMeta.html +135 -0
- package/docs/docs/interfaces/WxDatasetShortMeta.html +90 -0
- package/docs/docs/interfaces/WxLayerAPI.html +313 -0
- package/docs/docs/interfaces/WxLayerBaseAPI.html +246 -0
- package/docs/docs/interfaces/WxLayerOptions.html +111 -0
- package/docs/docs/interfaces/WxLegend.html +117 -0
- package/docs/docs/interfaces/WxLngLat.html +81 -0
- package/docs/docs/interfaces/WxRasterData.html +99 -0
- package/docs/docs/interfaces/WxRequestInit.html +70 -0
- package/docs/docs/interfaces/WxTick.html +99 -0
- package/docs/docs/interfaces/WxTileInfo.html +142 -0
- package/docs/docs/interfaces/WxTilesLibOptions.html +92 -0
- package/docs/docs/interfaces/WxUnits.html +116 -0
- package/docs/docs/interfaces/WxVariableMeta.html +108 -0
- package/docs/docs/interfaces/WxVariablesMetas.html +116 -0
- package/docs/docs/interfaces/XYZ.html +84 -0
- package/docs/docs/modules.html +208 -0
- package/docs/docs/types/DataIntegrals.html +109 -0
- package/docs/docs/types/DataPictures.html +109 -0
- package/docs/docs/types/SLine.html +109 -0
- package/docs/docs/types/SubTrees.html +109 -0
- package/docs/docs/types/SubTreesN.html +109 -0
- package/docs/docs/types/TreeN.html +109 -0
- package/docs/docs/types/UriLoaderPromiseFunc.html +129 -0
- package/docs/docs/types/WxDate.html +109 -0
- package/docs/docs/types/WxURIs.html +109 -0
- package/docs/docs/types/WxUnitTuple.html +109 -0
- package/docs/docs/types/WxVars.html +109 -0
- package/docs/script/script.css +1 -1
- package/docs/script/script.js +6 -6
- package/package.json +8 -8
- package/src_example/index.ts +2 -2
|
@@ -1,96 +1,126 @@
|
|
|
1
1
|
import type { WxDate, WxVars } from '../wxlayer/wxlayer';
|
|
2
2
|
import type { WxDatasetMeta, WxAPI, WxVariableMeta, WxAllBoundariesMeta } from './wxAPI';
|
|
3
3
|
/**
|
|
4
|
+
* Options to pass to the constructor of {@link WxDataSetManager}
|
|
5
|
+
*/
|
|
6
|
+
export interface WxDataSetManagerOptions {
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* Dataset name
|
|
10
|
+
* */
|
|
11
|
+
datasetName: string;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* current instance of the dataset
|
|
15
|
+
* */
|
|
16
|
+
instance: string;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
* Array of instanced time steps
|
|
20
|
+
* */
|
|
21
|
+
instanced?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
* Dataset's meta data
|
|
25
|
+
* */
|
|
26
|
+
meta: WxDatasetMeta;
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
* The {@link WxAPI} instance to use to interact with the *WxTiles* API
|
|
30
|
+
* */
|
|
31
|
+
wxapi: WxAPI;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Class for managing WX datasets.
|
|
4
35
|
* @class WxDataSetManager
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param {WxAPI} wxapi - Wx API control object.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const wxdatasetManager = await wxapi.createDatasetManager('gfs.global');
|
|
39
|
+
* ```
|
|
10
40
|
* */
|
|
11
41
|
export declare class WxDataSetManager {
|
|
42
|
+
/** dataset's name */
|
|
12
43
|
readonly datasetName: string;
|
|
44
|
+
/** if not empty, returns dataset's instances to be used as time steps in the dataset */
|
|
13
45
|
readonly instanced?: string[];
|
|
46
|
+
/** Get dataset's current instance. */
|
|
14
47
|
readonly instance: string;
|
|
48
|
+
/** dataset's meta */
|
|
15
49
|
readonly meta: WxDatasetMeta;
|
|
50
|
+
/** a reference to the wxAPI object */
|
|
16
51
|
readonly wxapi: WxAPI;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
instance: string;
|
|
20
|
-
instanced?: string[];
|
|
21
|
-
meta: WxDatasetMeta;
|
|
22
|
-
wxapi: WxAPI;
|
|
23
|
-
});
|
|
52
|
+
/** Do not use this constructor directly, use {@link WxAPI.createDatasetManager} instead. */
|
|
53
|
+
constructor({ datasetName, instance, instanced, meta, wxapi }: WxDataSetManagerOptions);
|
|
24
54
|
/**
|
|
25
55
|
* Get closets valid time to the given time.
|
|
26
|
-
* @memberof WxDataSetManager
|
|
27
56
|
* @argument {WxDate} time - either a number of a step in dataset's time array or seconds since epoch or a Date object
|
|
28
57
|
* @returns {string} - closest valid time from the dataset's time array
|
|
29
58
|
* */
|
|
30
59
|
getValidTime(time?: WxDate): string;
|
|
31
60
|
/**
|
|
32
61
|
* Get dataset's times.
|
|
33
|
-
* @
|
|
34
|
-
* @returns {string[]} - copy of dataset's times
|
|
62
|
+
* @returns {string[]} - copy of dataset's time steps
|
|
35
63
|
* */
|
|
36
64
|
getTimes(): string[];
|
|
37
65
|
/**
|
|
38
66
|
* Get dataset's variables.
|
|
39
|
-
* @
|
|
40
|
-
* @returns {string[]} - copy of dataset's variables
|
|
67
|
+
* @returns {string[]} - all dataset's variables
|
|
41
68
|
* */
|
|
42
69
|
getVariables(): string[];
|
|
43
70
|
/**
|
|
44
71
|
* Get dataset's variable meta.
|
|
45
|
-
* @memberof WxDataSetManager
|
|
46
72
|
* @argument {string} variable - variable name
|
|
47
|
-
* @returns {
|
|
48
|
-
* unit - unit of the variable
|
|
49
|
-
* min - minimum value of the variable
|
|
50
|
-
* max - maximum value of the variable
|
|
73
|
+
* @returns {WxVariableMeta} - some of dataset's variable meta
|
|
51
74
|
* */
|
|
52
75
|
getVariableMeta(variable: string): WxVariableMeta | undefined;
|
|
53
76
|
/**
|
|
54
77
|
* Get dataset's native maximum zoom level.
|
|
55
|
-
* @memberof WxDataSetManager
|
|
56
78
|
* @returns {number} - maximum zoom level of the dataset
|
|
57
79
|
* */
|
|
58
80
|
getMaxZoom(): number;
|
|
59
81
|
/**
|
|
60
82
|
* Get dataset's boundaries.
|
|
61
|
-
* @
|
|
62
|
-
* @returns {[west, north, east, south]} - dataset's boundaries
|
|
83
|
+
* @returns {[west, north, east, south] | undefined} - dataset's boundaries
|
|
63
84
|
* */
|
|
64
85
|
getBoundaries180(): [number, number, number, number] | undefined;
|
|
65
86
|
/**
|
|
66
87
|
* Get dataset's boundaries.
|
|
67
|
-
* @
|
|
68
|
-
* @returns {[west, north, east, south]} - dataset's boundaries
|
|
88
|
+
* @returns {WxAllBoundariesMeta | undefined} - dataset's boundaries
|
|
69
89
|
* */
|
|
70
90
|
getBoundaries(): WxAllBoundariesMeta | undefined;
|
|
71
91
|
/**
|
|
72
92
|
* Createts dataset's current URI ready for fetching tiles.
|
|
73
|
-
* @memberof WxDataSetManager
|
|
74
93
|
* @argument {string} variable - variable of the dataset
|
|
75
|
-
* @argument {WxDate} time - time of the dataset
|
|
76
|
-
* @argument {
|
|
94
|
+
* @argument {WxDate} time - time step of the dataset
|
|
95
|
+
* @argument {'png'} ext - must be PNG
|
|
77
96
|
* @returns {string} - dataset's current URI ready for fetching tiles
|
|
78
97
|
* */
|
|
79
|
-
createURI(variable: string, time?: WxDate, ext?:
|
|
98
|
+
createURI(variable: string, time?: WxDate, ext?: 'png'): string;
|
|
80
99
|
/**
|
|
81
100
|
* Check if given variable is available in the dataset.
|
|
82
|
-
* @memberof WxDataSetManager
|
|
83
101
|
* @argument {string} variable - variable name
|
|
84
102
|
* @returns {boolean} - true if variable is available in the dataset
|
|
85
103
|
* */
|
|
86
104
|
checkVariableValid(variable: string): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Checks if variable is a vector component.
|
|
107
|
+
* @argument {string} variable - variable name
|
|
108
|
+
* @returns {WxVars} - [variable] or [variable.eastward, variable.northward]
|
|
109
|
+
* */
|
|
87
110
|
checkCombineVariableIfVector(variable: string): WxVars;
|
|
88
111
|
/**
|
|
89
112
|
* Check if dataset's instance updated (fresh data is arrived) since datasset object was created
|
|
90
|
-
* @memberof WxDataSetManager
|
|
91
113
|
* @returns {boolean} - true if dataset's instance updated since datasset object was created
|
|
92
114
|
* */
|
|
93
115
|
checkDatasetOutdated(): Promise<boolean>;
|
|
116
|
+
/**
|
|
117
|
+
* Get dataset's instance.
|
|
118
|
+
* @returns {Promise<string>} - dataset's instance
|
|
119
|
+
* */
|
|
94
120
|
protected getDatasetInstance(): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* Get dataset's instances.
|
|
123
|
+
* @returns {Promise<string[]>} - dataset's all instances
|
|
124
|
+
* */
|
|
95
125
|
protected getDatasetInstances(): Promise<string[]>;
|
|
96
126
|
}
|
package/dist/es/wxAPI/wxAPI.d.ts
CHANGED
|
@@ -2,26 +2,49 @@ import './wxtiles.css';
|
|
|
2
2
|
import { XYZ, WxTilesLibOptions } from '../utils/wxtools';
|
|
3
3
|
import { QTree } from '../utils/qtree';
|
|
4
4
|
import { WxDataSetManager } from './WxDataSetManager';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* type array of strings - available instances of a dataset */
|
|
7
|
+
export type WxInstances = string[];
|
|
8
|
+
/**
|
|
9
|
+
* Short description of a dataset */
|
|
10
|
+
export interface WxDatasetShortMeta {
|
|
11
|
+
/** represents instances as timesteps for some datasets like NZ Radar */
|
|
7
12
|
instanced?: string[];
|
|
13
|
+
/** last instance of a dataset */
|
|
8
14
|
instance: string;
|
|
15
|
+
/** list of variables in a dataset */
|
|
9
16
|
variables: string[];
|
|
10
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Short description of all available datasets */
|
|
11
20
|
export interface WxDataSetsMetasJSON {
|
|
21
|
+
/**
|
|
22
|
+
* a list of datasets */
|
|
12
23
|
allDatasetsList: string[];
|
|
13
|
-
|
|
24
|
+
/**
|
|
25
|
+
* a list of datasets with short description */
|
|
26
|
+
[name: string]: WxDatasetShortMeta | string[] | undefined;
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Meta data of a variable */
|
|
15
30
|
export interface WxVariableMeta {
|
|
31
|
+
/** units used for the variable */
|
|
16
32
|
units: string;
|
|
33
|
+
/** min value */
|
|
17
34
|
min: number;
|
|
35
|
+
/** max value */
|
|
18
36
|
max: number;
|
|
37
|
+
/** standard name */
|
|
19
38
|
standard_name?: string;
|
|
39
|
+
/** if the variable is a part of vector data, this contains a proper pare */
|
|
20
40
|
vector?: [string, string];
|
|
21
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* interface of an object with variable names as keys and variable meta data as values */
|
|
22
44
|
export interface WxVariablesMetas {
|
|
23
45
|
[name: string]: WxVariableMeta | undefined;
|
|
24
46
|
}
|
|
47
|
+
/** boundaries of a dataset */
|
|
25
48
|
export interface WxBoundaryMeta {
|
|
26
49
|
west: number;
|
|
27
50
|
north: number;
|
|
@@ -29,92 +52,141 @@ export interface WxBoundaryMeta {
|
|
|
29
52
|
south: number;
|
|
30
53
|
}
|
|
31
54
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
55
|
+
* All possible versions of boundaries for the dataset wrapped (0 -> 360) or (180 -> -180)
|
|
56
|
+
* as well as the original boundaries from the dataset */
|
|
35
57
|
export interface WxAllBoundariesMeta {
|
|
36
58
|
boundariesnorm: WxBoundaryMeta;
|
|
37
59
|
boundaries180: WxBoundaryMeta[];
|
|
38
60
|
boundaries360: WxBoundaryMeta[];
|
|
39
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Meta data of a dataset */
|
|
40
64
|
export interface WxDatasetMeta {
|
|
65
|
+
/**
|
|
66
|
+
* a list of variables in a dataset */
|
|
41
67
|
variables: string[];
|
|
68
|
+
/**
|
|
69
|
+
* metadata of variables */
|
|
42
70
|
variablesMeta: WxVariablesMetas;
|
|
71
|
+
/**
|
|
72
|
+
* max zoom level */
|
|
43
73
|
maxZoom: number;
|
|
74
|
+
/**
|
|
75
|
+
* array of available timesteps */
|
|
44
76
|
times: string[];
|
|
77
|
+
/**
|
|
78
|
+
* boundaries of a dataset */
|
|
45
79
|
boundaries?: WxAllBoundariesMeta;
|
|
80
|
+
/**
|
|
81
|
+
* source of the dataset */
|
|
46
82
|
sourceID?: string;
|
|
83
|
+
/**
|
|
84
|
+
* base atmospheric model */
|
|
47
85
|
baseAtmosphericModel?: string;
|
|
86
|
+
/**
|
|
87
|
+
* model used for the dataset*/
|
|
48
88
|
model?: string;
|
|
49
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Options to construct {@link WxAPI} object
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const requestInit: RequestInit = {
|
|
95
|
+
* headers
|
|
96
|
+
* }; // add more options if needed such as headers, mode, credentials, etc
|
|
97
|
+
* const options = {
|
|
98
|
+
* dataServerURL:'https://tiles.metoceanapi.com/data/',
|
|
99
|
+
* requestInit: { headers: myHeaders },
|
|
100
|
+
* }
|
|
101
|
+
* const wxapi = new WxAPI(options);
|
|
102
|
+
* ```
|
|
103
|
+
* */
|
|
50
104
|
export interface WxAPIOptions extends WxTilesLibOptions {
|
|
105
|
+
/** base URL of the server*/
|
|
51
106
|
dataServerURL: string;
|
|
107
|
+
/** full masks tiles URL, Example: `https://server.com/masks/{z}/{x}/{y}.png`
|
|
108
|
+
* @default 'auto' - will be set to `dataServerURL + 'masks/{z}/{x}/{y}.png'`
|
|
109
|
+
* 'none' - will disable masks */
|
|
52
110
|
maskURL?: 'none' | 'auto' | string;
|
|
111
|
+
/** channel to use for masking from RGBA masks
|
|
112
|
+
* 0 - for the masks from Sarah (current), 3 - for the masks from Mapbox
|
|
113
|
+
* @default 'R' */
|
|
114
|
+
maskChannel?: 'R' | 'G' | 'B' | 'A';
|
|
115
|
+
/** maximum zoom level for mask tiles on the server
|
|
116
|
+
* @default 9 */
|
|
117
|
+
maskDepth?: number;
|
|
118
|
+
/** URL to qtree file.
|
|
119
|
+
* {@link QTree} is a hierarchical structure, that allows to quickly find tile's belonging to the sea/land.
|
|
120
|
+
* @default 'auto' - will be set to `dataServerURL + 'masks/9+1.seamask.qtree'`
|
|
121
|
+
* 'none' - will disable the use of {@link QTree} */
|
|
53
122
|
qtreeURL?: 'none' | 'auto' | string;
|
|
123
|
+
/** parameters to be passed to every fetch() aka _headers, credentials, cors, etc_ for interaction with backend data server */
|
|
54
124
|
requestInit?: RequestInit;
|
|
55
125
|
}
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
* */
|
|
126
|
+
/** WxAPI is an initialisation object for the library. See {@link WxAPIOptions} for options.
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* import { WxAPI } from 'wx-tiles';
|
|
130
|
+
* const wxapi = new WxAPI({
|
|
131
|
+
* dataServerURL: 'https://server.com/',
|
|
132
|
+
* // other options
|
|
133
|
+
* });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
67
136
|
export declare class WxAPI {
|
|
137
|
+
/** @internal see {@link WxAPIOptions}*/
|
|
68
138
|
readonly dataServerURL: string;
|
|
69
|
-
|
|
139
|
+
/** @internal see {@link WxAPIOptions}*/
|
|
140
|
+
readonly maskURL: string;
|
|
141
|
+
/** @internal see {@link WxAPIOptions}*/
|
|
142
|
+
readonly maskChannel: number;
|
|
143
|
+
/** @internal see {@link WxAPIOptions}*/
|
|
144
|
+
readonly maskDepth: number;
|
|
145
|
+
/** @internal see {@link WxAPIOptions}*/
|
|
70
146
|
readonly requestInit?: RequestInit;
|
|
147
|
+
/** @internal see {@link WxDataSetsMetasJSON}*/
|
|
71
148
|
readonly datasetsMetas: WxDataSetsMetasJSON;
|
|
149
|
+
/** @internal resolved when {@link WxAPI} is ready to use */
|
|
72
150
|
readonly initDone: Promise<void>;
|
|
151
|
+
/** @internal instance of the qtree object */
|
|
73
152
|
readonly qtree: QTree;
|
|
153
|
+
/** @internal function to load mask tiles */
|
|
74
154
|
readonly loadMaskFunc: ({ x, y, z }: XYZ) => Promise<ImageData>;
|
|
75
|
-
|
|
76
|
-
|
|
155
|
+
/** @param options - see {@link WxAPIOptions} */
|
|
156
|
+
constructor({ dataServerURL, maskURL, maskChannel, maskDepth, qtreeURL, requestInit, colorStyles, units, colorSchemes, }: WxAPIOptions);
|
|
157
|
+
/**
|
|
158
|
+
* Get short meta for a given dataset name
|
|
159
|
+
* @param datasetName - name of the dataset
|
|
160
|
+
* @returns {WxDatasetShortMeta} - short meta for the dataset */
|
|
161
|
+
protected getDatasetShortMeta(datasetName: 'allDatasetsList' | string): WxDatasetShortMeta | undefined;
|
|
77
162
|
/**
|
|
78
163
|
* Get all variables for the given dataset name.
|
|
79
|
-
* @
|
|
80
|
-
* @
|
|
81
|
-
* @returns {Promise<string[]>} - list of all available variables for the dataset
|
|
82
|
-
*/
|
|
164
|
+
* @param datasetName - dataset name
|
|
165
|
+
* @returns {Promise<string[]>} - list of all available variables for the dataset */
|
|
83
166
|
protected getDatasetInatance(datasetName: string): string | undefined;
|
|
84
167
|
/**
|
|
85
168
|
* Get all variables for the given dataset name.
|
|
86
|
-
* @
|
|
87
|
-
* @
|
|
88
|
-
* @returns {Promise<string[]>} - list of all available variables for the dataset
|
|
89
|
-
*/
|
|
169
|
+
* @param datasetName - dataset name
|
|
170
|
+
* @returns {Promise<string[]>} - list of all available variables for the dataset */
|
|
90
171
|
getDatasetVariables(datasetName: string): Promise<string[]>;
|
|
91
172
|
/**
|
|
92
|
-
* Create WxDataSetManager object for the given dataset name.
|
|
93
|
-
* @
|
|
94
|
-
* @
|
|
95
|
-
* @returns {Promise<WxDataSetManager>} - WxDataSetManager object for the given dataset name
|
|
96
|
-
*/
|
|
173
|
+
* Create {@link WxDataSetManager} object for the given dataset name.
|
|
174
|
+
* @param datasetName - dataset name
|
|
175
|
+
* @returns {Promise<WxDataSetManager>} - WxDataSetManager object for the given dataset name */
|
|
97
176
|
createDatasetManager(datasetName: string): Promise<WxDataSetManager>;
|
|
98
177
|
/**
|
|
99
178
|
* Creates all possible dataset managers
|
|
100
179
|
* For each dataset in the datasets list, creates WxDataSetManager object.
|
|
101
180
|
* Requests all datasets meta.json in parallel.
|
|
102
|
-
* @
|
|
103
|
-
* @returns {Promise<WxDataSetManager[]>} - list of all available dataset managers
|
|
104
|
-
*/
|
|
181
|
+
* @returns {Promise<WxDataSetManager[]>} - list of all available dataset managers */
|
|
105
182
|
createAllDatasetsManagers(): Promise<PromiseSettledResult<WxDataSetManager>[]>;
|
|
106
183
|
/**
|
|
107
184
|
* Returns datasets names which have given variable
|
|
108
|
-
* @memberof WxAPI
|
|
109
185
|
* @argument {string} variableName - variable name to search for in datasets
|
|
110
|
-
* @returns {Promise<string[]>} - list of datasets' names
|
|
111
|
-
* */
|
|
186
|
+
* @returns {Promise<string[]>} - list of datasets' names */
|
|
112
187
|
filterDatasetsByVariableName(variableName: string): Promise<string[]>;
|
|
113
188
|
/**
|
|
114
189
|
* Get the list of all available datasets' names
|
|
115
|
-
* @
|
|
116
|
-
* @returns {Promise<string[]>} - list of all available datasets' names
|
|
117
|
-
*/
|
|
190
|
+
* @returns {Promise<string[]>} - list of all available datasets' names */
|
|
118
191
|
getAllDatasetsNames(): Promise<string[]>;
|
|
119
192
|
}
|
|
120
|
-
export {};
|
|
@@ -3,7 +3,10 @@ import { type WxRequestInit, type WxDate, WxLayer, type WxVars, type WxLayerOpti
|
|
|
3
3
|
import { WxVariableMeta } from '../wxAPI/wxAPI';
|
|
4
4
|
import { FrameworkParentClass, FrameworkOptions } from '../wxsource/wxsourcetypes';
|
|
5
5
|
import { WxDataSetManager } from '../wxAPI/WxDataSetManager';
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Mandatory Interface to be implemented by a {@link WxLayerBaseImplementation}
|
|
8
|
+
*/
|
|
9
|
+
export interface WxLayerBaseAPI {
|
|
7
10
|
wxdatasetManager: WxDataSetManager;
|
|
8
11
|
getMetadata(): WxVariableMeta;
|
|
9
12
|
getVariables(): WxVars;
|
|
@@ -19,98 +22,137 @@ export interface WxImplementationAPI {
|
|
|
19
22
|
setStyleByName(wxstyleName: string, reload: boolean): Promise<void>;
|
|
20
23
|
updateCurrentStyleObject(style?: WxColorStyleWeak, reload?: boolean, requestInit?: WxRequestInit): Promise<void>;
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Mandatory Interface to be implemented by a {@link WxTileSource} implementation
|
|
27
|
+
* These methods *Requires* framework specific implementation
|
|
28
|
+
* */
|
|
29
|
+
export interface WxLayerAPI extends WxLayerBaseAPI {
|
|
23
30
|
getLayerInfoAtLatLon(lnglat: WxLngLat, anymap: any): WxTileInfo | undefined;
|
|
24
31
|
_reloadVisible(requestInit?: WxRequestInit): Promise<void>;
|
|
25
32
|
update(): void;
|
|
26
33
|
coveringTiles(): XYZ[];
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Implementation of universal methods for the layer (for Mapbox and Leaflet)
|
|
37
|
+
* To be extended by framework specific implementation
|
|
38
|
+
* Wrapps some methods of {@link WxLayer}
|
|
39
|
+
*/
|
|
40
|
+
export declare class WxLayerBaseImplementation extends FrameworkParentClass implements WxLayerBaseAPI {
|
|
41
|
+
/**
|
|
42
|
+
* @ignore
|
|
43
|
+
* if true, the source is animating
|
|
44
|
+
* */
|
|
29
45
|
protected animation: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @ignore
|
|
48
|
+
* a seed for the animation
|
|
49
|
+
* */
|
|
30
50
|
protected animationSeed: number;
|
|
51
|
+
/**
|
|
52
|
+
* @ignore
|
|
53
|
+
* Used to make coarse level requests for time animation
|
|
54
|
+
* */
|
|
31
55
|
protected oldMaxZoom?: number;
|
|
56
|
+
/**
|
|
57
|
+
* @ignore
|
|
58
|
+
* An instance of the layer
|
|
59
|
+
* */
|
|
32
60
|
protected readonly layer: WxLayer;
|
|
61
|
+
/**
|
|
62
|
+
* @ignore
|
|
63
|
+
* used to avoid multiple animation requests
|
|
64
|
+
* */
|
|
33
65
|
protected redrawRequested?: Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
* Do not use this constructo directly
|
|
69
|
+
* */
|
|
34
70
|
constructor(wxlayeroptions: WxLayerOptions, options?: FrameworkOptions);
|
|
71
|
+
/**
|
|
72
|
+
* returns the dataset manager of the source
|
|
73
|
+
* @returns {WxDataSetManager} the dataset manager of the source
|
|
74
|
+
* */
|
|
35
75
|
get wxdatasetManager(): WxDataSetManager;
|
|
36
76
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @memberof WxTileSource
|
|
77
|
+
* Get the metadata of the current variable(s).
|
|
39
78
|
* @returns {WxVariableMeta} - The metadata of the current variable.
|
|
40
79
|
*/
|
|
41
80
|
getMetadata(): WxVariableMeta;
|
|
42
81
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @memberof WxTileSource
|
|
82
|
+
* Get current variables of the source.
|
|
45
83
|
* @returns {WxVars} variables of the source.
|
|
46
84
|
*/
|
|
47
85
|
getVariables(): WxVars;
|
|
48
86
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @memberof WxTileSource
|
|
87
|
+
* Clears the cache of the source.
|
|
51
88
|
*/
|
|
52
89
|
clearCache(): void;
|
|
53
90
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @memberof WxTileSource
|
|
91
|
+
* Get a copy of the current style of the source.
|
|
56
92
|
* @returns {WxColorStyleStrict} A copy of the current style of the source.
|
|
57
93
|
*/
|
|
58
94
|
getCurrentStyleObjectCopy(): WxColorStyleStrict;
|
|
59
95
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
* @returns {string} The current time of the source.
|
|
96
|
+
* Get the current time of the source.
|
|
97
|
+
* @returns {string} The current time of the source from array of times.
|
|
63
98
|
*/
|
|
64
99
|
getTime(): string;
|
|
65
100
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @memberof WxTileSource
|
|
101
|
+
* Set time and render the source. If the time is not available, the closest time will be used.
|
|
68
102
|
* @param {WxDate} time - Time to set.
|
|
69
|
-
* @param {WxRequestInit | undefined} requestInit - Request options.
|
|
70
|
-
* @returns {Promise<
|
|
103
|
+
* @param {WxRequestInit | undefined} requestInit - Request options for fetch.
|
|
104
|
+
* @returns {Promise<string>} A promise that resolves with current time step when the time is set and the source is loaded and rendered.
|
|
71
105
|
*/
|
|
72
106
|
setTime(time?: WxDate, requestInit?: WxRequestInit): Promise<string>;
|
|
73
107
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
76
|
-
* @param
|
|
77
|
-
* @param {WxRequestInit | undefined} requestInit - Request options.
|
|
108
|
+
* Cache tiles for faster rendering for {@link setTime}. If the time is not available, the closest time will be used.
|
|
109
|
+
* @param time - Time to preload.
|
|
110
|
+
* @param requestInit - Request options.
|
|
78
111
|
* @returns {Promise<void>} A promise that resolves when finished preload.
|
|
79
112
|
*/
|
|
80
113
|
preloadTime(time: WxDate, requestInit?: WxRequestInit): Promise<void>;
|
|
81
114
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @memberof WxTileSource
|
|
115
|
+
* Starts the particle animation for wind and currents if sutiable.
|
|
84
116
|
*/
|
|
85
117
|
startAnimation(): void;
|
|
86
118
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @memberof WxTileSource
|
|
119
|
+
* Stops the particle animation.
|
|
89
120
|
*/
|
|
90
121
|
stopAnimation(): Promise<void>;
|
|
91
122
|
/** set coarse maximum zoom level to make tiles load faster during animation */
|
|
92
123
|
setCoarseLevel(level?: number): Promise<void>;
|
|
93
|
-
/**
|
|
124
|
+
/** restores to the dataset's maximum zoom level */
|
|
94
125
|
unsetCoarseLevel(): Promise<void>;
|
|
95
126
|
/**
|
|
96
|
-
*
|
|
97
|
-
* @memberof WxTileSource
|
|
127
|
+
* Set the style of the source by its name from default styles.
|
|
98
128
|
* @param {string} wxstyleName - Name of the new style to set.
|
|
99
129
|
* @param {boolean} reload - If true, the source will be reloaded and rerendered.
|
|
100
130
|
* @returns {Promise<void>} A promise that resolves when the style is set.
|
|
101
131
|
*/
|
|
102
132
|
setStyleByName(wxstyleName: string, reload?: boolean): Promise<void>;
|
|
103
133
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @memberof WxTileSource
|
|
134
|
+
* Update the current style object of the source partially or completely.
|
|
106
135
|
* @param {WxColorStyleWeak | undefined} style - Style's fields to set.
|
|
107
136
|
* @param {boolean} reload - If true, the source will be reloaded and rerendered.
|
|
108
137
|
* @param {WxRequestInit | undefined} requestInit - Request options.
|
|
109
138
|
* @returns {Promise<void>} A promise that resolves when the style is set.
|
|
110
139
|
*/
|
|
111
140
|
updateCurrentStyleObject(style?: WxColorStyleWeak, reload?: boolean, requestInit?: WxRequestInit): Promise<void>;
|
|
112
|
-
|
|
141
|
+
/** @ignore */
|
|
142
|
+
protected _redrawTiles(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* @ignore
|
|
145
|
+
* A dummy function to be replaced by ancestor classes.
|
|
146
|
+
*/
|
|
113
147
|
protected _reloadVisible(requestInit?: WxRequestInit): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* @ignore
|
|
150
|
+
* A dummy function to be replaced by ancestor classes.
|
|
151
|
+
*/
|
|
114
152
|
protected coveringTiles(): XYZ[];
|
|
153
|
+
/**
|
|
154
|
+
* @ignore
|
|
155
|
+
* A dummy function to be replaced by ancestor classes.
|
|
156
|
+
*/
|
|
115
157
|
protected update(): void;
|
|
116
158
|
}
|
|
@@ -1,30 +1,54 @@
|
|
|
1
1
|
import { TileType } from '../utils/qtree';
|
|
2
2
|
import { type DataIntegral, type DataIntegrals, type DataPictures, UriLoaderPromiseFunc, type XYZ } from '../utils/wxtools';
|
|
3
3
|
import { WxRequestInit, WxURIs, type WxLayer } from './wxlayer';
|
|
4
|
-
|
|
4
|
+
/** Point on pixel grid */
|
|
5
|
+
export interface SLinePoint {
|
|
5
6
|
x: number;
|
|
6
7
|
y: number;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
/** Line on pixel grid */
|
|
10
|
+
export type SLine = SLinePoint[];
|
|
11
|
+
/** Data of a single tile */
|
|
9
12
|
export interface WxData {
|
|
13
|
+
/**
|
|
14
|
+
* data of the tile one for scalar data, three for vector data (two vars+vector lengths)*/
|
|
10
15
|
data: DataPictures;
|
|
16
|
+
/** streamlines */
|
|
11
17
|
slines: SLine[];
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A class to load and preprocess data from PNG tiles. Used intenally by WxLayer.
|
|
21
|
+
* Do not use directly.
|
|
22
|
+
*/
|
|
13
23
|
export declare class Loader {
|
|
24
|
+
/** refference to the Layer {@link WxLayer} in which this loader is used */
|
|
14
25
|
protected readonly layer: WxLayer;
|
|
26
|
+
/** function to load, decode and cache data from URL */
|
|
15
27
|
protected loadDataFunc: UriLoaderPromiseFunc<DataIntegral>;
|
|
28
|
+
/** Do not use constructor directly */
|
|
16
29
|
constructor(layer: WxLayer);
|
|
30
|
+
/**
|
|
31
|
+
* Load and preprocess data for a single tile
|
|
32
|
+
* @param tile - tile coordinates
|
|
33
|
+
* @param requestInit - requestInit for fetch
|
|
34
|
+
* @returns {Promise<WxData | null> } data of the tile
|
|
35
|
+
* */
|
|
17
36
|
load(tile: XYZ, requestInit?: WxRequestInit): Promise<WxData | null>;
|
|
18
37
|
cacheLoad(tile: XYZ, uris: WxURIs, requestInit?: WxRequestInit): Promise<{
|
|
19
38
|
rawdata: DataIntegrals;
|
|
20
39
|
subCoords?: XYZ | undefined;
|
|
21
40
|
tileType: TileType;
|
|
22
41
|
} | null>;
|
|
42
|
+
/** Clear cache */
|
|
23
43
|
clearCache(): void;
|
|
44
|
+
/** @ignore */
|
|
24
45
|
protected _applyMask(data: DataPictures, tile: XYZ, tileType: TileType, needCopy: boolean): Promise<void>;
|
|
46
|
+
/** @ignore */
|
|
25
47
|
protected _vectorMagnitudesPrepare(data: DataPictures): void;
|
|
48
|
+
/** @ignore */
|
|
26
49
|
protected _checkTypeAndMask(coords: XYZ): TileType | undefined;
|
|
50
|
+
/** @ignore */
|
|
27
51
|
protected _checkInsideBoundaries(coords: XYZ): boolean;
|
|
52
|
+
/** @ignore */
|
|
28
53
|
protected _createStreamLines(data: DataPictures): SLine[];
|
|
29
54
|
}
|
|
30
|
-
export {};
|