@summeruse/ol 0.2.0-alpha.0 → 0.2.0-alpha.2

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/index.js +698 -816
  3. package/es/components/index.mjs +3 -0
  4. package/es/components/ol-map/index.mjs +3 -0
  5. package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +114 -0
  6. package/es/components/ol-map/index2.mjs +2 -0
  7. package/es/components/ol-map/props.mjs +5 -8
  8. package/es/composables/common/index.mjs +4 -6
  9. package/es/composables/index.mjs +6 -0
  10. package/es/composables/useContextmenu/index.mjs +70 -76
  11. package/es/composables/useDrawLineString/index.mjs +104 -112
  12. package/es/composables/useDrawPolygon/index.mjs +105 -115
  13. package/es/composables/useGraticule/index.mjs +22 -36
  14. package/es/composables/usePointermove/index.mjs +100 -99
  15. package/es/composables/useSwitchBaseLayer/index.mjs +16 -24
  16. package/es/constants/distance.mjs +2 -4
  17. package/es/constants/projection.mjs +2 -7
  18. package/es/index.mjs +19 -76
  19. package/es/utils/distance/index.d.ts +4 -0
  20. package/es/utils/distance/index.mjs +12 -9
  21. package/es/utils/feature/index.mjs +66 -82
  22. package/es/utils/index.d.ts +0 -3
  23. package/es/utils/index.mjs +5 -0
  24. package/es/utils/layer/index.d.ts +25 -21
  25. package/es/utils/layer/index.mjs +50 -60
  26. package/es/utils/projection/index.mjs +15 -24
  27. package/es/utils/style/index.mjs +27 -31
  28. package/lib/_virtual/rolldown_runtime.js +1 -0
  29. package/lib/components/index.js +1 -0
  30. package/lib/components/ol-map/index.js +1 -0
  31. package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +1 -0
  32. package/lib/components/ol-map/index2.js +1 -0
  33. package/lib/components/ol-map/props.js +1 -1
  34. package/lib/composables/common/index.js +1 -1
  35. package/lib/composables/index.js +1 -0
  36. package/lib/composables/useContextmenu/index.js +1 -1
  37. package/lib/composables/useDrawLineString/index.js +1 -1
  38. package/lib/composables/useDrawPolygon/index.js +1 -1
  39. package/lib/composables/useGraticule/index.js +1 -1
  40. package/lib/composables/usePointermove/index.js +1 -1
  41. package/lib/composables/useSwitchBaseLayer/index.js +1 -1
  42. package/lib/constants/distance.js +1 -1
  43. package/lib/constants/projection.js +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/utils/distance/index.d.ts +4 -0
  46. package/lib/utils/distance/index.js +1 -1
  47. package/lib/utils/feature/index.js +1 -1
  48. package/lib/utils/index.d.ts +0 -3
  49. package/lib/utils/index.js +1 -0
  50. package/lib/utils/layer/index.d.ts +25 -21
  51. package/lib/utils/layer/index.js +1 -1
  52. package/lib/utils/projection/index.js +1 -1
  53. package/lib/utils/style/index.js +1 -1
  54. package/package.json +4 -11
  55. package/es/components/ol-map/index.vue.mjs +0 -124
  56. package/es/components/ol-map/index.vue2.mjs +0 -4
  57. package/es/utils/calculate/index.d.ts +0 -24
  58. package/es/utils/calculate/index.mjs +0 -29
  59. package/es/utils/calculate/index.test.d.ts +0 -1
  60. package/es/utils/format/index.d.ts +0 -4
  61. package/es/utils/format/index.mjs +0 -10
  62. package/es/utils/realCircle/index.d.ts +0 -9
  63. package/es/utils/realCircle/index.mjs +0 -10
  64. package/lib/components/ol-map/index.vue.js +0 -1
  65. package/lib/components/ol-map/index.vue2.js +0 -1
  66. package/lib/utils/calculate/index.d.ts +0 -24
  67. package/lib/utils/calculate/index.js +0 -1
  68. package/lib/utils/calculate/index.test.d.ts +0 -1
  69. package/lib/utils/format/index.d.ts +0 -4
  70. package/lib/utils/format/index.js +0 -1
  71. package/lib/utils/realCircle/index.d.ts +0 -9
  72. package/lib/utils/realCircle/index.js +0 -1
