@mapless/core 1.0.23 → 1.0.24
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/dist/index.js +32 -21
- package/dist/types/Mapless/preset/types.d.ts +20 -4
- package/dist/types/Mapless/preset/types.d.ts.map +1 -1
- package/dist/types/Mapless/theme/lite.d.ts +2 -2
- package/dist/types/Mapless/theme/lite.d.ts.map +1 -1
- package/dist/types/Mapless/themeSources.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11208,33 +11208,36 @@ const lightFog = {
|
|
|
11208
11208
|
0
|
|
11209
11209
|
]
|
|
11210
11210
|
};
|
|
11211
|
-
const lite = ()=>({
|
|
11211
|
+
const lite = (urlCount = 1, rasterOpacity)=>({
|
|
11212
11212
|
version: 8,
|
|
11213
11213
|
sprite: `${maplessPreset.mapboxAssets}/style/sprite`,
|
|
11214
11214
|
glyphs: `${maplessPreset.mapboxAssets}/glyphs/mapbox/{fontstack}/{range}.pbf`,
|
|
11215
11215
|
projection: {
|
|
11216
11216
|
name: 'globe'
|
|
11217
11217
|
},
|
|
11218
|
-
sources: {
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11218
|
+
sources: Object.fromEntries(Array.from({
|
|
11219
|
+
length: urlCount
|
|
11220
|
+
}, (_, i)=>[
|
|
11221
|
+
`lite_world_${i + 1}`,
|
|
11222
|
+
{
|
|
11223
|
+
type: 'raster',
|
|
11224
|
+
tiles: [
|
|
11225
|
+
`${maplessPreset.geoServer}/{MAP_ID}/{z}/{x}/{y}`
|
|
11226
|
+
],
|
|
11227
|
+
tileSize: 256,
|
|
11228
|
+
volatile: true
|
|
11229
|
+
}
|
|
11230
|
+
])),
|
|
11231
|
+
layers: Array.from({
|
|
11232
|
+
length: urlCount
|
|
11233
|
+
}, (_, i)=>({
|
|
11234
|
+
id: `lite_world_layer_${i + 1}`,
|
|
11231
11235
|
type: 'raster',
|
|
11232
|
-
source:
|
|
11236
|
+
source: `lite_world_${i + 1}`,
|
|
11233
11237
|
paint: {
|
|
11234
|
-
'raster-opacity': 1
|
|
11238
|
+
'raster-opacity': rasterOpacity?.[i] ?? 1
|
|
11235
11239
|
}
|
|
11236
|
-
}
|
|
11237
|
-
]
|
|
11240
|
+
}))
|
|
11238
11241
|
});
|
|
11239
11242
|
const buildTileUrl = (url)=>{
|
|
11240
11243
|
if (url.startsWith('http://') || url.startsWith('https://')) if (url.includes('/{z}/{x}/{y}')) return url;
|
|
@@ -11264,10 +11267,18 @@ const transformMapCenter = (center, fromCoord, toCoord)=>{
|
|
|
11264
11267
|
});
|
|
11265
11268
|
};
|
|
11266
11269
|
const sourcesMap = ()=>maplessPreset.MAP_THEME_SOURCES?.reduce((prev, item)=>{
|
|
11267
|
-
const
|
|
11268
|
-
|
|
11269
|
-
buildTileUrl(item.url)
|
|
11270
|
+
const urls = Array.isArray(item.url) ? item.url : [
|
|
11271
|
+
item.url
|
|
11270
11272
|
];
|
|
11273
|
+
const opacities = null != item.rasterOpacity ? Array.isArray(item.rasterOpacity) ? item.rasterOpacity : [
|
|
11274
|
+
item.rasterOpacity
|
|
11275
|
+
] : [];
|
|
11276
|
+
const copy = adjustMapConfigByCoord(lite(urls.length, opacities), item.coord);
|
|
11277
|
+
urls.forEach((url, i)=>{
|
|
11278
|
+
copy.sources[`lite_world_${i + 1}`].tiles = [
|
|
11279
|
+
buildTileUrl(url)
|
|
11280
|
+
];
|
|
11281
|
+
});
|
|
11271
11282
|
if (!maplessPreset.globe) copy.projection = {
|
|
11272
11283
|
name: 'mercator'
|
|
11273
11284
|
};
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import type { CoordSystem } from '../coord';
|
|
2
2
|
export interface MapSourceConfig {
|
|
3
3
|
name: string;
|
|
4
|
-
url: string /**
|
|
4
|
+
url: string | string[] /**
|
|
5
5
|
* 地图数据源URL配置
|
|
6
6
|
*
|
|
7
7
|
* 支持两种格式:
|
|
8
8
|
* 1. 相对路径格式:如 "/783085212" 表示使用默认地图服务的基础路径
|
|
9
9
|
* - 示例:"/783085212" 表示街道地图
|
|
10
|
-
* - 示例:"/783085212" 表示卫星地图
|
|
11
10
|
* - 实际URL会根据配置中的geoServer地址自动拼接
|
|
12
11
|
*
|
|
13
12
|
* 2. 完整URL格式:如 "https://example.com/tiles/{z}/{x}/{y}.png"
|
|
14
13
|
* - 支持标准的WMTS/TMS瓦片服务格式
|
|
15
14
|
* - 必须包含 {z}/{x}/{y} 占位符用于动态替换瓦片坐标
|
|
16
15
|
* - 示例:"https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}"
|
|
16
|
+
*
|
|
17
|
+
* 3. URL数组格式:如 ["/783085212", "/788865972"]
|
|
18
|
+
* - 每个URL对应一个独立的栅格源(lite_world_1, lite_world_2, ...)
|
|
19
|
+
* - 图层顺序由URL数组中的顺序决定
|
|
20
|
+
* - 适用于需要叠加多个瓦片图层的场景
|
|
17
21
|
*
|
|
18
22
|
"sources": [
|
|
19
23
|
{
|
|
20
|
-
"name": "
|
|
24
|
+
"name": "街道图",
|
|
21
25
|
"url": "/788865972",
|
|
22
26
|
"theme4": "dark"
|
|
23
27
|
},
|
|
@@ -30,13 +34,25 @@ export interface MapSourceConfig {
|
|
|
30
34
|
"name": "卫星图(FULL)",
|
|
31
35
|
"url": "http://192.168.3.203:5000/api/v2/MapService/783085212",
|
|
32
36
|
"theme4": "light"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "叠加图层",
|
|
40
|
+
"url": ["/788865972", "/783085212"],
|
|
41
|
+
"theme4": "light"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "带透明度叠加",
|
|
45
|
+
"url": ["/788865972", "/783085212"],
|
|
46
|
+
"rasterOpacity": [1, 0.5],
|
|
47
|
+
"theme4": "light"
|
|
33
48
|
}
|
|
34
49
|
]
|
|
35
50
|
* 注意:当启用精简地图模式(lite)时,此配置不会生效
|
|
36
|
-
* @see
|
|
51
|
+
* @see themeSources.ts sourcesMap函数会为每个URL设置tiles
|
|
37
52
|
*/;
|
|
38
53
|
coord?: CoordSystem;
|
|
39
54
|
theme4?: 'light' | 'dark' | string;
|
|
55
|
+
rasterOpacity?: number | number[];
|
|
40
56
|
}
|
|
41
57
|
export type MaplessPresetType = {
|
|
42
58
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/Mapless/preset/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/Mapless/preset/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDpB,CAAC;IACJ,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAEhB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK;QACjC,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;IAEF,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3E,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAE1B,iBAAiB,EAAE,WAAW,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;CACd,CAAC"}
|
|
@@ -14,7 +14,7 @@ export declare const lightFog: {
|
|
|
14
14
|
'horizon-blend': (string | number | (string | number)[])[];
|
|
15
15
|
'star-intensity': (string | number | (string | number)[])[];
|
|
16
16
|
};
|
|
17
|
-
export declare const lite: () => {
|
|
17
|
+
export declare const lite: (urlCount?: number, rasterOpacity?: number[]) => {
|
|
18
18
|
version: number;
|
|
19
19
|
sprite: string;
|
|
20
20
|
glyphs: string;
|
|
@@ -22,7 +22,7 @@ export declare const lite: () => {
|
|
|
22
22
|
name: string;
|
|
23
23
|
};
|
|
24
24
|
sources: {
|
|
25
|
-
|
|
25
|
+
[k: string]: {
|
|
26
26
|
type: string;
|
|
27
27
|
tiles: string[];
|
|
28
28
|
tileSize: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lite.d.ts","sourceRoot":"","sources":["../../../../src/Mapless/theme/lite.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;;CAenB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;CA+BpB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"lite.d.ts","sourceRoot":"","sources":["../../../../src/Mapless/theme/lite.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;;CAenB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;CA+BpB,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,WAAU,MAAU,EAAE,gBAAgB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;CA0BjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeSources.d.ts","sourceRoot":"","sources":["../../../src/Mapless/themeSources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAW,IAAI,IAAI,OAAO,EAAY,MAAM,cAAc,CAAC;AAElE;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,GAAG;IAClD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,GAAG,CAAC,EAAE,gBAAgB,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAgB1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,QAAQ,EACnB,QAAQ,WAAW,KAClB,QA6BF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,CAAC,MAA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