tds-map-methods 0.0.0-stage → 0.1.1
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/README.md +30 -2
- package/index.cjs +280 -0
- package/index.js +8445 -0
- package/package.json +30 -4
- package/types/components/map/methods/arrowLayer.d.ts +25 -0
- package/types/components/map/methods/common.d.ts +1 -0
- package/types/components/map/methods/config.d.ts +32 -0
- package/types/components/map/methods/createIsoline.d.ts +76 -0
- package/types/components/map/methods/createMic.d.ts +28 -0
- package/types/components/map/methods/fcstLayer.d.ts +81 -0
- package/types/components/map/methods/fcstLayer2.d.ts +30 -0
- package/types/components/map/methods/girdLayer.d.ts +62 -0
- package/types/components/map/methods/index.d.ts +21 -0
- package/types/components/map/methods/isolineLayer.d.ts +18 -0
- package/types/components/map/methods/layer.d.ts +41 -0
- package/types/components/map/methods/layerRequest.d.ts +7 -0
- package/types/components/map/methods/micLayer.d.ts +28 -0
- package/types/components/map/methods/request.d.ts +21 -0
- package/types/components/map/methods/tdsRequest.d.ts +49 -0
- package/types/components/map/methods/typhoonLayer.d.ts +57 -0
- package/types/components/map/methods/typhoonRequest.d.ts +49 -0
- package/types/components/map/methods/utils.d.ts +97 -0
- package/types/components/map/methods/webgpuRaster.d.ts +13 -0
- package/types/components/map/methods/windLayer.d.ts +23 -0
- package/types/components/map/methods/windShaft.d.ts +43 -0
- package/types/components/map/methods/wmsLayer.d.ts +36 -0
- package/types/typings/layer.d.ts +226 -0
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tds-map-methods",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Map methods extracted from tds demo.",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"main": "./index.cjs",
|
|
10
|
+
"module": "./index.js",
|
|
11
|
+
"types": "./types/components/map/methods/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./types/components/map/methods/index.d.ts",
|
|
15
|
+
"import": "./index.js",
|
|
16
|
+
"require": "./index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"ol": "^10.7.0",
|
|
21
|
+
"@turf/turf": "^7.3.1",
|
|
22
|
+
"dayjs": "^1.11.19",
|
|
23
|
+
"d3-contour": "^4.0.2",
|
|
24
|
+
"lodash-es": "^4.17.22"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"index.js",
|
|
28
|
+
"index.cjs",
|
|
29
|
+
"types",
|
|
30
|
+
"README.md"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ImageCanvasSource from "ol/source/ImageCanvas.js";
|
|
2
|
+
import ImageLayer from "ol/layer/Image.js";
|
|
3
|
+
type ExtentLike = [number, number, number, number];
|
|
4
|
+
export declare class ArrowLayer {
|
|
5
|
+
map: Layer.Map;
|
|
6
|
+
options: any;
|
|
7
|
+
contourCache: Map<string, any>;
|
|
8
|
+
constructor(map: Layer.Map, options: any);
|
|
9
|
+
add(): Promise<ImageLayer<ImageCanvasSource>>;
|
|
10
|
+
getArrowParams(): Promise<{
|
|
11
|
+
grayArr: number[];
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}>;
|
|
15
|
+
getArrowSource(options: any): ImageCanvasSource;
|
|
16
|
+
createArrowCanvasSource(data: any, bbox: ExtentLike, options: {
|
|
17
|
+
pixelStep?: number;
|
|
18
|
+
fontSize?: number;
|
|
19
|
+
color?: string;
|
|
20
|
+
}): ImageCanvasSource;
|
|
21
|
+
getSourceFromCache(): ImageCanvasSource;
|
|
22
|
+
delete(): void;
|
|
23
|
+
toggleVisible(visible: boolean): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CommonMethods(): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface MapMethodsConfig {
|
|
2
|
+
/** Prefix used for WMS requests, for example "/server". */
|
|
3
|
+
serviceBaseUrl?: string;
|
|
4
|
+
/** Default Authorization header used for TDS requests. */
|
|
5
|
+
serviceAuthorization?: string;
|
|
6
|
+
/** Prefix used for NCSS dataset.xml requests, for example "/ncss/grid". */
|
|
7
|
+
ncssBaseUrl?: string;
|
|
8
|
+
/** Request timeout in milliseconds. */
|
|
9
|
+
requestTimeout?: number;
|
|
10
|
+
/** Maximum width/height used when requesting source images. */
|
|
11
|
+
imageSize?: number;
|
|
12
|
+
/** Prefix used for typhoon JSON requests. Falls back to serviceBaseUrl. */
|
|
13
|
+
typhoonServiceBaseUrl?: string;
|
|
14
|
+
/** Default typhoon data directory. */
|
|
15
|
+
typhoonDataPath?: string;
|
|
16
|
+
/** Default Authorization header for typhoon requests. */
|
|
17
|
+
typhoonAuthorization?: string;
|
|
18
|
+
}
|
|
19
|
+
export type ResolvedMapMethodsConfig = {
|
|
20
|
+
serviceBaseUrl: string;
|
|
21
|
+
serviceAuthorization: string;
|
|
22
|
+
ncssBaseUrl: string;
|
|
23
|
+
requestTimeout: number;
|
|
24
|
+
imageSize: number;
|
|
25
|
+
typhoonServiceBaseUrl: string;
|
|
26
|
+
typhoonDataPath: string;
|
|
27
|
+
typhoonAuthorization: string;
|
|
28
|
+
};
|
|
29
|
+
/** Configure values that must be supplied by the consuming application. */
|
|
30
|
+
export declare function configureMapMethods(config: MapMethodsConfig): void;
|
|
31
|
+
export declare function getMapMethodsConfig(): Readonly<ResolvedMapMethodsConfig>;
|
|
32
|
+
export declare function resetMapMethodsConfig(): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type Map from "ol/Map.js";
|
|
2
|
+
import VectorLayer from "ol/layer/Vector.js";
|
|
3
|
+
type LegendItem = {
|
|
4
|
+
name?: string;
|
|
5
|
+
scope?: number[];
|
|
6
|
+
color: string;
|
|
7
|
+
};
|
|
8
|
+
type IsolineConfig = {
|
|
9
|
+
legend?: LegendItem[];
|
|
10
|
+
legendScope?: [number, number] | [];
|
|
11
|
+
scope?: [number, number];
|
|
12
|
+
lineWidth?: number;
|
|
13
|
+
/** 等值线线宽,未配置时兼容使用 lineWidth。 */
|
|
14
|
+
isolineLineWidth?: number;
|
|
15
|
+
/** Whether isoline smoothing is enabled. Defaults to true. */
|
|
16
|
+
isolineSmooth?: boolean;
|
|
17
|
+
/** Isoline smoothing level: 0 disables smoothing, 1-3 progressively increase it. */
|
|
18
|
+
isolineSmoothness?: number;
|
|
19
|
+
isolineColor?: string | boolean;
|
|
20
|
+
/** 等值面边界线颜色,未配置时沿用当前等值线颜色。 */
|
|
21
|
+
isolineBorderColor?: string;
|
|
22
|
+
/** 是否使用等值面按图例分级填色。 */
|
|
23
|
+
isolineFill?: boolean;
|
|
24
|
+
/** 是否沿等值线显示数值。 */
|
|
25
|
+
showIsolineValue?: boolean;
|
|
26
|
+
showIsolineLabel?: boolean;
|
|
27
|
+
opacity?: number;
|
|
28
|
+
zIndex?: number;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
export type IsolineOptions = {
|
|
32
|
+
id: string;
|
|
33
|
+
url: string;
|
|
34
|
+
time?: unknown;
|
|
35
|
+
authorization?: string;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
config: IsolineConfig;
|
|
38
|
+
};
|
|
39
|
+
type Coordinate = [number, number];
|
|
40
|
+
type IsolineGeometry = {
|
|
41
|
+
type: "LineString" | "MultiLineString";
|
|
42
|
+
coordinates: Coordinate[] | Coordinate[][];
|
|
43
|
+
value: number;
|
|
44
|
+
};
|
|
45
|
+
type IsolinePolygonGeometry = {
|
|
46
|
+
type: "Polygon" | "MultiPolygon";
|
|
47
|
+
coordinates: Coordinate[][] | Coordinate[][][];
|
|
48
|
+
value: number;
|
|
49
|
+
};
|
|
50
|
+
/** 在地图上添加等值线向量图层。 */
|
|
51
|
+
export declare function addIsolineLayer(options: {
|
|
52
|
+
map: Map;
|
|
53
|
+
id: string;
|
|
54
|
+
isolineGeoJSON: IsolineGeometry[];
|
|
55
|
+
contourGeoJSON?: IsolinePolygonGeometry[];
|
|
56
|
+
colorMap: string | Record<number, string>;
|
|
57
|
+
fillColorMap?: Record<number, string>;
|
|
58
|
+
fillContours?: boolean;
|
|
59
|
+
fillOpacity?: number;
|
|
60
|
+
lineWidth?: number;
|
|
61
|
+
showLabel?: boolean;
|
|
62
|
+
zIndex?: number;
|
|
63
|
+
visible?: boolean;
|
|
64
|
+
/** Reuse parsed OpenLayers features while only the visible legend range changes. */
|
|
65
|
+
geometryCacheKey?: string;
|
|
66
|
+
visibleThresholds?: number[];
|
|
67
|
+
}): VectorLayer<any, any>;
|
|
68
|
+
/** 根据灰度格点生成并添加等值线,重复请求会复用生成结果。 */
|
|
69
|
+
export declare function createIsoline(map: Map, options: IsolineOptions): Promise<VectorLayer<any, any>>;
|
|
70
|
+
/** 预加载若干时间点的等值线到缓存。 */
|
|
71
|
+
export declare function preloadIsoline(options: IsolineOptions, timeList: unknown[]): Promise<void>;
|
|
72
|
+
/** 删除等值线图层,并使未完成的同图层请求失效。 */
|
|
73
|
+
export declare function removeIsolineLayer(map: Map, className: string): void;
|
|
74
|
+
/** 切换显示/隐藏。 */
|
|
75
|
+
export declare function toggleIsolineLayer(map: Map, className: string, show: boolean): void;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type Map from "ol/Map.js";
|
|
2
|
+
import VectorLayer from "ol/layer/Vector.js";
|
|
3
|
+
import VectorSource from "ol/source/Vector.js";
|
|
4
|
+
type LegendItem = {
|
|
5
|
+
name?: string;
|
|
6
|
+
scope?: number[];
|
|
7
|
+
color: string;
|
|
8
|
+
};
|
|
9
|
+
export type MicContourOptions = {
|
|
10
|
+
className: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
authorization?: string;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
legend?: LegendItem[];
|
|
15
|
+
legendScope?: [number, number] | [];
|
|
16
|
+
zIndex?: number;
|
|
17
|
+
opacity?: number;
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
showText?: boolean;
|
|
20
|
+
showFillcolor?: boolean;
|
|
21
|
+
showIsoline?: boolean;
|
|
22
|
+
showPointMarkers?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/** Parse a MICAPS file and atomically replace its related vector layers. */
|
|
25
|
+
export declare function createMicContour(map: Map, options: MicContourOptions): Promise<VectorLayer<VectorSource<any>, any>>;
|
|
26
|
+
/** Remove all layers created for a MICAPS dataset and invalidate pending renders. */
|
|
27
|
+
export declare function removeMicContour(map: Map, className: string): void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import ImageCanvasSource from "ol/source/ImageCanvas.js";
|
|
2
|
+
import ImageLayer from "ol/layer/Image.js";
|
|
3
|
+
type ExtentLike = [number, number, number, number];
|
|
4
|
+
type ScopeLike = [number, number] | [] | undefined;
|
|
5
|
+
type ValueTransformContext = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
source: "raw" | "smooth";
|
|
11
|
+
};
|
|
12
|
+
type ValueTransformFn = (value: number, context: ValueTransformContext) => number | null | undefined;
|
|
13
|
+
type ContourRing = number[][];
|
|
14
|
+
type ContourPolygon = ContourRing[];
|
|
15
|
+
type ContourMultiPolygon = ContourPolygon[];
|
|
16
|
+
type ContourFill = {
|
|
17
|
+
threshold: number;
|
|
18
|
+
path: Path2D;
|
|
19
|
+
color: string;
|
|
20
|
+
};
|
|
21
|
+
type CachedRasterRender = {
|
|
22
|
+
canvas: HTMLCanvasElement;
|
|
23
|
+
renderMask: (number | undefined)[][];
|
|
24
|
+
renderValues: (number | undefined)[][];
|
|
25
|
+
contourFills?: ContourFill[];
|
|
26
|
+
};
|
|
27
|
+
type CachedContourData = {
|
|
28
|
+
schemaVersion: number;
|
|
29
|
+
uniqueThresholds: number[];
|
|
30
|
+
rawArr2D: (number | undefined)[][];
|
|
31
|
+
smoothArr2D: (number | undefined)[][];
|
|
32
|
+
extent: ExtentLike;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
36
|
+
export declare class FcstLayer {
|
|
37
|
+
map: Layer.Map;
|
|
38
|
+
options: any;
|
|
39
|
+
contourCache: Map<string, any>;
|
|
40
|
+
contourLoadingTasks: globalThis.Map<string, Promise<CachedContourData | null>>;
|
|
41
|
+
rasterRenderCache: globalThis.Map<string, CachedRasterRender>;
|
|
42
|
+
rasterRenderLoadingTasks: globalThis.Map<string, Promise<CachedRasterRender | null>>;
|
|
43
|
+
layerData: any;
|
|
44
|
+
ready: Promise<any>;
|
|
45
|
+
private sourceRequestVersion;
|
|
46
|
+
private abortController;
|
|
47
|
+
constructor(map: Layer.Map, options: any);
|
|
48
|
+
private beginSourceRequest;
|
|
49
|
+
private isCurrentRequest;
|
|
50
|
+
private getRequestOptions;
|
|
51
|
+
private getContourCacheKey;
|
|
52
|
+
private setCachedContourData;
|
|
53
|
+
private getRasterRenderCacheKey;
|
|
54
|
+
private setCachedRasterRender;
|
|
55
|
+
add(): Promise<ImageLayer<ImageCanvasSource>>;
|
|
56
|
+
getSourceFromParams(options?: any): Promise<ImageCanvasSource>;
|
|
57
|
+
getOrLoadContourData(options?: any): Promise<CachedContourData | null>;
|
|
58
|
+
getValueByLonLat(lon: number, lat: number, useSmooth?: boolean): Promise<number | null>;
|
|
59
|
+
getValueByLngLat(lng: number, lat: number, useSmooth?: boolean): Promise<number | null>;
|
|
60
|
+
getSourceFromCache(options?: any): Promise<ImageCanvasSource>;
|
|
61
|
+
getFcstRasterSource(options: any, runtimeOptions?: any): Promise<ImageCanvasSource>;
|
|
62
|
+
getValueTransformFn(options?: any): ValueTransformFn | undefined;
|
|
63
|
+
applyValueTransformValue(value: number, context: ValueTransformContext, transformFn?: ValueTransformFn): number;
|
|
64
|
+
applyValueTransform2D(data2D: (number | undefined)[][], source: ValueTransformContext["source"], transformFn?: ValueTransformFn): (number | undefined)[][];
|
|
65
|
+
isMaskSmoothEnabled(options?: any): boolean;
|
|
66
|
+
getMaskSmoothIterations(options?: any): number;
|
|
67
|
+
chaikinSmoothRing(ring: ContourRing, iterations?: number): ContourRing;
|
|
68
|
+
smoothMaskContourPolygons(polygons: ContourMultiPolygon, iterations: number): ContourMultiPolygon;
|
|
69
|
+
createVisibleMaskContourPath(rawArr2D: (number | undefined)[][], width: number, height: number, scope?: ScopeLike, smooth?: boolean, runtimeOptions?: any): Path2D;
|
|
70
|
+
createIsolineContourPath(valueArr2D: (number | undefined)[][], width: number, height: number, scope?: ScopeLike, runtimeOptions?: any): Path2D;
|
|
71
|
+
createIsolineContourFills(valueArr2D: (number | undefined)[][], width: number, height: number, thresholds: number[], colorsRGBA: [number, number, number, number][], scope?: ScopeLike, runtimeOptions?: any): ContourFill[];
|
|
72
|
+
createScopeMaskCanvas(valueArr2D: (number | undefined)[][], width: number, height: number, scope?: ScopeLike, maxExclusive?: boolean): HTMLCanvasElement;
|
|
73
|
+
createLegendEdgeColorCanvas(valueArr2D: (number | undefined)[][], width: number, height: number, firstThreshold: number, lastThreshold: number, firstColor: [number, number, number, number], lastColor: [number, number, number, number]): HTMLCanvasElement;
|
|
74
|
+
createFcstCanvasSource(rasterCanvas: HTMLCanvasElement, dataExtent: ExtentLike, colorMode?: Layer.LayerMode, rawArr2D?: (number | undefined)[][], scope?: ScopeLike, runtimeOptions?: any, contourFills?: ContourFill[], contourValues?: (number | undefined)[][], selectedEdgeCanvas?: HTMLCanvasElement | null, maxExclusive?: boolean): ImageCanvasSource;
|
|
75
|
+
/** 预加载图层 */
|
|
76
|
+
preload(url: string): Promise<void>;
|
|
77
|
+
delete(): void;
|
|
78
|
+
toggleVisible(visible: boolean): void;
|
|
79
|
+
updateParams(newOptions: any): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import ImageCanvasSource from "ol/source/ImageCanvas.js";
|
|
2
|
+
import ImageLayer from "ol/layer/Image.js";
|
|
3
|
+
type ExtentLike = [number, number, number, number];
|
|
4
|
+
type ScopeLike = [number, number] | [] | undefined;
|
|
5
|
+
type ContourRing = number[][];
|
|
6
|
+
type ContourPolygon = ContourRing[];
|
|
7
|
+
type ContourMultiPolygon = ContourPolygon[];
|
|
8
|
+
export declare class FcstLayer {
|
|
9
|
+
map: Layer.Map;
|
|
10
|
+
options: any;
|
|
11
|
+
contourCache: Map<string, any>;
|
|
12
|
+
layerData: any;
|
|
13
|
+
constructor(map: Layer.Map, options: any);
|
|
14
|
+
add(): Promise<ImageLayer<ImageCanvasSource>>;
|
|
15
|
+
getSourceFromParams(): Promise<ImageCanvasSource>;
|
|
16
|
+
getSourceFromCache(): Promise<ImageCanvasSource>;
|
|
17
|
+
getFcstRasterSource(options: any): Promise<ImageCanvasSource>;
|
|
18
|
+
isMaskSmoothEnabled(): boolean;
|
|
19
|
+
getMaskSmoothIterations(): number;
|
|
20
|
+
chaikinSmoothRing(ring: ContourRing, iterations?: number): ContourRing;
|
|
21
|
+
smoothMaskContourPolygons(polygons: ContourMultiPolygon, iterations: number): ContourMultiPolygon;
|
|
22
|
+
createVisibleMaskContourPath(rawArr2D: (number | undefined)[][], width: number, height: number, scope?: ScopeLike, smooth?: boolean): Path2D;
|
|
23
|
+
createFcstCanvasSource(rasterCanvas: HTMLCanvasElement, dataExtent: ExtentLike, colorMode?: Layer.LayerMode, rawArr2D?: (number | undefined)[][], scope?: ScopeLike): ImageCanvasSource;
|
|
24
|
+
/** 预加载图层 */
|
|
25
|
+
preload(): Promise<void>;
|
|
26
|
+
delete(): void;
|
|
27
|
+
toggleVisible(visible: boolean): void;
|
|
28
|
+
updateParams(newOptions: any): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ImageCanvasSource from "ol/source/ImageCanvas.js";
|
|
2
|
+
import ImageLayer from "ol/layer/Image.js";
|
|
3
|
+
type ExtentLike = [number, number, number, number];
|
|
4
|
+
type GridValueTransformContext = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
source: "raw";
|
|
10
|
+
};
|
|
11
|
+
type GridValueTransformFn = (value: number, context: GridValueTransformContext) => number | null | undefined;
|
|
12
|
+
type CachedGridData = {
|
|
13
|
+
schemaVersion: number;
|
|
14
|
+
rawArr2D: (number | undefined)[][];
|
|
15
|
+
extent: ExtentLike;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
type GridDataInput = {
|
|
20
|
+
rawArr2D: (number | undefined)[][];
|
|
21
|
+
extent: ExtentLike;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function setLinkedGridLayer(id: string, layer: GridLayer): void;
|
|
26
|
+
export declare function getLinkedGridLayer(id: string): GridLayer;
|
|
27
|
+
export declare function deleteLinkedGridLayer(id: string): void;
|
|
28
|
+
export declare function forEachLinkedGridLayer(callback: (layer: GridLayer) => void): void;
|
|
29
|
+
export declare function clearLinkedGridLayerMap(): void;
|
|
30
|
+
export declare class GridLayer {
|
|
31
|
+
map: Layer.Map;
|
|
32
|
+
options: Layer.Config;
|
|
33
|
+
contourCache: Map<string, CachedGridData>;
|
|
34
|
+
externalGridDataProvider?: () => Promise<GridDataInput | null>;
|
|
35
|
+
constructor(map: Layer.Map, options: Layer.Config, externalGridDataProvider?: () => Promise<GridDataInput | null>);
|
|
36
|
+
getClassName(): string;
|
|
37
|
+
getRuntimeConfig(): Layer.Config["config"] & Record<string, any>;
|
|
38
|
+
add(): Promise<ImageLayer<ImageCanvasSource>>;
|
|
39
|
+
getCacheKey(): string;
|
|
40
|
+
getOrLoadGridData(): Promise<CachedGridData | null>;
|
|
41
|
+
getSourceFromCache(): Promise<ImageCanvasSource>;
|
|
42
|
+
getSourceFromParams(): Promise<ImageCanvasSource>;
|
|
43
|
+
getTextDrawOptions(): {
|
|
44
|
+
pixelStep: number;
|
|
45
|
+
fontSize: number;
|
|
46
|
+
decimals: number;
|
|
47
|
+
fontColor: string;
|
|
48
|
+
strokeColor: string;
|
|
49
|
+
strokeWidth: number;
|
|
50
|
+
fontFamily: string;
|
|
51
|
+
useDevicePixelRatio: boolean;
|
|
52
|
+
};
|
|
53
|
+
isValueInScope(value: number, scope?: [number, number] | []): boolean;
|
|
54
|
+
interpolateValue(rawArr2D: (number | undefined)[][], width: number, height: number, dataX: number, dataY: number): number;
|
|
55
|
+
getValueTransformFn(): GridValueTransformFn | undefined;
|
|
56
|
+
applyValueTransformValue(value: number, context: GridValueTransformContext): number;
|
|
57
|
+
createGridCanvasSource(data: CachedGridData): ImageCanvasSource;
|
|
58
|
+
delete(): void;
|
|
59
|
+
toggleVisible(visible: boolean): void;
|
|
60
|
+
updateParams(newOptions: Layer.Config): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference path="../../../typings/layer.d.ts" />
|
|
2
|
+
export * from "./common";
|
|
3
|
+
export * from "./config";
|
|
4
|
+
export * from "./request";
|
|
5
|
+
export * from "./tdsRequest";
|
|
6
|
+
export * from "./layerRequest";
|
|
7
|
+
export * from "./layer";
|
|
8
|
+
export * from "./utils";
|
|
9
|
+
export * from "./fcstLayer";
|
|
10
|
+
export * from "./girdLayer";
|
|
11
|
+
export * from "./arrowLayer";
|
|
12
|
+
export * from "./micLayer";
|
|
13
|
+
export * from "./createMic";
|
|
14
|
+
export * from "./createIsoline";
|
|
15
|
+
export * from "./isolineLayer";
|
|
16
|
+
export * from "./webgpuRaster";
|
|
17
|
+
export * from "./windLayer";
|
|
18
|
+
export * from "./windShaft";
|
|
19
|
+
export * from "./wmsLayer";
|
|
20
|
+
export * from "./typhoonLayer";
|
|
21
|
+
export * from "./typhoonRequest";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type Map from "ol/Map.js";
|
|
2
|
+
import { type IsolineOptions } from "./createIsoline";
|
|
3
|
+
type ManagedIsolineOptions = Omit<IsolineOptions, "url"> & {
|
|
4
|
+
url?: string;
|
|
5
|
+
type: string | string[];
|
|
6
|
+
};
|
|
7
|
+
export declare class IsolineLayer {
|
|
8
|
+
map: Map;
|
|
9
|
+
options: ManagedIsolineOptions;
|
|
10
|
+
ready: Promise<void>;
|
|
11
|
+
private abortController;
|
|
12
|
+
constructor(map: Map, options: ManagedIsolineOptions);
|
|
13
|
+
private render;
|
|
14
|
+
delete(): void;
|
|
15
|
+
toggleVisible(visible: boolean): void;
|
|
16
|
+
updateParams(newOptions: ManagedIsolineOptions): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Map } from "ol";
|
|
2
|
+
import { type MapMethodsConfig } from "./config";
|
|
3
|
+
type WmsLayerColorOptions = {
|
|
4
|
+
styles?: string;
|
|
5
|
+
colorScaleRange?: string | [number, number];
|
|
6
|
+
numColorBands?: string | number;
|
|
7
|
+
aboveMaxColor?: string;
|
|
8
|
+
belowMinColor?: string;
|
|
9
|
+
bgColor?: string;
|
|
10
|
+
logScale?: boolean | string;
|
|
11
|
+
};
|
|
12
|
+
export type MapInitConfig = {
|
|
13
|
+
center?: [number, number];
|
|
14
|
+
zoom?: number;
|
|
15
|
+
layers?: any[];
|
|
16
|
+
mapMethodsConfig?: MapMethodsConfig;
|
|
17
|
+
};
|
|
18
|
+
export declare function initMap(target: string | HTMLElement, config?: MapInitConfig): Promise<Map>;
|
|
19
|
+
/**
|
|
20
|
+
* 根据classname获取对应图层
|
|
21
|
+
* @param className 图层的className
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLayerByClassName(map: Map, className: string): import("ol/layer/Base").default;
|
|
24
|
+
/**
|
|
25
|
+
* 移除图层
|
|
26
|
+
* @param className 图层的className
|
|
27
|
+
*/
|
|
28
|
+
export declare function removeLayer(map: Map, className: string): void;
|
|
29
|
+
export declare function addTile(map: Map, layer: any): void;
|
|
30
|
+
export declare function removeTile(map: Map, layerId: string): void;
|
|
31
|
+
export declare function toggleLayerShowHide(map: Map | undefined, layerId: string, visible: boolean): void;
|
|
32
|
+
export declare function loadLayer(map: Map | undefined, options: Layer.Config): void;
|
|
33
|
+
export declare function removeLayerById(layerId: string): void;
|
|
34
|
+
export declare function clearAllLayers(): void;
|
|
35
|
+
export declare function toggleVisibleById(layerId: string, visible: boolean): void;
|
|
36
|
+
export declare function updateLayer(options: Layer.Config): void;
|
|
37
|
+
export declare function updateWmsLayerColor(layerId: string, colorOptions: WmsLayerColorOptions): void;
|
|
38
|
+
export declare function getLoadedLayers(): any[];
|
|
39
|
+
export declare function getLoadedLayerOptions(): Layer.Config[];
|
|
40
|
+
export declare function getValueByLonLat(map: Map | undefined, layerId: string, lon: number, lat: number, useSmooth?: boolean): Promise<number | null>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface LayerResolveRequestOptions {
|
|
2
|
+
serviceBaseUrl?: string;
|
|
3
|
+
ncssBaseUrl?: string;
|
|
4
|
+
authorization?: string;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveLayerLoadOptions(menu: Layer.Config, options?: LayerResolveRequestOptions): Promise<Layer.Config | null>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type MicOptions = Layer.Config & Record<string, any>;
|
|
2
|
+
export declare class MicLayer {
|
|
3
|
+
map: Layer.Map;
|
|
4
|
+
options: MicOptions;
|
|
5
|
+
ready: Promise<any>;
|
|
6
|
+
private sourceRequestVersion;
|
|
7
|
+
private abortController;
|
|
8
|
+
constructor(map: Layer.Map, options: MicOptions);
|
|
9
|
+
private beginSourceRequest;
|
|
10
|
+
getMicContourOptions(filePath: string): {
|
|
11
|
+
className: string;
|
|
12
|
+
filePath: string;
|
|
13
|
+
authorization: string;
|
|
14
|
+
legend: any;
|
|
15
|
+
legendScope: any;
|
|
16
|
+
zIndex: number;
|
|
17
|
+
opacity: number;
|
|
18
|
+
showText: any;
|
|
19
|
+
showFillcolor: any;
|
|
20
|
+
showIsoline: any;
|
|
21
|
+
showPointMarkers: any;
|
|
22
|
+
};
|
|
23
|
+
add(): Promise<void>;
|
|
24
|
+
delete(): void;
|
|
25
|
+
toggleVisible(visible: boolean): void;
|
|
26
|
+
updateParams(newOptions: Layer.Config & Record<string, any>): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type TdsResponseType = "json" | "text" | "blob" | "arrayBuffer" | "arraybuffer" | "response";
|
|
2
|
+
export interface TdsRequestOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
authorization?: string;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
headers?: HeadersInit;
|
|
8
|
+
credentials?: RequestCredentials;
|
|
9
|
+
}
|
|
10
|
+
export interface TdsGetOptions extends TdsRequestOptions {
|
|
11
|
+
responseType?: TdsResponseType;
|
|
12
|
+
}
|
|
13
|
+
export declare function createTdsRequestUrl(url: string, baseUrl?: string): string;
|
|
14
|
+
export declare function fetchTdsResponse(url: string, options?: TdsRequestOptions): Promise<Response>;
|
|
15
|
+
export declare function fetchTdsGet<T = unknown>(url: string, params?: Record<string, unknown>, authorization?: string, options?: TdsGetOptions): Promise<T>;
|
|
16
|
+
export declare function fetchXmlData(url: string, authorization?: string, options?: TdsRequestOptions): Promise<string>;
|
|
17
|
+
export declare function fetchXMLFromUrl(url: string, authorization?: string, options?: TdsRequestOptions): Promise<string>;
|
|
18
|
+
export declare function fetchTxtOrJson(url: string, params?: Record<string, unknown>, authorization?: string, options?: TdsRequestOptions): Promise<string>;
|
|
19
|
+
export declare function fetchExcel(url: string, authorization?: string, options?: TdsRequestOptions): Promise<ArrayBuffer>;
|
|
20
|
+
export declare function fetchImageBase64(url: string, paramsOrAuthorization?: Record<string, unknown> | string, authorization?: string, options?: TdsRequestOptions): Promise<string>;
|
|
21
|
+
export declare function fetchTdsImageBase64(url: string, params?: Record<string, unknown>): Promise<string>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface VariableMinMaxResult {
|
|
2
|
+
min: number;
|
|
3
|
+
max: number;
|
|
4
|
+
}
|
|
5
|
+
export interface TdsCatalogItem {
|
|
6
|
+
label: string;
|
|
7
|
+
key: string;
|
|
8
|
+
url: string;
|
|
9
|
+
type: "menu" | "file";
|
|
10
|
+
isLeaf: boolean;
|
|
11
|
+
fileType?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TdsDatasetRequestOptions {
|
|
14
|
+
filePath: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
authorization?: string;
|
|
17
|
+
serviceBaseUrl?: string;
|
|
18
|
+
ncssBaseUrl?: string;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
export declare function parseXML(xml: string, target?: string): any;
|
|
22
|
+
export declare function getNCXmlData(xml: string): {
|
|
23
|
+
latLonBox: any;
|
|
24
|
+
timeSpan: any;
|
|
25
|
+
axis: any;
|
|
26
|
+
grid: any;
|
|
27
|
+
};
|
|
28
|
+
export declare function getNodeData(options: {
|
|
29
|
+
xmlJson: any[];
|
|
30
|
+
type: "menu" | "file";
|
|
31
|
+
}): TdsCatalogItem[];
|
|
32
|
+
export declare function getVariableMinMax(filePath: string, variable: string, latLonBox: {
|
|
33
|
+
north: number;
|
|
34
|
+
south: number;
|
|
35
|
+
east: number;
|
|
36
|
+
west: number;
|
|
37
|
+
}, time?: string, authorization?: string, serviceBaseUrl?: string, signal?: AbortSignal): Promise<VariableMinMaxResult>;
|
|
38
|
+
export declare function getMenuList(url: string, authorization?: string, options?: Pick<TdsDatasetRequestOptions, "serviceBaseUrl" | "signal">): Promise<{
|
|
39
|
+
type: "" | "menu" | "file";
|
|
40
|
+
data: TdsCatalogItem[];
|
|
41
|
+
}>;
|
|
42
|
+
export declare function getXmlData(options: TdsDatasetRequestOptions): Promise<{
|
|
43
|
+
type: "file";
|
|
44
|
+
latLonBox: any;
|
|
45
|
+
timeList: string[];
|
|
46
|
+
fileList: TdsCatalogItem[];
|
|
47
|
+
url: string;
|
|
48
|
+
authorization: string;
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { FeatureLike } from "ol/Feature.js";
|
|
2
|
+
import VectorSource from "ol/source/Vector.js";
|
|
3
|
+
import { Style } from "ol/style.js";
|
|
4
|
+
import { type TyphoonDetail, type TyphoonListItem, type TyphoonPoint } from "./typhoonRequest";
|
|
5
|
+
type TrackKind = "obs" | "fcst";
|
|
6
|
+
type TyphoonLayerOptions = Layer.Config & {
|
|
7
|
+
config: Layer.Config["config"] & {
|
|
8
|
+
typhoonConfig?: {
|
|
9
|
+
serviceBaseUrl?: string;
|
|
10
|
+
dataPath?: string;
|
|
11
|
+
typhoonNums?: string[];
|
|
12
|
+
sourcePriority?: string[];
|
|
13
|
+
showForecast?: boolean;
|
|
14
|
+
fitToExtent?: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare class TyphoonLayer {
|
|
19
|
+
map: Layer.Map;
|
|
20
|
+
options: TyphoonLayerOptions;
|
|
21
|
+
abortController: AbortController | null;
|
|
22
|
+
styleCache: globalThis.Map<string, Style>;
|
|
23
|
+
constructor(map: Layer.Map, options: TyphoonLayerOptions);
|
|
24
|
+
getClassName(): string;
|
|
25
|
+
getConfig(): {
|
|
26
|
+
serviceBaseUrl?: string;
|
|
27
|
+
dataPath?: string;
|
|
28
|
+
typhoonNums?: string[];
|
|
29
|
+
sourcePriority?: string[];
|
|
30
|
+
showForecast?: boolean;
|
|
31
|
+
fitToExtent?: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
serviceBaseUrl?: string;
|
|
34
|
+
dataPath?: string;
|
|
35
|
+
typhoonNums?: string[];
|
|
36
|
+
sourcePriority?: string[];
|
|
37
|
+
showForecast?: boolean;
|
|
38
|
+
fitToExtent?: boolean;
|
|
39
|
+
};
|
|
40
|
+
add(): Promise<void>;
|
|
41
|
+
getSelectedTyphoonNums(list: TyphoonListItem[]): string[];
|
|
42
|
+
getPrimarySource(detail: TyphoonDetail, kind: TrackKind): string;
|
|
43
|
+
getLastPoint(points: TyphoonPoint[]): TyphoonPoint;
|
|
44
|
+
findForecastBasePoint(obsPoints: TyphoonPoint[], forecastPoint: TyphoonPoint | undefined): TyphoonPoint;
|
|
45
|
+
getForecastAnchorPoint(detail: TyphoonDetail, sourceName: string, forecastPoints: TyphoonPoint[], primaryObsSource: string | undefined): TyphoonPoint;
|
|
46
|
+
render(list: TyphoonListItem[], details: TyphoonDetail[]): void;
|
|
47
|
+
appendTyphoonFeatures(source: VectorSource, detail: TyphoonDetail, meta: TyphoonListItem | undefined, color: string): void;
|
|
48
|
+
addLineFeature(source: VectorSource, points: TyphoonPoint[], properties: Record<string, unknown>): void;
|
|
49
|
+
addPointFeatures(source: VectorSource, points: TyphoonPoint[], properties: Record<string, unknown>): void;
|
|
50
|
+
addForecastLabelFeature(source: VectorSource, point: TyphoonPoint, properties: Record<string, unknown>): void;
|
|
51
|
+
createStyle(feature: FeatureLike): Style;
|
|
52
|
+
getGradeColor(grade: string, fallback: string): string;
|
|
53
|
+
delete(): void;
|
|
54
|
+
toggleVisible(visible: boolean): void;
|
|
55
|
+
updateParams(newOptions: TyphoonLayerOptions): void;
|
|
56
|
+
}
|
|
57
|
+
export {};
|