package/es/index.mjs CHANGED
@@ -1,76 +1,19 @@
1
- import { default as r } from "./components/ol-map/index.vue.mjs";
2
- import { olMapInjectionKey as a, useOlMap as n } from "./components/ol-map/props.mjs";
3
- import { useContextmenu as c } from "./composables/useContextmenu/index.mjs";
4
- import { useDrawLineString as g } from "./composables/useDrawLineString/index.mjs";
5
- import { useDrawPolygon as x } from "./composables/useDrawPolygon/index.mjs";
6
- import { useGraticule as P } from "./composables/useGraticule/index.mjs";
7
- import { usePointermove as S } from "./composables/usePointermove/index.mjs";
8
- import { useSwitchBaseLayer as s } from "./composables/useSwitchBaseLayer/index.mjs";
9
- import { ONE_NM as M } from "./constants/distance.mjs";
10
- import { EPSG_3857 as y, EPSG_4326 as G, WGS84Projection as L, WebMercatorProjection as _ } from "./constants/projection.mjs";
11
- import { getAngle as F, getArea as w, getCenter as D, getDestinationPoint as O, getExtentCenter as A, getLineLength as W } from "./utils/calculate/index.mjs";
12
- import { kmToNauticalMiles as N, nauticalMilesToKm as d } from "./utils/distance/index.mjs";
13
- import { createCircle as B, createCircleFeature as K, createFeature as b, createLineString as k, createLineStringFeature as v, createMultiLineString as I, createMultiLineStringFeature as R, createMultiPoint as U, createMultiPointFeature as V, createMultiPolygon as q, createMultiPolygonFeature as z, createPoint as H, createPointFeature as J, createPolygon as Q, createPolygonFeature as X } from "./utils/feature/index.mjs";
14
- import { toOlAngle as Z, toTurfAngle as $ } from "./utils/format/index.mjs";
15
- import { createVectorLayer as te, getBingLayer as re, getOSMLayer as oe, getTianDiTuLayer as ae, getTianDiTuUrl as ne } from "./utils/layer/index.mjs";
16
- import { EPSG_3857ExtentToEPSG_4326 as ce, EPSG_3857ToEPSG_4326 as le, EPSG_4326ExtentToEPSG_3857 as ge, EPSG_4326ToEPSG_3857 as ue, mercatorExtentToWgs84 as xe, mercatorToWgs84 as me, wgs84ExtentToMercator as Pe, wgs84ToMercator as pe } from "./utils/projection/index.mjs";
17
- import { getRealCircleCoordinates as fe } from "./utils/realCircle/index.mjs";
18
- import { createCircleStyle as Ee, createStyle as Me, createTextStyle as Te } from "./utils/style/index.mjs";
19
- export {
20
- y as EPSG_3857,
21
- ce as EPSG_3857ExtentToEPSG_4326,
22
- le as EPSG_3857ToEPSG_4326,
23
- G as EPSG_4326,
24
- ge as EPSG_4326ExtentToEPSG_3857,
25
- ue as EPSG_4326ToEPSG_3857,
26
- M as ONE_NM,
27
- r as OlMap,
28
- L as WGS84Projection,
29
- _ as WebMercatorProjection,
30
- B as createCircle,
31
- K as createCircleFeature,
32
- Ee as createCircleStyle,
33
- b as createFeature,
34
- k as createLineString,
35
- v as createLineStringFeature,
36
- I as createMultiLineString,
37
- R as createMultiLineStringFeature,
38
- U as createMultiPoint,
39
- V as createMultiPointFeature,
40
- q as createMultiPolygon,
41
- z as createMultiPolygonFeature,
42
- H as createPoint,
43
- J as createPointFeature,
44
- Q as createPolygon,
45
- X as createPolygonFeature,
46
- Me as createStyle,
47
- Te as createTextStyle,
48
- te as createVectorLayer,
49
- F as getAngle,
50
- w as getArea,
51
- re as getBingLayer,
52
- D as getCenter,
53
- O as getDestinationPoint,
54
- A as getExtentCenter,
55
- W as getLineLength,
56
- oe as getOSMLayer,
57
- fe as getRealCircleCoordinates,
58
- ae as getTianDiTuLayer,
59
- ne as getTianDiTuUrl,
60
- N as kmToNauticalMiles,
61
- xe as mercatorExtentToWgs84,
62
- me as mercatorToWgs84,
63
- d as nauticalMilesToKm,
64
- a as olMapInjectionKey,
65
- Z as toOlAngle,
66
- $ as toTurfAngle,
67
- c as useContextmenu,
68
- g as useDrawLineString,
69
- x as useDrawPolygon,
70
- P as useGraticule,
71
- n as useOlMap,
72
- S as usePointermove,
73
- s as useSwitchBaseLayer,
74
- Pe as wgs84ExtentToMercator,
75
- pe as wgs84ToMercator
76
- };
1
+ import { olMapInjectionKey, useOlMap } from "./components/ol-map/props.mjs";
2
+ import ol_map_default from "./components/ol-map/index.mjs";
3
+ import "./components/index.mjs";
4
+ import { useContextmenu } from "./composables/useContextmenu/index.mjs";
5
+ import { ONE_NM } from "./constants/distance.mjs";
6
+ import { EPSG_3857, EPSG_4326, WGS84Projection, WebMercatorProjection } from "./constants/projection.mjs";
7
+ import { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm } from "./utils/distance/index.mjs";
8
+ import { createCircleStyle, createStyle, createTextStyle } from "./utils/style/index.mjs";
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";
11
+ import { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator } from "./utils/projection/index.mjs";
12
+ import "./utils/index.mjs";
13
+ import { useDrawLineString } from "./composables/useDrawLineString/index.mjs";
14
+ import { useDrawPolygon } from "./composables/useDrawPolygon/index.mjs";
15
+ import { useGraticule } from "./composables/useGraticule/index.mjs";
16
+ import { usePointermove } from "./composables/usePointermove/index.mjs";
17
+ import { useSwitchBaseLayer } from "./composables/useSwitchBaseLayer/index.mjs";
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 };
@@ -2,3 +2,7 @@
2
2
  export declare function kmToNauticalMiles(km: number): number;
