@summeruse/ol 0.3.2 → 0.3.3
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 +7 -0
- package/dist/index.js +15 -15
- package/es/utils/layer/index.mjs +22 -22
- package/es/utils/style/index.mjs +6 -6
- package/lib/utils/layer/index.js +1 -1
- package/lib/utils/style/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -261,13 +261,13 @@ function createTextStyle(r) {
|
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
function createStyle(r) {
|
|
264
|
-
let { fillOptions: l, strokeOptions: u, iconOptions: d, circleOptions: f, textOptions: p
|
|
264
|
+
let { fillOptions: l, strokeOptions: u, iconOptions: d, circleOptions: f, textOptions: p, stroke: m, image: h, fill: g, text: _,...v } = r, y = g || (l ? new Fill(l) : void 0), b = m || (u ? new Stroke(u) : void 0), x = h || (d ? new Icon(d) : f ? createCircleStyle(f) : void 0), S = _ || (p ? createTextStyle(p) : void 0);
|
|
265
265
|
return new Style({
|
|
266
|
-
...
|
|
267
|
-
fill:
|
|
268
|
-
stroke:
|
|
269
|
-
image:
|
|
270
|
-
text:
|
|
266
|
+
...v,
|
|
267
|
+
fill: y,
|
|
268
|
+
stroke: b,
|
|
269
|
+
image: x,
|
|
270
|
+
text: S
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
function createPoint(r) {
|
|
@@ -388,23 +388,23 @@ function createVectorSource(r) {
|
|
|
388
388
|
return new VectorSource({ ...r });
|
|
389
389
|
}
|
|
390
390
|
function createVectorLayer(r) {
|
|
391
|
-
let { styleOptions: l, sourceOptions: u
|
|
391
|
+
let { styleOptions: l, sourceOptions: u, style: d, source: f,...p } = r || {}, m = d || (l ? createStyle(l) : void 0), h = f || createVectorSource(u);
|
|
392
392
|
return {
|
|
393
|
-
source:
|
|
393
|
+
source: h,
|
|
394
394
|
layer: new VectorLayer({
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
style:
|
|
395
|
+
...p,
|
|
396
|
+
source: h,
|
|
397
|
+
style: m
|
|
398
398
|
})
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
401
|
function createWebGLVectorLayer(r) {
|
|
402
|
-
let { style: l, sourceOptions:
|
|
402
|
+
let { style: l, source: u, sourceOptions: d,...f } = r, p = u || createVectorSource(d);
|
|
403
403
|
return {
|
|
404
|
-
source:
|
|
404
|
+
source: p,
|
|
405
405
|
layer: new WebGLVectorLayer({
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
...f,
|
|
407
|
+
source: p,
|
|
408
408
|
style: l
|
|
409
409
|
})
|
|
410
410
|
};
|
package/es/utils/layer/index.mjs
CHANGED
|
@@ -6,64 +6,64 @@ import { Tile } from "ol/layer";
|
|
|
6
6
|
import WebGLVectorLayer from "ol/layer/WebGLVector";
|
|
7
7
|
import { BingMaps, OSM, XYZ } from "ol/source";
|
|
8
8
|
function createTianDiTuUrl(e) {
|
|
9
|
-
let { type:
|
|
10
|
-
return `${
|
|
9
|
+
let { type: l = "img", projection: u = WebMercatorProjection, key: d } = e, f = e.url || "https://t{0-4}.tianditu.gov.cn", p = `&tk=${d}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
|
|
10
|
+
return `${f}/${l}_${u === "EPSG:4326" ? "c" : u === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${l}${p}`;
|
|
11
11
|
}
|
|
12
12
|
function createTianDiTuLayer(e) {
|
|
13
|
-
let { layerOptions:
|
|
13
|
+
let { layerOptions: c, sourceOptions: l,...u } = e;
|
|
14
14
|
return new Tile({
|
|
15
15
|
source: new XYZ({
|
|
16
|
-
url: createTianDiTuUrl(
|
|
17
|
-
projection:
|
|
16
|
+
url: createTianDiTuUrl(u),
|
|
17
|
+
projection: u.projection,
|
|
18
18
|
crossOrigin: "Anonymous",
|
|
19
|
-
...
|
|
19
|
+
...l
|
|
20
20
|
}),
|
|
21
|
-
...
|
|
21
|
+
...c
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
function createBingLayer({ name: e, key:
|
|
24
|
+
function createBingLayer({ name: e, key: c, layerOptions: l, sourceOptions: u }) {
|
|
25
25
|
return new Tile({
|
|
26
26
|
source: new BingMaps({
|
|
27
|
-
key:
|
|
27
|
+
key: c,
|
|
28
28
|
imagerySet: e,
|
|
29
29
|
placeholderTiles: !1,
|
|
30
|
-
...
|
|
30
|
+
...u
|
|
31
31
|
}),
|
|
32
|
-
...
|
|
32
|
+
...l
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function createOpenStreetMapLayer(e) {
|
|
36
|
-
let { layerOptions:
|
|
36
|
+
let { layerOptions: c, sourceOptions: l } = e || {};
|
|
37
37
|
return new Tile({
|
|
38
38
|
source: new OSM({
|
|
39
39
|
crossOrigin: "Anonymous",
|
|
40
|
-
...
|
|
40
|
+
...l
|
|
41
41
|
}),
|
|
42
|
-
...
|
|
42
|
+
...c
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
function createVectorSource(e) {
|
|
46
46
|
return new VectorSource({ ...e });
|
|
47
47
|
}
|
|
48
48
|
function createVectorLayer(e) {
|
|
49
|
-
let { styleOptions:
|
|
49
|
+
let { styleOptions: c, sourceOptions: d, style: f, source: p,...m } = e || {}, h = f || (c ? createStyle(c) : void 0), g = p || createVectorSource(d);
|
|
50
50
|
return {
|
|
51
51
|
source: g,
|
|
52
52
|
layer: new VectorLayer({
|
|
53
|
-
source: g,
|
|
54
53
|
...m,
|
|
55
|
-
|
|
54
|
+
source: g,
|
|
55
|
+
style: h
|
|
56
56
|
})
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
function createWebGLVectorLayer(e) {
|
|
60
|
-
let { style:
|
|
60
|
+
let { style: c, source: l, sourceOptions: u,...d } = e, f = l || createVectorSource(u);
|
|
61
61
|
return {
|
|
62
|
-
source:
|
|
62
|
+
source: f,
|
|
63
63
|
layer: new WebGLVectorLayer({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
style:
|
|
64
|
+
...d,
|
|
65
|
+
source: f,
|
|
66
|
+
style: c
|
|
67
67
|
})
|
|
68
68
|
};
|
|
69
69
|
}
|
package/es/utils/style/index.mjs
CHANGED
|
@@ -18,13 +18,13 @@ function createTextStyle(e) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
function createStyle(e) {
|
|
21
|
-
let { fillOptions: a, strokeOptions: c, iconOptions: l, circleOptions: u, textOptions: d
|
|
21
|
+
let { fillOptions: a, strokeOptions: c, iconOptions: l, circleOptions: u, textOptions: d, stroke: f, image: p, fill: m, text: h,...g } = e, _ = m || (a ? new Fill(a) : void 0), v = f || (c ? new Stroke(c) : void 0), y = p || (l ? new Icon(l) : u ? createCircleStyle(u) : void 0), b = h || (d ? createTextStyle(d) : void 0);
|
|
22
22
|
return new Style({
|
|
23
|
-
...
|
|
24
|
-
fill:
|
|
25
|
-
stroke:
|
|
26
|
-
image:
|
|
27
|
-
text:
|
|
23
|
+
...g,
|
|
24
|
+
fill: _,
|
|
25
|
+
stroke: v,
|
|
26
|
+
image: y,
|
|
27
|
+
text: b
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
export { createCircleStyle, createStyle, createTextStyle };
|
package/lib/utils/layer/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`../../constants/projection.js`),n=require(`../style/index.js`);let r=require(`ol/layer/Vector`);r=e.__toESM(r);let i=require(`ol/source/Vector`);i=e.__toESM(i);let a=require(`ol/layer`);a=e.__toESM(a);let o=require(`ol/layer/WebGLVector`);o=e.__toESM(o);let s=require(`ol/source`);s=e.__toESM(s);function c(e){let{type:n=`img`,projection:r=t.WebMercatorProjection,key:i}=e,a=e.url||`https://t{0-4}.tianditu.gov.cn`,o=`&tk=${i}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;return`${a}/${n}_${r===`EPSG:4326`?`c`:r===`EPSG:3857`?`w`:`c`}/wmts?LAYER=${n}${o}`}function l(e){let{layerOptions:t,sourceOptions:n,...r}=e;return new a.Tile({source:new s.XYZ({url:c(r),projection:r.projection,crossOrigin:`Anonymous`,...n}),...t})}function u({name:e,key:t,layerOptions:n,sourceOptions:r}){return new a.Tile({source:new s.BingMaps({key:t,imagerySet:e,placeholderTiles:!1,...r}),...n})}function d(e){let{layerOptions:t,sourceOptions:n}=e||{};return new a.Tile({source:new s.OSM({crossOrigin:`Anonymous`,...n}),...t})}function f(e){return new i.default({...e})}function p(e){let{styleOptions:t,sourceOptions:i,...
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`../../constants/projection.js`),n=require(`../style/index.js`);let r=require(`ol/layer/Vector`);r=e.__toESM(r);let i=require(`ol/source/Vector`);i=e.__toESM(i);let a=require(`ol/layer`);a=e.__toESM(a);let o=require(`ol/layer/WebGLVector`);o=e.__toESM(o);let s=require(`ol/source`);s=e.__toESM(s);function c(e){let{type:n=`img`,projection:r=t.WebMercatorProjection,key:i}=e,a=e.url||`https://t{0-4}.tianditu.gov.cn`,o=`&tk=${i}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;return`${a}/${n}_${r===`EPSG:4326`?`c`:r===`EPSG:3857`?`w`:`c`}/wmts?LAYER=${n}${o}`}function l(e){let{layerOptions:t,sourceOptions:n,...r}=e;return new a.Tile({source:new s.XYZ({url:c(r),projection:r.projection,crossOrigin:`Anonymous`,...n}),...t})}function u({name:e,key:t,layerOptions:n,sourceOptions:r}){return new a.Tile({source:new s.BingMaps({key:t,imagerySet:e,placeholderTiles:!1,...r}),...n})}function d(e){let{layerOptions:t,sourceOptions:n}=e||{};return new a.Tile({source:new s.OSM({crossOrigin:`Anonymous`,...n}),...t})}function f(e){return new i.default({...e})}function p(e){let{styleOptions:t,sourceOptions:i,style:a,source:o,...s}=e||{},c=a||(t?n.createStyle(t):void 0),l=o||f(i);return{source:l,layer:new r.default({...s,source:l,style:c})}}function m(e){let{style:t,source:n,sourceOptions:r,...i}=e,a=n||f(r);return{source:a,layer:new o.default({...i,source:a,style:t})}}exports.createBingLayer=u,exports.createOpenStreetMapLayer=d,exports.createTianDiTuLayer=l,exports.createTianDiTuUrl=c,exports.createVectorLayer=p,exports.createVectorSource=f,exports.createWebGLVectorLayer=m;
|
package/lib/utils/style/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.js`);let t=require(`ol/style`);t=e.__toESM(t);function n(e){let{fillOptions:n,strokeOptions:r,...i}=e;return new t.Circle({...i,fill:n?new t.Fill(n):void 0,stroke:r?new t.Stroke(r):void 0})}function r(e){let{fillOptions:n,strokeOptions:r,backgroundFillOptions:i,backgroundStrokeOptions:a,...o}=e;return new t.Text({...o,fill:n?new t.Fill(n):void 0,stroke:r?new t.Stroke(r):void 0,backgroundFill:i?new t.Fill(i):void 0,backgroundStroke:a?new t.Stroke(a):void 0})}function i(e){let{fillOptions:i,strokeOptions:a,iconOptions:o,circleOptions:s,textOptions:c,...
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.js`);let t=require(`ol/style`);t=e.__toESM(t);function n(e){let{fillOptions:n,strokeOptions:r,...i}=e;return new t.Circle({...i,fill:n?new t.Fill(n):void 0,stroke:r?new t.Stroke(r):void 0})}function r(e){let{fillOptions:n,strokeOptions:r,backgroundFillOptions:i,backgroundStrokeOptions:a,...o}=e;return new t.Text({...o,fill:n?new t.Fill(n):void 0,stroke:r?new t.Stroke(r):void 0,backgroundFill:i?new t.Fill(i):void 0,backgroundStroke:a?new t.Stroke(a):void 0})}function i(e){let{fillOptions:i,strokeOptions:a,iconOptions:o,circleOptions:s,textOptions:c,stroke:l,image:u,fill:d,text:f,...p}=e,m=d||(i?new t.Fill(i):void 0),h=l||(a?new t.Stroke(a):void 0),g=u||(o?new t.Icon(o):s?n(s):void 0),_=f||(c?r(c):void 0);return new t.Style({...p,fill:m,stroke:h,image:g,text:_})}exports.createCircleStyle=n,exports.createStyle=i,exports.createTextStyle=r;
|