@summeruse/ol 0.3.2 → 0.4.0

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 (99) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +70 -8
  3. package/dist/index.d.ts +665 -0
  4. package/dist/index.iife.min.js +4 -0
  5. package/dist/index.js +9930 -554
  6. package/package.json +13 -18
  7. package/es/components/index.d.ts +0 -1
  8. package/es/components/index.mjs +0 -3
  9. package/es/components/ol-map/index.d.ts +0 -4
  10. package/es/components/ol-map/index.mjs +0 -3
  11. package/es/components/ol-map/index.test.d.ts +0 -1
  12. package/es/components/ol-map/index.vue.d.ts +0 -59
  13. package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +0 -151
  14. package/es/components/ol-map/index2.mjs +0 -2
  15. package/es/components/ol-map/props.d.ts +0 -38
  16. package/es/components/ol-map/props.mjs +0 -6
  17. package/es/composables/common/index.d.ts +0 -1
  18. package/es/composables/common/index.mjs +0 -5
  19. package/es/composables/index.d.ts +0 -6
  20. package/es/composables/index.mjs +0 -6
  21. package/es/composables/useContextmenu/index.d.ts +0 -71
  22. package/es/composables/useContextmenu/index.mjs +0 -71
  23. package/es/composables/useDrawLineString/index.d.ts +0 -109
  24. package/es/composables/useDrawLineString/index.mjs +0 -105
  25. package/es/composables/useDrawPolygon/index.d.ts +0 -109
  26. package/es/composables/useDrawPolygon/index.mjs +0 -106
  27. package/es/composables/useGraticule/index.d.ts +0 -20
  28. package/es/composables/useGraticule/index.mjs +0 -23
  29. package/es/composables/usePointermove/index.d.ts +0 -70
  30. package/es/composables/usePointermove/index.mjs +0 -91
  31. package/es/composables/useSwitchBaseLayer/index.d.ts +0 -11
  32. package/es/composables/useSwitchBaseLayer/index.mjs +0 -17
  33. package/es/constants/distance.d.ts +0 -1
  34. package/es/constants/distance.mjs +0 -2
  35. package/es/constants/index.d.ts +0 -2
  36. package/es/constants/projection.d.ts +0 -9
  37. package/es/constants/projection.mjs +0 -2
  38. package/es/index.d.ts +0 -4
  39. package/es/index.mjs +0 -19
  40. package/es/types/index.d.ts +0 -4
  41. package/es/utils/distance/index.d.ts +0 -8
  42. package/es/utils/distance/index.mjs +0 -14
  43. package/es/utils/feature/index.d.ts +0 -26
  44. package/es/utils/feature/index.mjs +0 -81
  45. package/es/utils/index.d.ts +0 -5
  46. package/es/utils/index.mjs +0 -5
  47. package/es/utils/layer/index.d.ts +0 -60
  48. package/es/utils/layer/index.mjs +0 -70
  49. package/es/utils/projection/index.d.ts +0 -18
  50. package/es/utils/projection/index.mjs +0 -19
  51. package/es/utils/style/index.d.ts +0 -27
  52. package/es/utils/style/index.mjs +0 -30
  53. package/lib/_virtual/rolldown_runtime.js +0 -1
  54. package/lib/components/index.d.ts +0 -1
  55. package/lib/components/index.js +0 -1
  56. package/lib/components/ol-map/index.d.ts +0 -4
  57. package/lib/components/ol-map/index.js +0 -1
  58. package/lib/components/ol-map/index.test.d.ts +0 -1
  59. package/lib/components/ol-map/index.vue.d.ts +0 -59
  60. package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +0 -1
  61. package/lib/components/ol-map/index2.js +0 -1
  62. package/lib/components/ol-map/props.d.ts +0 -38
  63. package/lib/components/ol-map/props.js +0 -1
  64. package/lib/composables/common/index.d.ts +0 -1
  65. package/lib/composables/common/index.js +0 -1
  66. package/lib/composables/index.d.ts +0 -6
  67. package/lib/composables/index.js +0 -1
  68. package/lib/composables/useContextmenu/index.d.ts +0 -71
  69. package/lib/composables/useContextmenu/index.js +0 -1
  70. package/lib/composables/useDrawLineString/index.d.ts +0 -109
  71. package/lib/composables/useDrawLineString/index.js +0 -1
  72. package/lib/composables/useDrawPolygon/index.d.ts +0 -109
  73. package/lib/composables/useDrawPolygon/index.js +0 -1
  74. package/lib/composables/useGraticule/index.d.ts +0 -20
  75. package/lib/composables/useGraticule/index.js +0 -1
  76. package/lib/composables/usePointermove/index.d.ts +0 -70
  77. package/lib/composables/usePointermove/index.js +0 -1
  78. package/lib/composables/useSwitchBaseLayer/index.d.ts +0 -11
  79. package/lib/composables/useSwitchBaseLayer/index.js +0 -1
  80. package/lib/constants/distance.d.ts +0 -1
  81. package/lib/constants/distance.js +0 -1
  82. package/lib/constants/index.d.ts +0 -2
  83. package/lib/constants/projection.d.ts +0 -9
  84. package/lib/constants/projection.js +0 -1
  85. package/lib/index.d.ts +0 -4
  86. package/lib/index.js +0 -1
  87. package/lib/types/index.d.ts +0 -4
  88. package/lib/utils/distance/index.d.ts +0 -8
  89. package/lib/utils/distance/index.js +0 -1
  90. package/lib/utils/feature/index.d.ts +0 -26
  91. package/lib/utils/feature/index.js +0 -1
  92. package/lib/utils/index.d.ts +0 -5
  93. package/lib/utils/index.js +0 -1
  94. package/lib/utils/layer/index.d.ts +0 -60
  95. package/lib/utils/layer/index.js +0 -1
  96. package/lib/utils/projection/index.d.ts +0 -18
  97. package/lib/utils/projection/index.js +0 -1
  98. package/lib/utils/style/index.d.ts +0 -27
  99. package/lib/utils/style/index.js +0 -1
