@summeruse/ol 0.3.1 → 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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @summeruse/ol
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - a224dda: refactor(style): 优化样式创建逻辑以支持直接传入样式对象
8
+ - 2085d50: refactor(utils/layer): 优化矢量图层创建函数,支持直接传入 style 和 source
9
+
10
+ ## 0.3.2
11
+
12
+ ### Patch Changes
13
+
14
+ - 92af465: refactor(ol-map): 添加组件名称定义以提升可维护性
15
+ - 432f073: feat(图层工具): 添加 WebGL 矢量图层支持并重构矢量图层创建逻辑
16
+
3
17
  ## 0.3.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import VectorLayer from "ol/layer/Vector";
8
8
  import VectorSource from "ol/source/Vector";
9
9
  import { Circle as Circle$1, Fill, Icon, Stroke, Style, Text } from "ol/style";
10
10
  import { Graticule, Tile } from "ol/layer";
11
+ import WebGLVectorLayer from "ol/layer/WebGLVector";
11
12
  import { BingMaps, OSM, XYZ } from "ol/source";
12
13
  import { transform, transformExtent } from "ol/proj";
13
14
  const olMapInjectionKey = Symbol("olMapInjectionKey");
@@ -15,6 +16,7 @@ function useOlMap() {
15
16
  return inject(olMapInjectionKey);
16
17
  }
17
18
  var ol_map_default = /* @__PURE__ */ defineComponent({
19
+ name: "OlMap",
18
20
  __name: "index",
19
21
  props: {
20
22
  olMap: { default: () => new Map() },
@@ -259,13 +261,13 @@ function createTextStyle(r) {
259
261
  });
260
262
  }
261
263
  function createStyle(r) {
262
- let { fillOptions: l, strokeOptions: u, iconOptions: d, circleOptions: f, textOptions: p,...m } = r, h = l ? new Fill(l) : void 0, g = u ? new Stroke(u) : void 0, _ = d ? new Icon(d) : void 0, v = f ? createCircleStyle(f) : void 0, y = p ? createTextStyle(p) : void 0;
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);
263
265
  return new Style({
264
- ...m,
265
- fill: h,
266
- stroke: g,
267
- image: _ || v,
268
- text: y
266
+ ...v,
267
+ fill: y,
268
+ stroke: b,
269
+ image: x,
270
+ text: S
269
271
  });
270
272
  }
271
273
  function createPoint(r) {
@@ -382,14 +384,28 @@ function createOpenStreetMapLayer(r) {
382
384
  ...l
383
385
  });
384
386
  }
387
+ function createVectorSource(r) {
388
+ return new VectorSource({ ...r });
389
+ }
385
390
  function createVectorLayer(r) {
386
- let { styleOptions: l,...u } = r || {}, d = l ? createStyle(l) : void 0, f = new VectorSource();
391
+ let { styleOptions: l, sourceOptions: u, style: d, source: f,...p } = r || {}, m = d || (l ? createStyle(l) : void 0), h = f || createVectorSource(u);
387
392
  return {
388
- source: f,
393
+ source: h,
389
394
  layer: new VectorLayer({
390
- source: f,
391
- ...u,
392
- style: d || u.style
395
+ ...p,
396
+ source: h,
397
+ style: m
398
+ })
399
+ };
400
+ }
401
+ function createWebGLVectorLayer(r) {
402
+ let { style: l, source: u, sourceOptions: d,...f } = r, p = u || createVectorSource(d);
403
+ return {
404
+ source: p,
405
+ layer: new WebGLVectorLayer({
406
+ ...f,
407
+ source: p,
408
+ style: l
393
409
  })
394
410
  };
395
411
  }
@@ -722,4 +738,4 @@ function useSwitchBaseLayer(r) {
722
738
  });
723
739
  }, { immediate: !0 }), { visibleLayerName: l };
724
740
  }
725
- export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
741
+ export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
@@ -4,6 +4,7 @@ import { Map, View } from "ol";
4
4
  import { Attribution, FullScreen, OverviewMap, Rotate, ScaleLine, Zoom } from "ol/control";
5
5
  import { DoubleClickZoom, DragPan, DragRotate, KeyboardPan, KeyboardZoom, MouseWheelZoom, PinchRotate, PinchZoom } from "ol/interaction";
6
6
  var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
7
+ name: "OlMap",
7
8
  __name: "index",
