@metoceanapi/wxtiles-leaflet 2.0.5 → 2.0.7
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 +4 -0
- package/README.md +132 -305
- package/dist/es/controls/WxStyleEditorControl.d.ts +1 -1
- package/dist/es/controls/WxTimeControl .d.ts +2 -2
- package/dist/es/defaults/styles.d.ts +2 -2
- package/dist/es/defaults/uconv.d.ts +2 -2
- package/dist/es/index.d.ts +32 -5
- package/dist/es/index.js +6 -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 +243 -33
- package/dist/es/wxAPI/WxDataSetManager.d.ts +70 -34
- package/dist/es/wxAPI/wxAPI.d.ts +115 -43
- package/dist/es/wxlayer/WxImplementation.d.ts +76 -34
- 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 -11
- package/dist/es/wxsource/wxsource.d.ts +60 -20
- package/dist/es/wxsource/wxsourcetypes.d.ts +16 -0
- package/dist/web/index.js +6 -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 +98 -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 +406 -0
- package/docs/docs/classes/WxLayer.html +363 -0
- package/docs/docs/classes/WxLayerBaseImplementation.html +371 -0
- package/docs/docs/classes/WxTileSource.html +453 -0
- package/docs/docs/enums/TileType.html +80 -0
- package/docs/docs/functions/WXLOG.html +119 -0
- package/docs/docs/functions/WxCreateLegend.html +127 -0
- package/docs/docs/functions/WxGetColorSchemes.html +114 -0
- package/docs/docs/functions/WxGetColorStyles.html +114 -0
- package/docs/docs/functions/WxTilesLogging.html +119 -0
- package/docs/docs/index.html +201 -0
- package/docs/docs/interfaces/ColorStylesIncomplete.html +117 -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 +75 -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 +118 -0
- package/docs/docs/interfaces/WxColorStyleStrict.html +319 -0
- package/docs/docs/interfaces/WxColorStyleWeak.html +345 -0
- package/docs/docs/interfaces/WxColorStylesStrict.html +74 -0
- package/docs/docs/interfaces/WxColorStylesWeakMixed.html +117 -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 +118 -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/WxSourceLayerOptions.html +109 -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 +117 -0
- package/docs/docs/interfaces/WxVariableMeta.html +108 -0
- package/docs/docs/interfaces/WxVariablesMetas.html +117 -0
- package/docs/docs/interfaces/XYZ.html +84 -0
- package/docs/docs/modules.html +210 -0
- package/docs/docs/types/DataIntegrals.html +110 -0
- package/docs/docs/types/DataPictures.html +110 -0
- package/docs/docs/types/SLine.html +110 -0
- package/docs/docs/types/SubTrees.html +110 -0
- package/docs/docs/types/SubTreesN.html +110 -0
- package/docs/docs/types/TreeN.html +110 -0
- package/docs/docs/types/UriLoaderPromiseFunc.html +130 -0
- package/docs/docs/types/WxDate.html +110 -0
- package/docs/docs/types/WxURIs.html +110 -0
- package/docs/docs/types/WxUnitTuple.html +110 -0
- package/docs/docs/types/WxVars.html +110 -0
- package/docs/script/script.css +1 -1
- package/docs/script/script.js +11 -6
- package/package.json +8 -8
- package/src_example/index.ts +111 -54
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;
|
|
31
|
-
|
|
51
|
+
/**
|
|
52
|
+
* @ignore
|
|
53
|
+
* Used to make coarse level requests for time animation
|
|
54
|
+
* */
|
|
55
|
+
protected readonly 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>;
|
|
34
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
* Do not use this constructor directly
|
|
69
|
+
* */
|
|
70
|
+
constructor(wxLayerOptions: WxLayerOptions, frwOptions: 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 {};
|
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
import { DataPicture, XYZ } from '../utils/wxtools';
|
|
2
2
|
import { WxBoundaryMeta } from '../wxAPI/wxAPI';
|
|
3
|
+
/**
|
|
4
|
+
* Get sub-tile of a mask via baricemrtric interpolation
|
|
5
|
+
* @param {ImageData} inputData - input data
|
|
6
|
+
* @param {XYZ | undefined} subCoords - subtile coordinates
|
|
7
|
+
* @returns {ImageData} subtile data
|
|
8
|
+
* */
|
|
9
|
+
export declare function subMask(inputData: ImageData, subCoords: XYZ | undefined, channel: number): ImageData;
|
|
10
|
+
/**
|
|
11
|
+
* Get sub-tile of a regular data via baricemrtric interpolation
|
|
12
|
+
* @param {DataPicture} inputData - input data
|
|
13
|
+
* @param {XYZ | undefined} subCoords - subtile coordinates
|
|
14
|
+
* @returns {DataPicture} subtile data
|
|
15
|
+
* */
|
|
3
16
|
export declare function subData(inputData: DataPicture, subCoords?: XYZ): DataPicture;
|
|
17
|
+
/**
|
|
18
|
+
* Get sub-tile of a degree data tile via bilinear degree interpolation, so middle of 350..10 degree is 0 degree.
|
|
19
|
+
* @param {DataPicture} inputData - input data
|
|
20
|
+
* @param {XYZ | undefined} subCoords - subtile coordinates
|
|
21
|
+
* @returns {DataPicture} subtile data
|
|
22
|
+
* */
|
|
4
23
|
export declare function subDataDegree(inputData: DataPicture, subCoords?: XYZ): DataPicture;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Upply sea/land mask to a data tile
|
|
26
|
+
* 0 - for the masks from Sarah (current), 3 - for the masks from Mapbox
|
|
27
|
+
* @param {DataPicture} dataIn - data tile
|
|
28
|
+
* @param {ImageData} mask - sea/land mask
|
|
29
|
+
* @param {number} mc - mask channel of the mask picture to use (0 - Red, 1 - Green, 2 - Blue, 3 - Alpha)
|
|
30
|
+
* @param {'sea' | 'land'} maskType - sea or land masking to apply
|
|
31
|
+
* @returns {DataPicture} - masked data tile
|
|
32
|
+
* */
|
|
33
|
+
export declare function applyMask(dataIn: DataPicture, { data }: ImageData, mc: number, maskType: 'land' | 'sea'): DataPicture;
|
|
34
|
+
/**
|
|
35
|
+
* Create a bounding box for a tile
|
|
36
|
+
* @param coords - tile coordinates
|
|
37
|
+
* @returns {WxBoundaryMeta} [minLon, minLat, maxLon, maxLat]
|
|
38
|
+
* */
|
|
8
39
|
export declare function makeBox(coords: XYZ): WxBoundaryMeta;
|
|
40
|
+
/**
|
|
41
|
+
* Splits tile coordinates into a tile coords at maximum zoom and a subtile coords.
|
|
42
|
+
* If the tile is below maximum zoom, the subtile coords are undefined.
|
|
43
|
+
* @param coords - tile coordinates
|
|
44
|
+
* @param maxZoom - maximum zoom
|
|
45
|
+
* @returns [tile coords, subtile coords (or undefined)]
|
|
46
|
+
* */
|
|
9
47
|
export declare function splitCoords(coords: XYZ, maxZoom: number): {
|
|
10
48
|
upCoords: XYZ;
|
|
11
49
|
subCoords?: XYZ;
|
|
@@ -1,14 +1,53 @@
|
|
|
1
1
|
import { type WxData } from './loader';
|
|
2
2
|
import { type WxLayer } from './wxlayer';
|
|
3
|
+
/**
|
|
4
|
+
* data object contains raw data, contexts, and other info for fast rendering of a single tile
|
|
5
|
+
* */
|
|
3
6
|
export interface WxRasterData {
|
|
7
|
+
/**
|
|
8
|
+
* Context for drawing back fill and isolines
|
|
9
|
+
*/
|
|
4
10
|
ctxFill: CanvasRenderingContext2D;
|
|
11
|
+
/**
|
|
12
|
+
* Context for rendering vector arrows, and other text
|
|
13
|
+
* */
|
|
5
14
|
ctxText: CanvasRenderingContext2D;
|
|
15
|
+
/**
|
|
16
|
+
* Context for rendering animated streamlines
|
|
17
|
+
* */
|
|
6
18
|
ctxStreamLines: CanvasRenderingContext2D;
|
|
19
|
+
/**
|
|
20
|
+
* {@link WxData} data object for this tile
|
|
21
|
+
* */
|
|
7
22
|
data: WxData;
|
|
8
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Calss for rendering a single tile.
|
|
26
|
+
* Do not create manually
|
|
27
|
+
* */
|
|
9
28
|
export declare class Painter {
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
* {@link WxLayer} - parent layer
|
|
32
|
+
* */
|
|
10
33
|
protected layer: WxLayer;
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
* Do not use constructor directly
|
|
37
|
+
* */
|
|
11
38
|
constructor(layer: WxLayer);
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
* Render data of a single tile into canvases passed in {@link WxRasterData}
|
|
42
|
+
* @param {WxRasterData} data - data object for this tile
|
|
43
|
+
* */
|
|
12
44
|
paint({ data, ctxFill, ctxText, ctxStreamLines }: WxRasterData): void;
|
|
45
|
+
getPaintedCanvas(data: WxRasterData, animation: boolean, seed: number): HTMLCanvasElement;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
* Render animated streamlines for a single tile with time seed
|
|
49
|
+
* @param {WxRasterData} data - data object for this tile
|
|
50
|
+
* @param {number} seed - time seed
|
|
51
|
+
* */
|
|
13
52
|
imprintVectorAnimationLinesStep({ data, ctxFill, ctxStreamLines }: WxRasterData, seed: number): void;
|
|
14
53
|
}
|