@@ -1,26 +0,0 @@
1
- import { Coordinate } from 'ol/coordinate';
2
- import { Geometry, Circle, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from 'ol/geom';
3
- import { Style } from 'ol/style';
4
- import { StyleOptions } from '../style';
5
- import { Feature } from 'ol';
6
- export interface FeatureOptions {
7
- style?: Style;
8
- styleOptions?: StyleOptions;
9
- geometry?: Geometry;
10
- [key: string]: any;
11
- }
12
- export declare function createPoint(coordinates: Coordinate): Point;
13
- export declare function createLineString(coordinates: Coordinate[]): LineString;
14
- export declare function createPolygon(coordinates: Coordinate[][]): Polygon;
15
- export declare function createCircle(center: Coordinate, radius: number): Circle;
16
- export declare function createMultiPoint(coordinates: Coordinate[]): MultiPoint;
17
- export declare function createMultiLineString(coordinates: Coordinate[][]): MultiLineString;
18
- export declare function createMultiPolygon(coordinates: Coordinate[][][]): MultiPolygon;
19
- export declare function createFeature(options?: FeatureOptions): Feature<Geometry>;
20
- export declare function createPointFeature(coordinates: Coordinate, options?: FeatureOptions): Feature<Point>;
21
- export declare function createLineStringFeature(coordinates: Coordinate[], options?: FeatureOptions): Feature<LineString>;
22
- export declare function createPolygonFeature(coordinates: Coordinate[][], options?: FeatureOptions): Feature<Polygon>;
23
- export declare function createCircleFeature(center: Coordinate, radius: number, options?: FeatureOptions): Feature<Circle>;
24
- export declare function createMultiPointFeature(coordinates: Coordinate[], options?: FeatureOptions): Feature<MultiPoint>;
25
- export declare function createMultiLineStringFeature(coordinates: Coordinate[][], options?: FeatureOptions): Feature<MultiLineString>;
26
- export declare function createMultiPolygonFeature(coordinates: Coordinate[][][], options?: FeatureOptions): Feature<MultiPolygon>;
@@ -1,81 +0,0 @@
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
- }
7
- function createLineString(e) {
8
- return new LineString(e);
9
- }
10
- function createPolygon(e) {
11
- return new Polygon(e);
12
- }
13
- function createCircle(e, g) {
14
- return new Circle(e, g);
15
- }
16
- function createMultiPoint(e) {
17
- return new MultiPoint(e);
18
- }
19
- function createMultiLineString(e) {
20
- return new MultiLineString(e);
21
- }
22
- function createMultiPolygon(e) {
23
- return new MultiPolygon(e);
24
- }
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
- }
32
- function createPointFeature(e, g) {
33
- let _ = createPoint(e);
34
- return createFeature({
35
- ...g,
36
- geometry: _
37
- });
38
- }
39
- function createLineStringFeature(e, g) {
40
- let _ = createLineString(e);
41
- return createFeature({
42
- ...g,
43
- geometry: _
44
- });
45
- }
46
- function createPolygonFeature(e, g) {
47
- let _ = createPolygon(e);
48
- return createFeature({
49
- ...g,
50
- geometry: _
51
- });
52
- }
53
- function createCircleFeature(e, g, _) {
54
- let v = createCircle(e, g);
55
- return createFeature({
56
- ..._,
57
- geometry: v
58
- });
59
- }
60
- function createMultiPointFeature(e, g) {
61
- let _ = createMultiPoint(e);
62
- return createFeature({
63
- ...g,
64
- geometry: _
65
- });
66
- }
67
- function createMultiLineStringFeature(e, g) {
68
- let _ = createMultiLineString(e);
69
- return createFeature({
70
- ...g,
71
- geometry: _
72
- });
73
- }
74
- function createMultiPolygonFeature(e, g) {
75
- let _ = createMultiPolygon(e);
76
- return createFeature({
77
- ...g,
78
- geometry: _
79
- });
80
- }
81
- export { createCircle, createCircleFeature, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature };
@@ -1,5 +0,0 @@
1
- export * from './distance';
2
- export * from './feature';
3
- export * from './layer';
4
- export * from './projection';
5
- export * from './style';
@@ -1,5 +0,0 @@
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, createVectorSource, createWebGLVectorLayer } 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,60 +0,0 @@
1
- import { StyleOptions } from '../style';
2
- import { Feature } from 'ol';
3
- import { Geometry } from 'ol/geom';
4
- import { ProjectionLike } from 'ol/proj';
5
- import { FlatStyleLike } from 'ol/style/flat';
6
- import { Tile as TileLayer } from 'ol/layer';
7
- import { default as VectorLayer } from 'ol/layer/Vector';
8
- import { default as WebGLVectorLayer } from 'ol/layer/WebGLVector';
9
- import { BingMaps, OSM, XYZ } from 'ol/source';
10
- import { default as VectorSource } from 'ol/source/Vector';
11
- export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
12
- export interface CreateTianDiTuUrlOptions {
13
- url?: string;
14
- key: string;
15
- type: T_MAP_TYPE;
16
- projection?: ProjectionLike;
17
- }
18
- export declare function createTianDiTuUrl(data: CreateTianDiTuUrlOptions): string;
19
- export type TileLayerOptions = Partial<ConstructorParameters<typeof TileLayer>[0]>;
20
- export type XYZ_SourceOptions = Partial<ConstructorParameters<typeof XYZ>[0]>;
21
- export type CreateTianDiTuLayerOptions = CreateTianDiTuUrlOptions & {
22
- layerOptions?: TileLayerOptions;
23
- sourceOptions?: XYZ_SourceOptions;
24
- };
25
- export declare function createTianDiTuLayer(data: CreateTianDiTuLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
26
- export type BingMapsSourceOptions = Partial<ConstructorParameters<typeof BingMaps>[0]>;
27
- export interface CreateBingLayerOptions {
28
- name: string;
29
- key: string;
30
- layerOptions?: TileLayerOptions;
31
- sourceOptions?: BingMapsSourceOptions;
32
- }
33
- export declare function createBingLayer({ name, key, layerOptions, sourceOptions, }: CreateBingLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
34
- export type OpenStreetMapSourceOptions = Partial<ConstructorParameters<typeof OSM>[0]>;
35
- export interface CreateOpenStreetMapLayerOptions {
36
- layerOptions?: TileLayerOptions;
37
- sourceOptions?: BingMapsSourceOptions;
38
- }
39
- export declare function createOpenStreetMapLayer(data?: CreateOpenStreetMapLayerOptions): TileLayer<import('ol/source').Tile<import('ol').Tile>>;
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> & {
45
- styleOptions?: StyleOptions;
46
- sourceOptions?: VectorSourceOptions<T>;
47
- };
48
- export declare function createVectorLayer<T extends Geometry = Geometry>(options?: VectorLayerOptions<T>): {
49
- source: VectorSource<Feature<T>>;
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>>;
60
- };
@@ -1,70 +0,0 @@
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 WebGLVectorLayer from "ol/layer/WebGLVector";
7
- import { BingMaps, OSM, XYZ } from "ol/source";
8
- function createTianDiTuUrl(e) {
9
- let { type: d = "img", projection: f = WebMercatorProjection, key: p } = e, m = e.url || "https://t{0-4}.tianditu.gov.cn", h = `&tk=${p}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
10
- return `${m}/${d}_${f === "EPSG:4326" ? "c" : f === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${d}${h}`;
11
- }
12
- function createTianDiTuLayer(e) {
13
- let { layerOptions: u, sourceOptions: d,...f } = e;
14
- return new Tile({
15
- source: new XYZ({
16
- url: createTianDiTuUrl(f),
17
- projection: f.projection,
18
- crossOrigin: "Anonymous",
19
- ...d
20
- }),
21
- ...u
22
- });
23
- }
24
- function createBingLayer({ name: e, key: u, layerOptions: d, sourceOptions: f }) {
25
- return new Tile({
26
- source: new BingMaps({
27
- key: u,
28
- imagerySet: e,
29
- placeholderTiles: !1,
30
- ...f
31
- }),
32
- ...d
33
- });
34
- }
35
- function createOpenStreetMapLayer(e) {
36
- let { layerOptions: u, sourceOptions: d } = e || {};
37
- return new Tile({
38
- source: new OSM({
39
- crossOrigin: "Anonymous",
40
- ...d
41
- }),
42
- ...u
43
- });
44
- }
45
- function createVectorSource(e) {
46
- return new VectorSource({ ...e });
47
- }
48
- function createVectorLayer(e) {
49
- let { styleOptions: u, sourceOptions: p,...m } = e || {}, h = u ? createStyle(u) : void 0, g = createVectorSource(p);
50
- return {
51
- source: g,
52
- layer: new VectorLayer({
53
- source: g,
54
- ...m,
55
- style: h || m.style
56
- })
57
- };
58
- }
59
- function createWebGLVectorLayer(e) {
60
- let { style: u, sourceOptions: d,...f } = e, p = createVectorSource(d);
61
- return {
62
- source: p,
63
- layer: new WebGLVectorLayer({
64
- source: p,
65
- ...f,
66
- style: u
67
- })
68
- };
69
- }
70
- export { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer, createVectorSource, createWebGLVectorLayer };
@@ -1,18 +0,0 @@
1
- import { Coordinate } from 'ol/coordinate';
2
- import { Extent } from 'ol/extent';
3
- /** WGS84坐标转墨卡托 */
4
- export declare function wgs84ToMercator(coordinate: Coordinate): Coordinate;
5
- /** WGS84坐标转墨卡托 */
6
- export declare const EPSG_4326ToEPSG_3857: typeof wgs84ToMercator;
7
- /** 墨卡托坐标转WGS84 */
8
- export declare function mercatorToWgs84(coordinate: Coordinate): Coordinate;
9
- /** 墨卡托坐标转WGS84 */
10
- export declare const EPSG_3857ToEPSG_4326: typeof mercatorToWgs84;
11
- /** WGS84范围转墨卡托 */
12
- export declare function wgs84ExtentToMercator(extent: Extent): Extent;
13
- /** WGS84范围转墨卡托 */
14
- export declare const EPSG_4326ExtentToEPSG_3857: typeof wgs84ExtentToMercator;
15
- /** 墨卡托范围转WGS84 */
16
- export declare function mercatorExtentToWgs84(extent: Extent): Extent;
17
- /** 墨卡托范围转WGS84 */
18
- export declare const EPSG_3857ExtentToEPSG_4326: typeof mercatorExtentToWgs84;
@@ -1,19 +0,0 @@
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
- }
6
- const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
7
- function mercatorToWgs84(d) {
8
- return transform(d, EPSG_3857, EPSG_4326);
9
- }
10
- const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
11
- function wgs84ExtentToMercator(u) {
12
- return transformExtent(u, EPSG_4326, EPSG_3857);
13
- }
14
- const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
15
- function mercatorExtentToWgs84(u) {
16
- return transformExtent(u, EPSG_3857, EPSG_4326);
17
- }
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,27 +0,0 @@
1
- import { Circle, Fill, Icon, Stroke, Style, Text } from 'ol/style';
2
- export type FillOptions = ConstructorParameters<typeof Fill>[0];
3
- export type StrokeOptions = ConstructorParameters<typeof Stroke>[0];
4
- export type IconOptions = ConstructorParameters<typeof Icon>[0];
5
- export type _StyleOptions = ConstructorParameters<typeof Style>[0];
6
- export type _CircleOptions = ConstructorParameters<typeof Circle>[0];
7
- export type _TextOptions = ConstructorParameters<typeof Text>[0];
8
- export type CircleOptions = _CircleOptions & {
9
- fillOptions?: FillOptions;
10
- strokeOptions?: StrokeOptions;
11
- };
12
- export type TextOptions = _TextOptions & {
13
- fillOptions?: FillOptions;
14
- strokeOptions?: StrokeOptions;
15
- backgroundFillOptions?: FillOptions;
16
- backgroundStrokeOptions?: StrokeOptions;
17
- };
18
- export type StyleOptions = _StyleOptions & {
19
- fillOptions?: FillOptions;
20
- strokeOptions?: StrokeOptions;
21
- iconOptions?: IconOptions;
22
- circleOptions?: CircleOptions;
23
- textOptions?: TextOptions;
24
- };
25
- export declare function createCircleStyle(options: CircleOptions): Circle;
26
- export declare function createTextStyle(options: TextOptions): Text;
27
- export declare function createStyle(options: StyleOptions): Style;
@@ -1,30 +0,0 @@
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
- }
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
- }
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
- }
30
- export { createCircleStyle, createStyle, createTextStyle };
@@ -1 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export * from './ol-map';
@@ -1 +0,0 @@
1
- const e=require(`./ol-map/props.js`),t=require(`./ol-map/index.js`);require(`./ol-map/index2.js`);
@@ -1,4 +0,0 @@
1
- import { default as OlMap } from './index.vue';
2
- export { OlMap };
3
- export * from './props';
4
- export type OlMapInst = InstanceType<typeof OlMap>;
@@ -1 +0,0 @@
1
- const e=require(`./index.vue_vue_type_script_setup_true_lang.js`);var t=e.default;exports.default=t;
@@ -1 +0,0 @@
1
- export {};
@@ -1,59 +0,0 @@
1
- import { MapEvent, Map as OLMap } from 'ol';
2
- import { ObjectEvent } from 'ol/Object';
3
- import { OlMapProps } from './props';
4
- declare function __VLS_template(): {
5
- attrs: Partial<{}>;
6
- slots: {
7
- default?(_: {
8
- olMap: OLMap;
9
- mapRef: HTMLDivElement | undefined;
10
- }): any;
11
- };
12
- refs: {
13
- mapRef: HTMLDivElement;
14
- };
15
- rootEl: HTMLDivElement;
16
- };
17
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
18
- declare const __VLS_component: import('vue').DefineComponent<OlMapProps, {
19
- olMap: OLMap;
20
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
- "update:zoom": (args_0: number) => any;
22
- "update:center": (args_0: import('ol/coordinate').Coordinate) => any;
23
- changeResolution: (args_0: ObjectEvent) => any;
24
- changeCenter: (args_0: ObjectEvent) => any;
25
- moveend: (args_0: MapEvent) => any;
26
- movestart: (args_0: MapEvent) => any;
27
- }, string, import('vue').PublicProps, Readonly<OlMapProps> & Readonly<{
28
- "onUpdate:zoom"?: ((args_0: number) => any) | undefined;
29
- "onUpdate:center"?: ((args_0: import('ol/coordinate').Coordinate) => any) | undefined;
30
- onChangeResolution?: ((args_0: ObjectEvent) => any) | undefined;
31
- onChangeCenter?: ((args_0: ObjectEvent) => any) | undefined;
32
- onMoveend?: ((args_0: MapEvent) => any) | undefined;
33
- onMovestart?: ((args_0: MapEvent) => any) | undefined;
34
- }>, {
35
- olMap: OLMap;
36
- center: import('ol/coordinate').Coordinate;
37
- zoom: number;
38
- minZoom: number;
39
- maxZoom: number;
40
- constrainResolution: boolean;
41
- showZoom: boolean;
42
- showAttribution: boolean;
43
- showRotate: boolean;
44
- showFullScreen: boolean;
45
- showOverview: boolean;
46
- showScale: boolean;
47
- dragPan: boolean;
48
- mouseWheelZoom: boolean;
49
- doubleClickZoom: boolean;
50
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
51
- mapRef: HTMLDivElement;
52
- }, HTMLDivElement>;
53
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
54
- export default _default;
55
- type __VLS_WithTemplateSlots<T, S> = T & {
56
- new (): {
57
- $slots: S;
58
- };
59
- };
@@ -1 +0,0 @@
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;
@@ -1 +0,0 @@
1
- const e=require(`./props.js`),t=require(`./index.js`);
@@ -1,38 +0,0 @@
1
- import { MapEvent, Map as OLMap } from 'ol';
2
- import { Coordinate } from 'ol/coordinate';
3
- import { Extent } from 'ol/extent';
4
- import { ObjectEvent } from 'ol/Object';
5
- import { InjectionKey } from 'vue';
6
- import { ProjectionLike } from '../../constants/projection';
7
- export interface OlMapProps {
8
- olMap?: OLMap;
9
- center?: Coordinate;
10
- zoom?: number;
11
- minZoom?: number;
12
- maxZoom?: number;
13
- constrainResolution?: boolean;
14
- projection?: ProjectionLike;
15
- extent?: Extent;
16
- showZoom?: boolean;
17
- showAttribution?: boolean;
18
- showRotate?: boolean;
19
- showFullScreen?: boolean;
20
- showOverview?: boolean;
21
- showScale?: boolean;
22
- dragPan?: boolean;
23
- mouseWheelZoom?: boolean;
24
- doubleClickZoom?: boolean;
25
- pinchRotate?: boolean;
26
- pinchZoom?: boolean;
27
- altShiftDragRotate?: boolean;
28
- }
29
- export declare const olMapInjectionKey: InjectionKey<OLMap>;
30
- export declare function useOlMap(): OLMap | undefined;
31
- export interface OlMapEmits {
32
- 'update:zoom': [number];
33
- 'update:center': [Coordinate];
34
- 'changeResolution': [ObjectEvent];
35
- 'changeCenter': [ObjectEvent];
36
- 'moveend': [MapEvent];
37
- 'movestart': [MapEvent];
38
- }
@@ -1 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export declare function createToolTipElement(text: string): HTMLDivElement;
@@ -1 +0,0 @@
1
- function e(e){let t=document.createElement(`div`);return t.innerHTML=e,t.style.cursor=`pointer`,t.style.userSelect=`none`,t.style.backgroundColor=`red`,t.style.color=`white`,t.style.borderRadius=`5px`,t.style.padding=`0 5px`,t.style.fontSize=`12px`,t.style.border=`2px solid white`,t}exports.createToolTipElement=e;
@@ -1,6 +0,0 @@
1
- export * from './useContextmenu';
2
- export * from './useDrawLineString';
3
- export * from './useDrawPolygon';
4
- export * from './useGraticule';
5
- export * from './usePointermove';
6
- export * from './useSwitchBaseLayer';
@@ -1 +0,0 @@
1
- const e=require(`./useContextmenu/index.js`),t=require(`./useDrawLineString/index.js`),n=require(`./useDrawPolygon/index.js`),r=require(`./useGraticule/index.js`),i=require(`./usePointermove/index.js`),a=require(`./useSwitchBaseLayer/index.js`);
@@ -1,71 +0,0 @@
1
- import { Coordinate } from 'ol/coordinate';
2
- import { FeatureLike } from 'ol/Feature';
3
- import { MaybeRefOrGetter, VNodeChild } from 'vue';
4
- import { LayerLike, OLMap } from '../../types';
5
- export interface ContextmenuPosition {
6
- x: number;
7
- y: number;
8
- }
9
- interface ContextmenuItemParams {
10
- map: OLMap;
11
- coordinate: Coordinate;
12
- position: ContextmenuPosition;
13
- feature?: FeatureLike;
14
- layer?: LayerLike;
15
- }
16
- export interface ContextmenuItemBase {
17
- label: ((params: ContextmenuItemParams) => VNodeChild) | string;
18
- visible?: ((params: ContextmenuItemParams) => boolean) | boolean;
19
- disabled?: ((params: ContextmenuItemParams) => boolean) | boolean;
20
- action?: (params: ContextmenuItemParams) => void;
21
- divided?: boolean;
22
- icon?: ((params: ContextmenuItemParams) => VNodeChild) | string;
23
- order?: number;
24
- key?: string | number;
25
- [key: string]: any;
26
- }
27
- export interface ContextmenuItem extends ContextmenuItemBase {
28
- children?: Array<ContextmenuItem>;
29
- }
30
- export type ContextmenuList = ContextmenuItem[];
31
- export interface ContextmenuOptionBase {
32
- label: string | (() => VNodeChild);
33
- visible?: boolean;
34
- disabled?: boolean;
35
- action: () => void;
36
- divided?: boolean;
37
- icon?: string | (() => VNodeChild);
38
- order?: number;
39
- key?: string | number;
40
- [key: string]: any;
41
- }
42
- export interface ContextmenuOption extends ContextmenuOptionBase {
43
- children?: Array<ContextmenuOption>;
44
- }
45
- export type ContextmenuOptions = ContextmenuOption[];
46
- export declare function useContextmenu(mapRef: MaybeRefOrGetter<OLMap | undefined>, items: MaybeRefOrGetter<ContextmenuList>): {
47
- visible: import('vue').ComputedRef<boolean>;
48
- position: import('vue').ComputedRef<{
49
- x: number;
50
- y: number;
51
- }>;
52
- feature: import('vue').ComputedRef<FeatureLike | undefined>;
53
- options: import('vue').ComputedRef<{
54
- [x: string]: any;
55
- children?: /*elided*/ any[] | undefined;
56
- label: string | (() => VNodeChild);
57
- visible?: boolean | undefined;
58
- disabled?: boolean | undefined;
59
- action: () => void;
60
- divided?: boolean | undefined;
61
- icon?: string | (() => VNodeChild) | undefined;
62
- order?: number | undefined;
63
- key?: string | number | undefined;
64
- }[]>;
65
- coordinate: import('vue').ComputedRef<Coordinate | undefined>;
66
- hide: () => void;
67
- };
68
- export type UseContextmenuReturn = ReturnType<typeof useContextmenu>;
69
- export type UseContextmenuParams = Parameters<typeof useContextmenu>;
70
- export type UseContextmenuFn = (...args: UseContextmenuParams) => UseContextmenuReturn;
71
- export {};
@@ -1 +0,0 @@
1
- const e=require(`../../_virtual/rolldown_runtime.js`);let t=require(`vue`);t=e.__toESM(t);function n(e,n){let r=(0,t.ref)(!1),i=(0,t.ref)({x:0,y:0}),a=(0,t.ref)(),o=(0,t.ref)([]),s=(0,t.ref)(),c;function l(e,t){let n=[];return e.filter(e=>{let n=e.visible;return typeof n==`function`?n(t):n??!0}).filter(e=>!e.children||e.children.length>0).sort((e,t)=>(e.order??0)-(t.order??0)).forEach(e=>{let r=e.icon,i=e.label;n.push({...e,children:e.children?l(e.children,t):void 0,visible:!0,action:()=>{e.action?.(t),d()},icon:typeof r==`function`?()=>r(t):r,label:typeof i==`function`?()=>i(t):i,disabled:typeof e.disabled==`function`?e.disabled(t):e.disabled??!1})}),n}function u(e){if(e.preventDefault(),!c)return;let u=c.getEventCoordinate(e);s.value=u;let d=c.getEventPixel(e),f,p;c.forEachFeatureAtPixel(d,(e,t)=>(f=e,p=t,!0)),a.value=f;let[m,h]=[e.clientX,e.clientY];i.value={x:m,y:h},o.value=l((0,t.toValue)(n),{map:c,position:{...i.value},coordinate:u,feature:f,layer:p}),r.value=!0}function d(){r.value=!1}function f(e){if(!e)return;let t=e.getViewport();t.addEventListener(`contextmenu`,u),t.addEventListener(`click`,d)}function p(e){if(!e)return;let t=e.getViewport();t.removeEventListener(`contextmenu`,u),t.removeEventListener(`click`,d)}return(0,t.watch)(()=>(0,t.toValue)(e),(e,t)=>{t!==e&&(p(t),f(e),c=e)},{immediate:!0}),(0,t.onBeforeUnmount)(()=>{p(c)}),{visible:(0,t.computed)(()=>r.value),position:(0,t.computed)(()=>i.value),feature:(0,t.computed)(()=>a.value),options:(0,t.computed)(()=>o.value),coordinate:(0,t.computed)(()=>s.value),hide:d}}exports.useContextmenu=n;