8
9
  props: {
9
10
  olMap: { default: () => new Map() },
package/es/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { EPSG_3857, EPSG_4326, WGS84Projection, WebMercatorProjection } from "./
7
7
  import { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm } from "./utils/distance/index.mjs";
8
8
  import { createCircleStyle, createStyle, createTextStyle } from "./utils/style/index.mjs";
9
9
  import { createCircle, createCircleFeature, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature } from "./utils/feature/index.mjs";
10
- import { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer } from "./utils/layer/index.mjs";
10
+ import { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer } from "./utils/layer/index.mjs";
11
11
  import { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator } from "./utils/projection/index.mjs";
12
12
  import "./utils/index.mjs";
13
13
  import { useDrawLineString } from "./composables/useDrawLineString/index.mjs";
@@ -16,4 +16,4 @@ import { useGraticule } from "./composables/useGraticule/index.mjs";
16
16
  import { usePointermove } from "./composables/usePointermove/index.mjs";
17
17
  import { useSwitchBaseLayer } from "./composables/useSwitchBaseLayer/index.mjs";
18
18
  import "./composables/index.mjs";
19
- export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
19
+ export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createBingLayer, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createOpenStreetMapLayer, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer, formatAngle, formatRotation, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
@@ -1,5 +1,5 @@
1
1
  import { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm } from "./distance/index.mjs";
2
2
  import { createCircleStyle, createStyle, createTextStyle } from "./style/index.mjs";
3
3
  import { createCircle, createCircleFeature, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature } from "./feature/index.mjs";
4
- import { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer } from "./layer/index.mjs";
4
+ import { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer } from "./layer/index.mjs";
5
5
  import { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator } from "./projection/index.mjs";
@@ -2,8 +2,10 @@ import { StyleOptions } from '../style';
2
2
  import { Feature } from 'ol';
3
3
  import { Geometry } from 'ol/geom';
4
4
  import { ProjectionLike } from 'ol/proj';
5
+ import { FlatStyleLike } from 'ol/style/flat';
5
6
  import { Tile as TileLayer } from 'ol/layer';
6
7
  import { default as VectorLayer } from 'ol/layer/Vector';
8
+ import { default as WebGLVectorLayer } from 'ol/layer/WebGLVector';
7
9
  import { BingMaps, OSM, XYZ } from 'ol/source';
8
10
  import { default as VectorSource } from 'ol/source/Vector';
9
11
  export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
@@ -35,11 +37,24 @@ export interface CreateOpenStreetMapLayerOptions {
35
37
  sourceOptions?: BingMapsSourceOptions;
36
38
  }
37
39
  export declare function createOpenStreetMapLayer(data?: CreateOpenStreetMapLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
38
- export type _VectorLayerOptions = ConstructorParameters<typeof VectorLayer>[0];
39
- export type VectorLayerOptions = _VectorLayerOptions & {
40
+ export type _VectorSourceOptions<T extends Geometry = Geometry> = ConstructorParameters<typeof VectorSource<Feature<T>>>[0];
41
+ export type VectorSourceOptions<T extends Geometry = Geometry> = _VectorSourceOptions<T>;
42
+ export declare function createVectorSource<T extends Geometry = Geometry>(options?: VectorSourceOptions<T>): VectorSource<Feature<T>>;
43
+ export type _VectorLayerOptions<T extends Geometry = Geometry> = ConstructorParameters<typeof VectorLayer<VectorSource<Feature<T>>>>[0];
44
+ export type VectorLayerOptions<T extends Geometry = Geometry> = _VectorLayerOptions<T> & {
40
45
  styleOptions?: StyleOptions;
46
+ sourceOptions?: VectorSourceOptions<T>;
41
47
  };
42
- export declare function createVectorLayer<T extends Geometry = Geometry>(options?: VectorLayerOptions): {
48
+ export declare function createVectorLayer<T extends Geometry = Geometry>(options?: VectorLayerOptions<T>): {
43
49
  source: VectorSource<Feature<T>>;
44
- layer: VectorLayer<VectorSource<import('ol/Feature').FeatureLike>, import('ol/Feature').FeatureLike>;
50
+ layer: VectorLayer<VectorSource<Feature<T>>, Feature<T>>;
51
+ };
52
+ export type _WebGLVectorLayerOptions<T extends Geometry = Geometry> = ConstructorParameters<typeof WebGLVectorLayer<VectorSource<Feature<T>>>>[0];
53
+ export type WebGLVectorLayerOptions<T extends Geometry = Geometry> = _WebGLVectorLayerOptions<T> & {
54
+ style: FlatStyleLike;
55
+ sourceOptions?: VectorSourceOptions<T>;
56
+ };
57
+ export declare function createWebGLVectorLayer<T extends Geometry = Geometry>(options: WebGLVectorLayerOptions<T>): {
58
+ source: VectorSource<Feature<T>>;
59
+ layer: WebGLVectorLayer<VectorSource<Feature<T>>, Feature<T>>;
45
60
  };
@@ -3,53 +3,68 @@ import { createStyle } from "../style/index.mjs";
3
3
  import VectorLayer from "ol/layer/Vector";
4
4
  import VectorSource from "ol/source/Vector";
5
5
  import { Tile } from "ol/layer";
6
+ import WebGLVectorLayer from "ol/layer/WebGLVector";
6
7
  import { BingMaps, OSM, XYZ } from "ol/source";
7
8
  function createTianDiTuUrl(e) {
8
- let { type: c = "img", projection: l = WebMercatorProjection, key: u } = e, d = e.url || "https://t{0-4}.tianditu.gov.cn", f = `&tk=${u}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
9
- return `${d}/${c}_${l === "EPSG:4326" ? "c" : l === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${c}${f}`;
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}`;
10
11
  }
11
12
  function createTianDiTuLayer(e) {
12
- let { layerOptions: s, sourceOptions: c,...l } = e;
13
+ let { layerOptions: c, sourceOptions: l,...u } = e;
13
14
  return new Tile({
14
15
  source: new XYZ({
15
- url: createTianDiTuUrl(l),
16
- projection: l.projection,
16
+ url: createTianDiTuUrl(u),
17
+ projection: u.projection,
17
18
  crossOrigin: "Anonymous",
18
- ...c
19
+ ...l
19
20
  }),
20
- ...s
21
+ ...c
21
22
  });
22
23
  }
23
- function createBingLayer({ name: e, key: s, layerOptions: c, sourceOptions: l }) {
24
+ function createBingLayer({ name: e, key: c, layerOptions: l, sourceOptions: u }) {
24
25
  return new Tile({
25
26
  source: new BingMaps({
26
- key: s,
27
+ key: c,
27
28
  imagerySet: e,
28
29
  placeholderTiles: !1,
29
- ...l
30
+ ...u
30
31
  }),
31
- ...c
32
+ ...l
32
33
  });
33
34
  }
34
35
  function createOpenStreetMapLayer(e) {
35
- let { layerOptions: s, sourceOptions: c } = e || {};
36
+ let { layerOptions: c, sourceOptions: l } = e || {};
36
37
  return new Tile({
37
38
  source: new OSM({
38
39
  crossOrigin: "Anonymous",
39
- ...c
40
+ ...l
40
41
  }),
41
- ...s
42
+ ...c
42
43
  });
43
44
  }
45
+ function createVectorSource(e) {
46
+ return new VectorSource({ ...e });
47
+ }
44
48
  function createVectorLayer(e) {
45
- let { styleOptions: s,...d } = e || {}, f = s ? createStyle(s) : void 0, p = new VectorSource();
49
+ let { styleOptions: c, sourceOptions: d, style: f, source: p,...m } = e || {}, h = f || (c ? createStyle(c) : void 0), g = p || createVectorSource(d);
46
50
  return {
47
- source: p,
51
+ source: g,
48
52
  layer: new VectorLayer({
49
- source: p,
53
+ ...m,
54
+ source: g,
55
+ style: h
56
+ })
57
+ };
58
+ }
59
+ function createWebGLVectorLayer(e) {
60
+ let { style: c, source: l, sourceOptions: u,...d } = e, f = l || createVectorSource(u);
61
+ return {
62
+ source: f,
63
+ layer: new WebGLVectorLayer({
50
64
  ...d,
51
- style: f || d.style
65
+ source: f,
66
+ style: c
52
67
  })
53
68
  };
54
69
  }
55
- export { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer };
70
+ export { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer };
@@ -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,...f } = e, p = a ? new Fill(a) : void 0, m = c ? new Stroke(c) : void 0, h = l ? new Icon(l) : void 0, g = u ? createCircleStyle(u) : void 0, _ = d ? createTextStyle(d) : void 0;
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
- ...f,
24
- fill: p,
25
- stroke: m,
26
- image: h || g,
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 };
@@ -1 +1 @@
1
- const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`./props.js`);let n=require(`vue`);n=e.__toESM(n);let r=require(`ol`);r=e.__toESM(r);let i=require(`ol/control`);i=e.__toESM(i);let a=require(`ol/interaction`);a=e.__toESM(a);var o=(0,n.defineComponent)({__name:`index`,props:{olMap:{default:()=>new r.Map},center:{default:()=>[0,0]},zoom:{default:2},minZoom:{default:2},maxZoom:{default:18},constrainResolution:{type:Boolean,default:!0},projection:{},extent:{},showZoom:{type:Boolean,default:!1},showAttribution:{type:Boolean,default:!1},showRotate:{type:Boolean,default:!1},showFullScreen:{type:Boolean,default:!1},showOverview:{type:Boolean,default:!1},showScale:{type:Boolean,default:!1},dragPan:{type:Boolean,default:!0},mouseWheelZoom:{type:Boolean,default:!0},doubleClickZoom:{type:Boolean,default:!1},pinchRotate:{type:Boolean},pinchZoom:{type:Boolean},altShiftDragRotate:{type:Boolean}},emits:[`update:zoom`,`update:center`,`changeResolution`,`changeCenter`,`moveend`,`movestart`],setup(e,{expose:o,emit:s}){let c=e,l=s,u=(0,n.ref)(),d=c.olMap,f=new r.View({projection:c.projection,extent:c.extent});d.setView(f),f.setZoom(c.zoom),f.setCenter(c.center),(0,n.watch)(()=>c.constrainResolution,e=>{f.setConstrainResolution(e)},{immediate:!0}),(0,n.watch)(()=>c.minZoom,e=>{e&&f.setMinZoom(e)},{immediate:!0}),(0,n.watch)(()=>c.maxZoom,e=>{e&&f.setMaxZoom(e)},{immediate:!0}),(0,n.watch)(u,e=>{e&&d.setTarget(e)}),o({olMap:d}),(0,n.provide)(t.olMapInjectionKey,d);let p=d.getControls().getArray(),m=p.find(e=>e instanceof i.Zoom)||new i.Zoom,h=p.find(e=>e instanceof i.Attribution)||new i.Attribution,g=p.find(e=>e instanceof i.Rotate)||new i.Rotate,_=p.find(e=>e instanceof i.FullScreen)||new i.FullScreen,v=p.find(e=>e instanceof i.OverviewMap)||new i.OverviewMap,y=p.find(e=>e instanceof i.ScaleLine)||new i.ScaleLine;(0,n.watch)(()=>c.showZoom,e=>{m.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showAttribution,e=>{h.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showRotate,e=>{g.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showFullScreen,e=>{_.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showOverview,e=>{v.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showScale,e=>{y.setMap(e?d:null)},{immediate:!0});let b=d.getInteractions().getArray(),x=b.find(e=>e instanceof a.DragPan)||new a.DragPan,S=b.find(e=>e instanceof a.MouseWheelZoom)||new a.MouseWheelZoom,C=b.find(e=>e instanceof a.DoubleClickZoom)||new a.DoubleClickZoom,w=b.find(e=>e instanceof a.PinchRotate)||new a.PinchRotate,T=b.find(e=>e instanceof a.PinchZoom)||new a.PinchZoom,E=b.find(e=>e instanceof a.DragRotate)||new a.DragRotate,D=b.find(e=>e instanceof a.KeyboardPan)||new a.KeyboardPan,O=b.find(e=>e instanceof a.KeyboardZoom)||new a.KeyboardZoom;d.removeInteraction(x),d.addInteraction(x),d.removeInteraction(S),d.addInteraction(S),d.removeInteraction(C),d.addInteraction(C),d.removeInteraction(w),d.addInteraction(w),d.removeInteraction(T),d.addInteraction(T),d.removeInteraction(E),d.addInteraction(E),d.removeInteraction(D),d.removeInteraction(O),(0,n.watch)(()=>c.dragPan,e=>{x.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.mouseWheelZoom,e=>{S.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.doubleClickZoom,e=>{C.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.pinchRotate,e=>{w.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.pinchZoom,e=>{T.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.altShiftDragRotate,e=>{E.setActive(e)},{immediate:!0});function k(e){l(`update:zoom`,Math.floor(f.getZoom()||0)),l(`changeResolution`,e)}(0,n.onMounted)(()=>{f.on(`change:resolution`,k)}),(0,n.onUnmounted)(()=>{f.un(`change:resolution`,k)});function A(e){l(`update:center`,f.getCenter()||[0,0]),l(`changeCenter`,e)}(0,n.onMounted)(()=>{f.on(`change:center`,A)}),(0,n.onUnmounted)(()=>{f.un(`change:center`,A)});function j(e){l(`movestart`,e)}(0,n.onMounted)(()=>{d.on(`movestart`,j)}),(0,n.onUnmounted)(()=>{d.un(`movestart`,j)});function M(e){l(`moveend`,e)}return(0,n.onMounted)(()=>{d.on(`moveend`,M)}),(0,n.onUnmounted)(()=>{d.un(`moveend`,M)}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{ref_key:`mapRef`,ref:u},[(0,n.renderSlot)(e.$slots,`default`,{olMap:(0,n.unref)(d),mapRef:u.value})],512))}});exports.default=o;
1
+ const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`./props.js`);let n=require(`vue`);n=e.__toESM(n);let r=require(`ol`);r=e.__toESM(r);let i=require(`ol/control`);i=e.__toESM(i);let a=require(`ol/interaction`);a=e.__toESM(a);var o=(0,n.defineComponent)({name:`OlMap`,__name:`index`,props:{olMap:{default:()=>new r.Map},center:{default:()=>[0,0]},zoom:{default:2},minZoom:{default:2},maxZoom:{default:18},constrainResolution:{type:Boolean,default:!0},projection:{},extent:{},showZoom:{type:Boolean,default:!1},showAttribution:{type:Boolean,default:!1},showRotate:{type:Boolean,default:!1},showFullScreen:{type:Boolean,default:!1},showOverview:{type:Boolean,default:!1},showScale:{type:Boolean,default:!1},dragPan:{type:Boolean,default:!0},mouseWheelZoom:{type:Boolean,default:!0},doubleClickZoom:{type:Boolean,default:!1},pinchRotate:{type:Boolean},pinchZoom:{type:Boolean},altShiftDragRotate:{type:Boolean}},emits:[`update:zoom`,`update:center`,`changeResolution`,`changeCenter`,`moveend`,`movestart`],setup(e,{expose:o,emit:s}){let c=e,l=s,u=(0,n.ref)(),d=c.olMap,f=new r.View({projection:c.projection,extent:c.extent});d.setView(f),f.setZoom(c.zoom),f.setCenter(c.center),(0,n.watch)(()=>c.constrainResolution,e=>{f.setConstrainResolution(e)},{immediate:!0}),(0,n.watch)(()=>c.minZoom,e=>{e&&f.setMinZoom(e)},{immediate:!0}),(0,n.watch)(()=>c.maxZoom,e=>{e&&f.setMaxZoom(e)},{immediate:!0}),(0,n.watch)(u,e=>{e&&d.setTarget(e)}),o({olMap:d}),(0,n.provide)(t.olMapInjectionKey,d);let p=d.getControls().getArray(),m=p.find(e=>e instanceof i.Zoom)||new i.Zoom,h=p.find(e=>e instanceof i.Attribution)||new i.Attribution,g=p.find(e=>e instanceof i.Rotate)||new i.Rotate,_=p.find(e=>e instanceof i.FullScreen)||new i.FullScreen,v=p.find(e=>e instanceof i.OverviewMap)||new i.OverviewMap,y=p.find(e=>e instanceof i.ScaleLine)||new i.ScaleLine;(0,n.watch)(()=>c.showZoom,e=>{m.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showAttribution,e=>{h.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showRotate,e=>{g.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showFullScreen,e=>{_.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showOverview,e=>{v.setMap(e?d:null)},{immediate:!0}),(0,n.watch)(()=>c.showScale,e=>{y.setMap(e?d:null)},{immediate:!0});let b=d.getInteractions().getArray(),x=b.find(e=>e instanceof a.DragPan)||new a.DragPan,S=b.find(e=>e instanceof a.MouseWheelZoom)||new a.MouseWheelZoom,C=b.find(e=>e instanceof a.DoubleClickZoom)||new a.DoubleClickZoom,w=b.find(e=>e instanceof a.PinchRotate)||new a.PinchRotate,T=b.find(e=>e instanceof a.PinchZoom)||new a.PinchZoom,E=b.find(e=>e instanceof a.DragRotate)||new a.DragRotate,D=b.find(e=>e instanceof a.KeyboardPan)||new a.KeyboardPan,O=b.find(e=>e instanceof a.KeyboardZoom)||new a.KeyboardZoom;d.removeInteraction(x),d.addInteraction(x),d.removeInteraction(S),d.addInteraction(S),d.removeInteraction(C),d.addInteraction(C),d.removeInteraction(w),d.addInteraction(w),d.removeInteraction(T),d.addInteraction(T),d.removeInteraction(E),d.addInteraction(E),d.removeInteraction(D),d.removeInteraction(O),(0,n.watch)(()=>c.dragPan,e=>{x.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.mouseWheelZoom,e=>{S.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.doubleClickZoom,e=>{C.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.pinchRotate,e=>{w.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.pinchZoom,e=>{T.setActive(e)},{immediate:!0}),(0,n.watch)(()=>c.altShiftDragRotate,e=>{E.setActive(e)},{immediate:!0});function k(e){l(`update:zoom`,Math.floor(f.getZoom()||0)),l(`changeResolution`,e)}(0,n.onMounted)(()=>{f.on(`change:resolution`,k)}),(0,n.onUnmounted)(()=>{f.un(`change:resolution`,k)});function A(e){l(`update:center`,f.getCenter()||[0,0]),l(`changeCenter`,e)}(0,n.onMounted)(()=>{f.on(`change:center`,A)}),(0,n.onUnmounted)(()=>{f.un(`change:center`,A)});function j(e){l(`movestart`,e)}(0,n.onMounted)(()=>{d.on(`movestart`,j)}),(0,n.onUnmounted)(()=>{d.un(`movestart`,j)});function M(e){l(`moveend`,e)}return(0,n.onMounted)(()=>{d.on(`moveend`,M)}),(0,n.onUnmounted)(()=>{d.un(`moveend`,M)}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{ref_key:`mapRef`,ref:u},[(0,n.renderSlot)(e.$slots,`default`,{olMap:(0,n.unref)(d),mapRef:u.value})],512))}});exports.default=o;
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- const e=require(`./components/ol-map/props.js`),t=require(`./components/ol-map/index.js`);require(`./components/index.js`);const n=require(`./composables/useContextmenu/index.js`),r=require(`./constants/distance.js`),i=require(`./constants/projection.js`),a=require(`./utils/distance/index.js`),o=require(`./utils/style/index.js`),s=require(`./utils/feature/index.js`),c=require(`./utils/layer/index.js`),l=require(`./utils/projection/index.js`);require(`./utils/index.js`);const u=require(`./composables/useDrawLineString/index.js`),d=require(`./composables/useDrawPolygon/index.js`),f=require(`./composables/useGraticule/index.js`),p=require(`./composables/usePointermove/index.js`),m=require(`./composables/useSwitchBaseLayer/index.js`);require(`./composables/index.js`),exports.EPSG_3857=i.EPSG_3857,exports.EPSG_3857ExtentToEPSG_4326=l.EPSG_3857ExtentToEPSG_4326,exports.EPSG_3857ToEPSG_4326=l.EPSG_3857ToEPSG_4326,exports.EPSG_4326=i.EPSG_4326,exports.EPSG_4326ExtentToEPSG_3857=l.EPSG_4326ExtentToEPSG_3857,exports.EPSG_4326ToEPSG_3857=l.EPSG_4326ToEPSG_3857,exports.ONE_NM=r.ONE_NM,exports.OlMap=t.default,exports.WGS84Projection=i.WGS84Projection,exports.WebMercatorProjection=i.WebMercatorProjection,exports.createBingLayer=c.createBingLayer,exports.createCircle=s.createCircle,exports.createCircleFeature=s.createCircleFeature,exports.createCircleStyle=o.createCircleStyle,exports.createFeature=s.createFeature,exports.createLineString=s.createLineString,exports.createLineStringFeature=s.createLineStringFeature,exports.createMultiLineString=s.createMultiLineString,exports.createMultiLineStringFeature=s.createMultiLineStringFeature,exports.createMultiPoint=s.createMultiPoint,exports.createMultiPointFeature=s.createMultiPointFeature,exports.createMultiPolygon=s.createMultiPolygon,exports.createMultiPolygonFeature=s.createMultiPolygonFeature,exports.createOpenStreetMapLayer=c.createOpenStreetMapLayer,exports.createPoint=s.createPoint,exports.createPointFeature=s.createPointFeature,exports.createPolygon=s.createPolygon,exports.createPolygonFeature=s.createPolygonFeature,exports.createStyle=o.createStyle,exports.createTextStyle=o.createTextStyle,exports.createTianDiTuLayer=c.createTianDiTuLayer,exports.createTianDiTuUrl=c.createTianDiTuUrl,exports.createVectorLayer=c.createVectorLayer,exports.formatAngle=a.formatAngle,exports.formatRotation=a.formatRotation,exports.kmToNauticalMiles=a.kmToNauticalMiles,exports.mercatorExtentToWgs84=l.mercatorExtentToWgs84,exports.mercatorToWgs84=l.mercatorToWgs84,exports.nauticalMilesToKm=a.nauticalMilesToKm,exports.olMapInjectionKey=e.olMapInjectionKey,exports.useContextmenu=n.useContextmenu,exports.useDrawLineString=u.useDrawLineString,exports.useDrawPolygon=d.useDrawPolygon,exports.useGraticule=f.useGraticule,exports.useOlMap=e.useOlMap,exports.usePointermove=p.usePointermove,exports.useSwitchBaseLayer=m.useSwitchBaseLayer,exports.wgs84ExtentToMercator=l.wgs84ExtentToMercator,exports.wgs84ToMercator=l.wgs84ToMercator;
1
+ const e=require(`./components/ol-map/props.js`),t=require(`./components/ol-map/index.js`);require(`./components/index.js`);const n=require(`./composables/useContextmenu/index.js`),r=require(`./constants/distance.js`),i=require(`./constants/projection.js`),a=require(`./utils/distance/index.js`),o=require(`./utils/style/index.js`),s=require(`./utils/feature/index.js`),c=require(`./utils/layer/index.js`),l=require(`./utils/projection/index.js`);require(`./utils/index.js`);const u=require(`./composables/useDrawLineString/index.js`),d=require(`./composables/useDrawPolygon/index.js`),f=require(`./composables/useGraticule/index.js`),p=require(`./composables/usePointermove/index.js`),m=require(`./composables/useSwitchBaseLayer/index.js`);require(`./composables/index.js`),exports.EPSG_3857=i.EPSG_3857,exports.EPSG_3857ExtentToEPSG_4326=l.EPSG_3857ExtentToEPSG_4326,exports.EPSG_3857ToEPSG_4326=l.EPSG_3857ToEPSG_4326,exports.EPSG_4326=i.EPSG_4326,exports.EPSG_4326ExtentToEPSG_3857=l.EPSG_4326ExtentToEPSG_3857,exports.EPSG_4326ToEPSG_3857=l.EPSG_4326ToEPSG_3857,exports.ONE_NM=r.ONE_NM,exports.OlMap=t.default,exports.WGS84Projection=i.WGS84Projection,exports.WebMercatorProjection=i.WebMercatorProjection,exports.createBingLayer=c.createBingLayer,exports.createCircle=s.createCircle,exports.createCircleFeature=s.createCircleFeature,exports.createCircleStyle=o.createCircleStyle,exports.createFeature=s.createFeature,exports.createLineString=s.createLineString,exports.createLineStringFeature=s.createLineStringFeature,exports.createMultiLineString=s.createMultiLineString,exports.createMultiLineStringFeature=s.createMultiLineStringFeature,exports.createMultiPoint=s.createMultiPoint,exports.createMultiPointFeature=s.createMultiPointFeature,exports.createMultiPolygon=s.createMultiPolygon,exports.createMultiPolygonFeature=s.createMultiPolygonFeature,exports.createOpenStreetMapLayer=c.createOpenStreetMapLayer,exports.createPoint=s.createPoint,exports.createPointFeature=s.createPointFeature,exports.createPolygon=s.createPolygon,exports.createPolygonFeature=s.createPolygonFeature,exports.createStyle=o.createStyle,exports.createTextStyle=o.createTextStyle,exports.createTianDiTuLayer=c.createTianDiTuLayer,exports.createTianDiTuUrl=c.createTianDiTuUrl,exports.createVectorLayer=c.createVectorLayer,exports.createVectorSource=c.createVectorSource,exports.createWebGLVectorLayer=c.createWebGLVectorLayer,exports.formatAngle=a.formatAngle,exports.formatRotation=a.formatRotation,exports.kmToNauticalMiles=a.kmToNauticalMiles,exports.mercatorExtentToWgs84=l.mercatorExtentToWgs84,exports.mercatorToWgs84=l.mercatorToWgs84,exports.nauticalMilesToKm=a.nauticalMilesToKm,exports.olMapInjectionKey=e.olMapInjectionKey,exports.useContextmenu=n.useContextmenu,exports.useDrawLineString=u.useDrawLineString,exports.useDrawPolygon=d.useDrawPolygon,exports.useGraticule=f.useGraticule,exports.useOlMap=e.useOlMap,exports.usePointermove=p.usePointermove,exports.useSwitchBaseLayer=m.useSwitchBaseLayer,exports.wgs84ExtentToMercator=l.wgs84ExtentToMercator,exports.wgs84ToMercator=l.wgs84ToMercator;
@@ -2,8 +2,10 @@ import { StyleOptions } from '../style';
2
2
  import { Feature } from 'ol';
3
3
  import { Geometry } from 'ol/geom';
4
4
  import { ProjectionLike } from 'ol/proj';
5
+ import { FlatStyleLike } from 'ol/style/flat';
5
6
  import { Tile as TileLayer } from 'ol/layer';
6
7
  import { default as VectorLayer } from 'ol/layer/Vector';
8
+ import { default as WebGLVectorLayer } from 'ol/layer/WebGLVector';
7
9
  import { BingMaps, OSM, XYZ } from 'ol/source';
8
10
  import { default as VectorSource } from 'ol/source/Vector';
9
11
  export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
@@ -35,11 +37,24 @@ export interface CreateOpenStreetMapLayerOptions {
35
37
  sourceOptions?: BingMapsSourceOptions;
36
38
  }
37
39
  export declare function createOpenStreetMapLayer(data?: CreateOpenStreetMapLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
38
- export type _VectorLayerOptions = ConstructorParameters<typeof VectorLayer>[0];
39
- export type VectorLayerOptions = _VectorLayerOptions & {
40
+ export type _VectorSourceOptions<T extends Geometry = Geometry> = ConstructorParameters<typeof VectorSource<Feature<T>>>[0];
41
+ export type VectorSourceOptions<T extends Geometry = Geometry> = _VectorSourceOptions<T>;
42
+ export declare function createVectorSource<T extends Geometry = Geometry>(options?: VectorSourceOptions<T>): VectorSource<Feature<T>>;
43
+ export type _VectorLayerOptions<T extends Geometry = Geometry> = ConstructorParameters<typeof VectorLayer<VectorSource<Feature<T>>>>[0];
44
+ export type VectorLayerOptions<T extends Geometry = Geometry> = _VectorLayerOptions<T> & {
40
45
  styleOptions?: StyleOptions;
46
+ sourceOptions?: VectorSourceOptions<T>;
41
47
  };
42
- export declare function createVectorLayer<T extends Geometry = Geometry>(options?: VectorLayerOptions): {
48
+ export declare function createVectorLayer<T extends Geometry = Geometry>(options?: VectorLayerOptions<T>): {
43
49
  source: VectorSource<Feature<T>>;
44
- layer: VectorLayer<VectorSource<import('ol/Feature').FeatureLike>, import('ol/Feature').FeatureLike>;
50
+ layer: VectorLayer<VectorSource<Feature<T>>, Feature<T>>;
51
+ };
52
+ export type _WebGLVectorLayerOptions<T extends Geometry = Geometry> = ConstructorParameters<typeof WebGLVectorLayer<VectorSource<Feature<T>>>>[0];
53
+ export type WebGLVectorLayerOptions<T extends Geometry = Geometry> = _WebGLVectorLayerOptions<T> & {
54
+ style: FlatStyleLike;
55
+ sourceOptions?: VectorSourceOptions<T>;
56
+ };
57
+ export declare function createWebGLVectorLayer<T extends Geometry = Geometry>(options: WebGLVectorLayerOptions<T>): {
58
+ source: VectorSource<Feature<T>>;
59
+ layer: WebGLVectorLayer<VectorSource<Feature<T>>, Feature<T>>;
45
60
  };
@@ -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/source`);o=e.__toESM(o);function s(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 c(e){let{layerOptions:t,sourceOptions:n,...r}=e;return new a.Tile({source:new o.XYZ({url:s(r),projection:r.projection,crossOrigin:`Anonymous`,...n}),...t})}function l({name:e,key:t,layerOptions:n,sourceOptions:r}){return new a.Tile({source:new o.BingMaps({key:t,imagerySet:e,placeholderTiles:!1,...r}),...n})}function u(e){let{layerOptions:t,sourceOptions:n}=e||{};return new a.Tile({source:new o.OSM({crossOrigin:`Anonymous`,...n}),...t})}function d(e){let{styleOptions:t,...a}=e||{},o=t?n.createStyle(t):void 0,s=new i.default;return{source:s,layer:new r.default({source:s,...a,style:o||a.style})}}exports.createBingLayer=l,exports.createOpenStreetMapLayer=u,exports.createTianDiTuLayer=c,exports.createTianDiTuUrl=s,exports.createVectorLayer=d;
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;
@@ -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,...l}=e,u=i?new t.Fill(i):void 0,d=a?new t.Stroke(a):void 0,f=o?new t.Icon(o):void 0,p=s?n(s):void 0,m=c?r(c):void 0;return new t.Style({...l,fill:u,stroke:d,image:f||p,text:m})}exports.createCircleStyle=n,exports.createStyle=i,exports.createTextStyle=r;
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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@summeruse/ol",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "description": "",
6
6
  "author": "finalsummer",
7
7
  "license": "ISC",