3
3
  /** 海里转公里 */
4
4
  export declare function nauticalMilesToKm(nauticalMiles: number): number;
5
+ /** 格式化Rotation */
6
+ export declare function formatRotation(rotation: number): number;
7
+ /** 格式化角度 */
8
+ export declare function formatAngle(angle: number): number;
@@ -1,11 +1,14 @@
1
- import { ONE_NM as e } from "../../constants/distance.mjs";
2
- function n(t) {
3
- return t * 1e3 / e;
1
+ import { ONE_NM } from "../../constants/distance.mjs";
2
+ function kmToNauticalMiles(i) {
3
+ return i * 1e3 / ONE_NM;
4
4
  }
5
- function o(t) {
6
- return t * e / 1e3;
5
+ function nauticalMilesToKm(i) {
6
+ return i * ONE_NM / 1e3;
7
7
  }
8
- export {
9
- n as kmToNauticalMiles,
10
- o as nauticalMilesToKm
11
- };
8
+ function formatRotation(e) {
9
+ return e < 0 ? formatRotation(e + 2 * Math.PI) : e > 2 * Math.PI ? formatRotation(e - 2 * Math.PI) : e;
10
+ }
11
+ function formatAngle(e) {
12
+ return e < 0 ? formatAngle(e + 360) : e >= 360 ? formatAngle(e - 360) : e;
13
+ }
14
+ export { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm };
@@ -1,97 +1,81 @@
1
- import { Feature as a } from "ol";
2
- import { Point as l, LineString as g, Polygon as f, Circle as y, MultiPoint as s, MultiLineString as m, MultiPolygon as P } from "ol/geom";
3
- import { createStyle as F } from "../style/index.mjs";
4
- function M(e) {
5
- return new l(e);
1
+ import { createStyle } from "../style/index.mjs";
2
+ import { Feature } from "ol";
3
+ import { Circle, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from "ol/geom";
4
+ function createPoint(e) {
5
+ return new Point(e);
6
6
  }
7
- function w(e) {
8
- return new g(e);
7
+ function createLineString(e) {
8
+ return new LineString(e);
9
9
  }
10
- function S(e) {
11
- return new f(e);
10
+ function createPolygon(e) {
11
+ return new Polygon(e);
12
12
  }
13
- function p(e, t) {
14
- return new y(e, t);
13
+ function createCircle(e, g) {
14
+ return new Circle(e, g);
15
15
  }
16
- function L(e) {
17
- return new s(e);
16
+ function createMultiPoint(e) {
17
+ return new MultiPoint(e);
18
18
  }
19
- function C(e) {
20
- return new m(e);
19
+ function createMultiLineString(e) {
20
+ return new MultiLineString(e);
21
21
  }
22
- function O(e) {
23
- return new P(e);
22
+ function createMultiPolygon(e) {
23
+ return new MultiPolygon(e);
24
24
  }
25
- function r(e) {
26
- const { styleOptions: t, style: n, geometry: o, ...u } = e ?? {}, c = t ? F(t) : n, i = new a({
27
- geometry: o,
28
- ...u
29
- });
30
- return i.setStyle(c), i;
25
+ function createFeature(_) {
26
+ let { styleOptions: v, style: y, geometry: b,...x } = _ ?? {}, S = v ? createStyle(v) : y, C = new Feature({
27
+ geometry: b,
28
+ ...x
29
+ });
30
+ return C.setStyle(S), C;
31
31
  }
32
- function d(e, t) {
33
- const n = M(e);
34
- return r({
35
- ...t,
36
- geometry: n
37
- });
32
+ function createPointFeature(e, g) {
33
+ let _ = createPoint(e);
34
+ return createFeature({
35
+ ...g,
36
+ geometry: _
37
+ });
38
38
  }
39
- function h(e, t) {
40
- const n = w(e);
41
- return r({
42
- ...t,
43
- geometry: n
44
- });
39
+ function createLineStringFeature(e, g) {
40
+ let _ = createLineString(e);
41
+ return createFeature({
42
+ ...g,
43
+ geometry: _
44
+ });
45
45
  }
46
- function j(e, t) {
47
- const n = S(e);
48
- return r({
49
- ...t,
50
- geometry: n
51
- });
46
+ function createPolygonFeature(e, g) {
47
+ let _ = createPolygon(e);
48
+ return createFeature({
49
+ ...g,
50
+ geometry: _
51
+ });
52
52
  }
53
- function k(e, t, n) {
54
- const o = p(e, t);
55
- return r({
56
- ...n,
57
- geometry: o
58
- });
53
+ function createCircleFeature(e, g, _) {
54
+ let v = createCircle(e, g);
55
+ return createFeature({
56
+ ..._,
57
+ geometry: v
58
+ });
59
59
  }
60
- function q(e, t) {
61
- const n = L(e);
62
- return r({
63
- ...t,
64
- geometry: n
65
- });
60
+ function createMultiPointFeature(e, g) {
61
+ let _ = createMultiPoint(e);
62
+ return createFeature({
63
+ ...g,
64
+ geometry: _
65
+ });
66
66
  }
67
- function v(e, t) {
68
- const n = C(e);
69
- return r({
70
- ...t,
71
- geometry: n
72
- });
67
+ function createMultiLineStringFeature(e, g) {
68
+ let _ = createMultiLineString(e);
69
+ return createFeature({
70
+ ...g,
71
+ geometry: _
72
+ });
73
73
  }
74
- function z(e, t) {
75
- const n = O(e);
76
- return r({
77
- ...t,
78
- geometry: n
79
- });
74
+ function createMultiPolygonFeature(e, g) {
75
+ let _ = createMultiPolygon(e);
76
+ return createFeature({
77
+ ...g,
78
+ geometry: _
79
+ });
80
80
  }
81
- export {
82
- p as createCircle,
83
- k as createCircleFeature,
84
- r as createFeature,
85
- w as createLineString,
86
- h as createLineStringFeature,
87
- C as createMultiLineString,
88
- v as createMultiLineStringFeature,
89
- L as createMultiPoint,
90
- q as createMultiPointFeature,
91
- O as createMultiPolygon,
92
- z as createMultiPolygonFeature,
93
- M as createPoint,
94
- d as createPointFeature,
95
- S as createPolygon,
96
- j as createPolygonFeature
97
- };
81
+ export { createCircle, createCircleFeature, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature };
@@ -1,8 +1,5 @@
1
- export * from './calculate';
2
1
  export * from './distance';
3
2
  export * from './feature';
4
- export * from './format';
5
3
  export * from './layer';
6
4
  export * from './projection';
7
- export * from './realCircle';
8
5
  export * from './style';
@@ -0,0 +1,5 @@
1
+ import { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm } from "./distance/index.mjs";
2
+ import { createCircleStyle, createStyle, createTextStyle } from "./style/index.mjs";
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";
5
+ import { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator } from "./projection/index.mjs";
@@ -1,36 +1,40 @@
1
- import { T_MAP_TYPE } from '@summeruse/common';
1
+ 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 { StyleOptions } from '../style';
6
5
  import { Tile as TileLayer } from 'ol/layer';
7
6
  import { default as VectorLayer } from 'ol/layer/Vector';
8
7
  import { BingMaps, OSM, XYZ } from 'ol/source';
9
8
  import { default as VectorSource } from 'ol/source/Vector';
10
- export declare function getTianDiTuUrl(data: {
11
- url?: string;
12
- type: T_MAP_TYPE;
13
- projection: ProjectionLike;
14
- key: string;
15
- }): string;
16
- export declare function getTianDiTuLayer(data: {
9
+ export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
10
+ export interface CreateTianDiTuUrlOptions {
17
11
  url?: string;
18
- projection: ProjectionLike;
19
- zIndex?: number;
20
12
  key: string;
21
13
  type: T_MAP_TYPE;
22
- className?: string;
23
- }): TileLayer<XYZ>;
24
- export declare function getBingLayer({ name, zIndex, key, className, }: {
14
+ projection?: ProjectionLike;
15
+ }
16
+ export declare function createTianDiTuUrl(data: CreateTianDiTuUrlOptions): string;
17
+ export type TileLayerOptions = Partial<ConstructorParameters<typeof TileLayer>[0]>;
18
+ export type XYZ_SourceOptions = Partial<ConstructorParameters<typeof XYZ>[0]>;
19
+ export type CreateTianDiTuLayerOptions = CreateTianDiTuUrlOptions & {
20
+ layerOptions?: TileLayerOptions;
21
+ sourceOptions?: XYZ_SourceOptions;
22
+ };
23
+ export declare function createTianDiTuLayer(data: CreateTianDiTuLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
24
+ export type BingMapsSourceOptions = Partial<ConstructorParameters<typeof BingMaps>[0]>;
25
+ export interface CreateBingLayerOptions {
25
26
  name: string;
26
- zIndex?: number;
27
27
  key: string;
28
- className?: string;
29
- }): TileLayer<BingMaps>;
30
- export declare function getOSMLayer(data?: {
31
- zIndex?: number;
32
- className?: string;
33
- }): TileLayer<OSM>;
28
+ layerOptions?: TileLayerOptions;
29
+ sourceOptions?: BingMapsSourceOptions;
30
+ }
31
+ export declare function createBingLayer({ name, key, layerOptions, sourceOptions, }: CreateBingLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
32
+ export type OpenStreetMapSourceOptions = Partial<ConstructorParameters<typeof OSM>[0]>;
33
+ export interface CreateOpenStreetMapLayerOptions {
34
+ layerOptions?: TileLayerOptions;
35
+ sourceOptions?: BingMapsSourceOptions;
36
+ }
37
+ export declare function createOpenStreetMapLayer(data?: CreateOpenStreetMapLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
34
38
  export type _VectorLayerOptions = ConstructorParameters<typeof VectorLayer>[0];
35
39
  export type VectorLayerOptions = _VectorLayerOptions & {
36
40
  styleOptions?: StyleOptions;
@@ -1,65 +1,55 @@
1
- import { Tile as c } from "ol/layer";
2
- import l from "ol/layer/Vector";
3
- import { XYZ as u, BingMaps as y, OSM as m } from "ol/source";
4
- import T from "ol/source/Vector";
5
- import { WebMercatorProjection as i, WGS84Projection as p } from "../../constants/projection.mjs";
6
- import { createStyle as f } from "../style/index.mjs";
7
- function E(e) {
8
- const { type: r = "img", projection: o = i, key: n } = e, t = e.url || "https://t{0-4}.tianditu.gov.cn", s = `&tk=${n}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
9
- return `${t}/${r}_${o === p ? "c" : o === i ? "w" : "c"}/wmts?LAYER=${r}${s}`;
1
+ import { WGS84Projection, WebMercatorProjection } from "../../constants/projection.mjs";
2
+ import { createStyle } from "../style/index.mjs";
3
+ import VectorLayer from "ol/layer/Vector";
4
+ import VectorSource from "ol/source/Vector";
5
+ import { Tile } from "ol/layer";
6
+ import { BingMaps, OSM, XYZ } from "ol/source";
7
+ 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}`;
10
10
  }
11
- function R(e) {
12
- const { zIndex: r, projection: o, className: n } = e;
13
- return new c({
14
- className: n,
15
- source: new u({
16
- url: E(e),
17
- projection: o,
18
- crossOrigin: "Anonymous"
19
- }),
20
- zIndex: r
21
- });
11
+ function createTianDiTuLayer(e) {
12
+ let { layerOptions: s, sourceOptions: c,...l } = e;
13
+ return new Tile({
14
+ source: new XYZ({
15
+ url: createTianDiTuUrl(l),
16
+ projection: l.projection,
17
+ crossOrigin: "Anonymous",
18
+ ...c
19
+ }),
20
+ ...s
21
+ });
22
22
  }
23
- function j({
24
- name: e,
25
- zIndex: r,
26
- key: o,
27
- className: n
28
- }) {
29
- return new c({
30
- className: n,
31
- source: new y({
32
- key: o,
33
- imagerySet: e,
34
- placeholderTiles: !1
35
- }),
36
- zIndex: r
37
- });
23
+ function createBingLayer({ name: e, key: s, layerOptions: c, sourceOptions: l }) {
24
+ return new Tile({
25
+ source: new BingMaps({
26
+ key: s,
27
+ imagerySet: e,
28
+ placeholderTiles: !1,
29
+ ...l
30
+ }),
31
+ ...c
32
+ });
38
33
  }
39
- function x(e) {
40
- return new c({
41
- className: e == null ? void 0 : e.className,
42
- source: new m({
43
- crossOrigin: "Anonymous"
44
- }),
45
- zIndex: e == null ? void 0 : e.zIndex
46
- });
34
+ function createOpenStreetMapLayer(e) {
35
+ let { layerOptions: s, sourceOptions: c } = e || {};
36
+ return new Tile({
37
+ source: new OSM({
38
+ crossOrigin: "Anonymous",
39
+ ...c
40
+ }),
41
+ ...s
42
+ });
47
43
  }
48
- function A(e) {
49
- const { styleOptions: r, ...o } = e || {}, n = r ? f(r) : void 0, t = new T(), s = new l({
50
- source: t,
51
- ...o,
52
- style: n || o.style
53
- });
54
- return {
55
- source: t,
56
- layer: s
57
- };
44
+ function createVectorLayer(e) {
45
+ let { styleOptions: s,...d } = e || {}, f = s ? createStyle(s) : void 0, p = new VectorSource();
46
+ return {
47
+ source: p,
48
+ layer: new VectorLayer({
49
+ source: p,
50
+ ...d,
51
+ style: f || d.style
52
+ })
53
+ };
58
54
  }
59
- export {
60
- A as createVectorLayer,
61
- j as getBingLayer,
62
- x as getOSMLayer,
63
- R as getTianDiTuLayer,
64
- E as getTianDiTuUrl
65
- };
55
+ export { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer };
@@ -1,28 +1,19 @@
1
- import { transform as n, transformExtent as E } from "ol/proj";
2
- import { EPSG_4326 as o, EPSG_3857 as r } from "../../constants/projection.mjs";
3
- function e(t) {
4
- return n(t, o, r);
1
+ import { EPSG_3857, EPSG_4326 } from "../../constants/projection.mjs";
2
+ import { transform, transformExtent } from "ol/proj";
3
+ function wgs84ToMercator(d) {
4
+ return transform(d, EPSG_4326, EPSG_3857);
5
5
  }
6
- const _ = e;
7
- function c(t) {
8
- return n(t, r, o);
6
+ const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
7
+ function mercatorToWgs84(d) {
8
+ return transform(d, EPSG_3857, EPSG_4326);
9
9
  }
10
- const f = c;
11
- function s(t) {
12
- return E(t, o, r);
10
+ const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
11
+ function wgs84ExtentToMercator(u) {
12
+ return transformExtent(u, EPSG_4326, EPSG_3857);
13
13
  }
14
- const m = s;
15
- function G(t) {
16
- return E(t, r, o);
14
+ const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
15
+ function mercatorExtentToWgs84(u) {
16
+ return transformExtent(u, EPSG_3857, EPSG_4326);
17
17
  }
18
- const u = G;
19
- export {
20
- u as EPSG_3857ExtentToEPSG_4326,
21
- f as EPSG_3857ToEPSG_4326,
22
- m as EPSG_4326ExtentToEPSG_3857,
23
- _ as EPSG_4326ToEPSG_3857,
24
- G as mercatorExtentToWgs84,
25
- c as mercatorToWgs84,
26
- s as wgs84ExtentToMercator,
27
- e as wgs84ToMercator
28
- };
18
+ const EPSG_3857ExtentToEPSG_4326 = mercatorExtentToWgs84;
19
+ export { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator };
@@ -1,34 +1,30 @@
1
- import { Circle as O, Stroke as s, Fill as c, Text as f, Icon as u, Style as a } from "ol/style";
2
- function S(n) {
3
- const { fillOptions: o, strokeOptions: t, ...e } = n;
4
- return new O({
5
- ...e,
6
- fill: o ? new c(o) : void 0,
7
- stroke: t ? new s(t) : void 0
8
- });
1
+ import { Circle, Fill, Icon, Stroke, Style, Text } from "ol/style";
2
+ function createCircleStyle(r) {
3
+ let { fillOptions: i, strokeOptions: a,...o } = r;
4
+ return new Circle({
5
+ ...o,
6
+ fill: i ? new Fill(i) : void 0,
7
+ stroke: a ? new Stroke(a) : void 0
8
+ });
9
9
  }
10
- function g(n) {
11
- const { fillOptions: o, strokeOptions: t, backgroundFillOptions: e, backgroundStrokeOptions: i, ...r } = n;
12
- return new f({
13
- ...r,
14
- fill: o ? new c(o) : void 0,
15
- stroke: t ? new s(t) : void 0,
16
- backgroundFill: e ? new c(e) : void 0,
17
- backgroundStroke: i ? new s(i) : void 0
18
- });
10
+ function createTextStyle(e) {
11
+ let { fillOptions: r, strokeOptions: i, backgroundFillOptions: o, backgroundStrokeOptions: s,...c } = e;
12
+ return new Text({
13
+ ...c,
14
+ fill: r ? new Fill(r) : void 0,
15
+ stroke: i ? new Stroke(i) : void 0,
16
+ backgroundFill: o ? new Fill(o) : void 0,
17
+ backgroundStroke: s ? new Stroke(s) : void 0
18
+ });
19
19
  }
20
- function b(n) {
21
- const { fillOptions: o, strokeOptions: t, iconOptions: e, circleOptions: i, textOptions: r, ...l } = n, d = o ? new c(o) : void 0, k = t ? new s(t) : void 0, p = e ? new u(e) : void 0, w = i ? S(i) : void 0, v = r ? g(r) : void 0;
22
- return new a({
23
- ...l,
24
- fill: d,
25
- stroke: k,
26
- image: p || w,
27
- text: v
28
- });
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;
22
+ return new Style({
23
+ ...f,
24
+ fill: p,
25
+ stroke: m,
26
+ image: h || g,
27
+ text: _
28
+ });
29
29
  }
30
- export {
31
- S as createCircleStyle,
32
- b as createStyle,
33
- g as createTextStyle
34
- };
30
+ export { createCircleStyle, createStyle, createTextStyle };
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -0,0 +1 @@
1
+ const e=require(`./ol-map/props.js`),t=require(`./ol-map/index.js`);require(`./ol-map/index2.js`);
@@ -0,0 +1 @@
1
+ const e=require(`./index.vue_vue_type_script_setup_true_lang.js`);var t=e.default;exports.default=t;
@@ -0,0 +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}},setup(e,{expose:o}){let s=e,c=(0,n.ref)(),l=s.olMap,u=new r.View({projection:s.projection,extent:s.extent});l.setView(u),(0,n.watch)(()=>s.zoom,e=>{u.setZoom(e)},{immediate:!0}),(0,n.watch)(()=>s.center,e=>{u.setCenter(e)},{immediate:!0}),(0,n.watch)(()=>s.constrainResolution,e=>{u.setConstrainResolution(e)},{immediate:!0}),(0,n.watch)(()=>s.minZoom,e=>{e&&u.setMinZoom(e)},{immediate:!0}),(0,n.watch)(()=>s.maxZoom,e=>{e&&u.setMaxZoom(e)},{immediate:!0}),(0,n.watch)(c,e=>{e&&l.setTarget(e)}),o({olMap:l}),(0,n.provide)(t.olMapInjectionKey,l);let d=l.getControls().getArray(),f=d.find(e=>e instanceof i.Zoom)||new i.Zoom,p=d.find(e=>e instanceof i.Attribution)||new i.Attribution,m=d.find(e=>e instanceof i.Rotate)||new i.Rotate,h=d.find(e=>e instanceof i.FullScreen)||new i.FullScreen,g=d.find(e=>e instanceof i.OverviewMap)||new i.OverviewMap,_=d.find(e=>e instanceof i.ScaleLine)||new i.ScaleLine;(0,n.watch)(()=>s.showZoom,e=>{f.setMap(e?l:null)},{immediate:!0}),(0,n.watch)(()=>s.showAttribution,e=>{p.setMap(e?l:null)},{immediate:!0}),(0,n.watch)(()=>s.showRotate,e=>{m.setMap(e?l:null)},{immediate:!0}),(0,n.watch)(()=>s.showFullScreen,e=>{h.setMap(e?l:null)},{immediate:!0}),(0,n.watch)(()=>s.showOverview,e=>{g.setMap(e?l:null)},{immediate:!0}),(0,n.watch)(()=>s.showScale,e=>{_.setMap(e?l:null)},{immediate:!0});let v=l.getInteractions().getArray(),y=v.find(e=>e instanceof a.DragPan)||new a.DragPan,b=v.find(e=>e instanceof a.MouseWheelZoom)||new a.MouseWheelZoom,x=v.find(e=>e instanceof a.DoubleClickZoom)||new a.DoubleClickZoom,S=v.find(e=>e instanceof a.PinchRotate)||new a.PinchRotate,C=v.find(e=>e instanceof a.PinchZoom)||new a.PinchZoom,w=v.find(e=>e instanceof a.DragRotate)||new a.DragRotate,T=v.find(e=>e instanceof a.KeyboardPan)||new a.KeyboardPan,E=v.find(e=>e instanceof a.KeyboardZoom)||new a.KeyboardZoom;return l.removeInteraction(y),l.addInteraction(y),l.removeInteraction(b),l.addInteraction(b),l.removeInteraction(x),l.addInteraction(x),l.removeInteraction(S),l.addInteraction(S),l.removeInteraction(C),l.addInteraction(C),l.removeInteraction(w),l.addInteraction(w),l.removeInteraction(T),l.removeInteraction(E),(0,n.watch)(()=>s.dragPan,e=>{y.setActive(e)},{immediate:!0}),(0,n.watch)(()=>s.mouseWheelZoom,e=>{b.setActive(e)},{immediate:!0}),(0,n.watch)(()=>s.doubleClickZoom,e=>{x.setActive(e)},{immediate:!0}),(0,n.watch)(()=>s.pinchRotate,e=>{S.setActive(e)},{immediate:!0}),(0,n.watch)(()=>s.pinchZoom,e=>{C.setActive(e)},{immediate:!0}),(0,n.watch)(()=>s.altShiftDragRotate,e=>{w.setActive(e)},{immediate:!0}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{ref_key:`mapRef`,ref:c},[(0,n.renderSlot)(e.$slots,`default`,{olMap:(0,n.unref)(l),mapRef:c.value})],512))}});exports.default=o;
@@ -0,0 +1 @@
1
+ const e=require(`./props.js`),t=require(`./index.js`);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),e=Symbol("olMapInjectionKey");function o(){return n.inject(e)}exports.olMapInjectionKey=e;exports.useOlMap=o;
1
+ const e=require(`../../_virtual/rolldown_runtime.js`);let t=require(`vue`);t=e.__toESM(t);const n=Symbol(`olMapInjectionKey`);function r(){return(0,t.inject)(n)}exports.olMapInjectionKey=n,exports.useOlMap=r;