tds-map-methods 0.1.14 → 0.1.16
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 +17 -3
- package/index.cjs +13 -13
- package/index.js +2422 -2176
- package/package.json +1 -1
- package/types/components/map/methods/createMic.d.ts +5 -0
- package/types/components/map/methods/fcstLayer.d.ts +34 -7
- package/types/components/map/methods/micLayer.d.ts +5 -0
- package/types/components/map/methods/tdsRequest.d.ts +1 -0
- package/types/typings/layer.d.ts +23 -0
package/package.json
CHANGED
|
@@ -41,6 +41,11 @@ export type MicContourOptions = {
|
|
|
41
41
|
showFillcolor?: boolean;
|
|
42
42
|
showIsoline?: boolean;
|
|
43
43
|
showPointMarkers?: boolean;
|
|
44
|
+
showFrostLine?: boolean;
|
|
45
|
+
frostLineColor?: string;
|
|
46
|
+
frostLineWidth?: number;
|
|
47
|
+
frostLineTickSpacing?: number;
|
|
48
|
+
frostLineTickLength?: number;
|
|
44
49
|
};
|
|
45
50
|
export declare function preloadMicContours(urls: string[], className: string): Promise<void>;
|
|
46
51
|
/** Parse a MICAPS file and atomically replace its related vector layers. */
|
|
@@ -10,6 +10,29 @@ type ValueTransformContext = {
|
|
|
10
10
|
source: "raw" | "smooth";
|
|
11
11
|
};
|
|
12
12
|
type ValueTransformFn = (value: number, context: ValueTransformContext) => number | null | undefined;
|
|
13
|
+
export type FcstFusionPreset = "add" | "subtract" | "multiply" | "divide" | "average" | "min" | "max";
|
|
14
|
+
export type FcstFusionContext = {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
source: "raw" | "smooth";
|
|
20
|
+
};
|
|
21
|
+
export type FcstFusionFunction = (firstValue: number, secondValue: number, context: FcstFusionContext) => number | null | undefined;
|
|
22
|
+
export type FcstFusionMethod = FcstFusionPreset | FcstFusionFunction;
|
|
23
|
+
export type FcstFusionSource = string | (Omit<Partial<Layer.Config>, "config" | "url"> & {
|
|
24
|
+
url: string;
|
|
25
|
+
config?: Partial<Layer.Config["config"]>;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
});
|
|
28
|
+
export type FcstFusionResult = {
|
|
29
|
+
uniqueThresholds: number[];
|
|
30
|
+
rawArr2D: (number | undefined)[][];
|
|
31
|
+
smoothArr2D: (number | undefined)[][];
|
|
32
|
+
extent: ExtentLike;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
13
36
|
type ContourRing = number[][];
|
|
14
37
|
type ContourPolygon = ContourRing[];
|
|
15
38
|
type ContourMultiPolygon = ContourPolygon[];
|
|
@@ -26,13 +49,7 @@ type CachedRasterRender = {
|
|
|
26
49
|
};
|
|
27
50
|
type CachedContourData = {
|
|
28
51
|
schemaVersion: number;
|
|
29
|
-
|
|
30
|
-
rawArr2D: (number | undefined)[][];
|
|
31
|
-
smoothArr2D: (number | undefined)[][];
|
|
32
|
-
extent: ExtentLike;
|
|
33
|
-
width: number;
|
|
34
|
-
height: number;
|
|
35
|
-
};
|
|
52
|
+
} & FcstFusionResult;
|
|
36
53
|
export declare class FcstLayer {
|
|
37
54
|
map: Layer.Map;
|
|
38
55
|
options: any;
|
|
@@ -55,6 +72,16 @@ export declare class FcstLayer {
|
|
|
55
72
|
add(): Promise<ImageLayer<ImageCanvasSource>>;
|
|
56
73
|
getSourceFromParams(options?: any): Promise<ImageCanvasSource>;
|
|
57
74
|
getOrLoadContourData(options?: any): Promise<CachedContourData | null>;
|
|
75
|
+
private resolveFusionSource;
|
|
76
|
+
private resolveFusionMethod;
|
|
77
|
+
private assertFusionDataCompatible;
|
|
78
|
+
private fuseGrid;
|
|
79
|
+
/**
|
|
80
|
+
* Loads two raster sources and combines their corresponding cells.
|
|
81
|
+
* Both sources must use the same extent and grid dimensions. Invalid cells
|
|
82
|
+
* remain invalid; division by zero also produces an invalid cell.
|
|
83
|
+
*/
|
|
84
|
+
fuseDataSources(firstSource: FcstFusionSource, secondSource: FcstFusionSource, method?: FcstFusionMethod): Promise<FcstFusionResult | null>;
|
|
58
85
|
getValueByLonLat(lon: number, lat: number, useSmooth?: boolean): Promise<number | null>;
|
|
59
86
|
getValueByLngLat(lng: number, lat: number, useSmooth?: boolean): Promise<number | null>;
|
|
60
87
|
getSourceFromCache(options?: any): Promise<ImageCanvasSource>;
|
|
@@ -19,6 +19,11 @@ export declare class MicLayer {
|
|
|
19
19
|
showFillcolor: any;
|
|
20
20
|
showIsoline: any;
|
|
21
21
|
showPointMarkers: any;
|
|
22
|
+
showFrostLine: any;
|
|
23
|
+
frostLineColor: any;
|
|
24
|
+
frostLineWidth: any;
|
|
25
|
+
frostLineTickSpacing: any;
|
|
26
|
+
frostLineTickLength: any;
|
|
22
27
|
};
|
|
23
28
|
add(): Promise<void>;
|
|
24
29
|
delete(): void;
|
package/types/typings/layer.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare namespace Layer {
|
|
|
47
47
|
icon?: string;
|
|
48
48
|
/** 目录接口返回的节点类型 */
|
|
49
49
|
fileListType?: "file" | "menu";
|
|
50
|
+
/** Optional regular expression used to select files from a TDS catalog. */
|
|
51
|
+
fileNamePattern?: string;
|
|
50
52
|
/** 数据单位 */
|
|
51
53
|
unit?: string;
|
|
52
54
|
/** 菜单项请求头 Authorization,优先于环境变量 */
|
|
@@ -92,6 +94,16 @@ declare namespace Layer {
|
|
|
92
94
|
showIsoline?: boolean;
|
|
93
95
|
/** MICAPS 是否显示符号点 */
|
|
94
96
|
showPointMarkers?: boolean;
|
|
97
|
+
/** MICAPS 是否显示霜冻线,默认 true */
|
|
98
|
+
showFrostLine?: boolean;
|
|
99
|
+
/** MICAPS 霜冻线颜色,默认 #ff0000 */
|
|
100
|
+
frostLineColor?: string;
|
|
101
|
+
/** MICAPS 霜冻线线条粗细;未配置时优先使用文件线宽,默认 3 */
|
|
102
|
+
frostLineWidth?: number;
|
|
103
|
+
/** MICAPS 霜冻线锯齿间隔(像素),默认 22 */
|
|
104
|
+
frostLineTickSpacing?: number;
|
|
105
|
+
/** MICAPS 霜冻线锯齿大小(像素),默认 16 */
|
|
106
|
+
frostLineTickLength?: number;
|
|
95
107
|
/** 图例色带范围 */
|
|
96
108
|
legend: Legend;
|
|
97
109
|
/** 图例色带类型 visible:不显示色带 legend: 显示色块文字 grid:显示网格色带 gradual:显示渐变色带 */
|
|
@@ -122,6 +134,17 @@ declare namespace Layer {
|
|
|
122
134
|
* false 时仅用于显示值,不改变过滤判定。
|
|
123
135
|
*/
|
|
124
136
|
valueTransformAffectsScope?: boolean;
|
|
137
|
+
/** Optional companion grid used to mask this layer when its value is absent. */
|
|
138
|
+
fusionConfig?: {
|
|
139
|
+
filePath: string;
|
|
140
|
+
fileNamePattern?: string;
|
|
141
|
+
serviceBaseUrl?: string;
|
|
142
|
+
authorization?: string;
|
|
143
|
+
layerName: string;
|
|
144
|
+
scope: [number, number];
|
|
145
|
+
precipitationThreshold?: number;
|
|
146
|
+
url?: string;
|
|
147
|
+
};
|
|
125
148
|
/** 掩膜边缘平滑开关,默认false */
|
|
126
149
|
smooth?: boolean;
|
|
127
150
|
/** Chaikin 平滑迭代次数,默认2,建议1-3,取值范围1-5 */
|