@summeruse/ol 0.2.0-alpha.0 → 0.2.0-alpha.1
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 +8 -0
- package/dist/index.js +689 -816
- package/es/components/index.mjs +3 -0
- package/es/components/ol-map/index.mjs +3 -0
- package/es/components/ol-map/index.vue_vue_type_script_setup_true_lang.mjs +114 -0
- package/es/components/ol-map/index2.mjs +2 -0
- package/es/components/ol-map/props.mjs +5 -8
- package/es/composables/common/index.mjs +4 -6
- package/es/composables/index.mjs +6 -0
- package/es/composables/useContextmenu/index.mjs +70 -76
- package/es/composables/useDrawLineString/index.mjs +104 -112
- package/es/composables/useDrawPolygon/index.mjs +105 -115
- package/es/composables/useGraticule/index.mjs +22 -36
- package/es/composables/usePointermove/index.mjs +100 -99
- package/es/composables/useSwitchBaseLayer/index.mjs +16 -24
- package/es/constants/distance.mjs +2 -4
- package/es/constants/projection.mjs +2 -7
- package/es/index.mjs +19 -76
- package/es/utils/distance/index.mjs +6 -9
- package/es/utils/feature/index.mjs +66 -82
- package/es/utils/index.d.ts +0 -3
- package/es/utils/index.mjs +5 -0
- package/es/utils/layer/index.d.ts +1 -1
- package/es/utils/layer/index.mjs +47 -60
- package/es/utils/projection/index.mjs +15 -24
- package/es/utils/style/index.mjs +27 -31
- package/lib/_virtual/rolldown_runtime.js +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/ol-map/index.js +1 -0
- package/lib/components/ol-map/index.vue_vue_type_script_setup_true_lang.js +1 -0
- package/lib/components/ol-map/index2.js +1 -0
- package/lib/components/ol-map/props.js +1 -1
- package/lib/composables/common/index.js +1 -1
- package/lib/composables/index.js +1 -0
- package/lib/composables/useContextmenu/index.js +1 -1
- package/lib/composables/useDrawLineString/index.js +1 -1
- package/lib/composables/useDrawPolygon/index.js +1 -1
- package/lib/composables/useGraticule/index.js +1 -1
- package/lib/composables/usePointermove/index.js +1 -1
- package/lib/composables/useSwitchBaseLayer/index.js +1 -1
- package/lib/constants/distance.js +1 -1
- package/lib/constants/projection.js +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/distance/index.js +1 -1
- package/lib/utils/feature/index.js +1 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +1 -0
- package/lib/utils/layer/index.d.ts +1 -1
- package/lib/utils/layer/index.js +1 -1
- package/lib/utils/projection/index.js +1 -1
- package/lib/utils/style/index.js +1 -1
- package/package.json +4 -11
- package/es/components/ol-map/index.vue.mjs +0 -124
- package/es/components/ol-map/index.vue2.mjs +0 -4
- package/es/utils/calculate/index.d.ts +0 -24
- package/es/utils/calculate/index.mjs +0 -29
- package/es/utils/calculate/index.test.d.ts +0 -1
- package/es/utils/format/index.d.ts +0 -4
- package/es/utils/format/index.mjs +0 -10
- package/es/utils/realCircle/index.d.ts +0 -9
- package/es/utils/realCircle/index.mjs +0 -10
- package/lib/components/ol-map/index.vue.js +0 -1
- package/lib/components/ol-map/index.vue2.js +0 -1
- package/lib/utils/calculate/index.d.ts +0 -24
- package/lib/utils/calculate/index.js +0 -1
- package/lib/utils/calculate/index.test.d.ts +0 -1
- package/lib/utils/format/index.d.ts +0 -4
- package/lib/utils/format/index.js +0 -1
- package/lib/utils/realCircle/index.d.ts +0 -9
- package/lib/utils/realCircle/index.js +0 -1
package/es/index.mjs
CHANGED
|
@@ -1,76 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
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 { 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 { createVectorLayer, getBingLayer, getOSMLayer, getTianDiTuLayer, getTianDiTuUrl } 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, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle, createVectorLayer, getBingLayer, getOSMLayer, getTianDiTuLayer, getTianDiTuUrl, kmToNauticalMiles, mercatorExtentToWgs84, mercatorToWgs84, nauticalMilesToKm, olMapInjectionKey, useContextmenu, useDrawLineString, useDrawPolygon, useGraticule, useOlMap, usePointermove, useSwitchBaseLayer, wgs84ExtentToMercator, wgs84ToMercator };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { ONE_NM
|
|
2
|
-
function n
|
|
3
|
-
|
|
1
|
+
import { ONE_NM } from "../../constants/distance.mjs";
|
|
2
|
+
function kmToNauticalMiles(n) {
|
|
3
|
+
return n * 1e3 / ONE_NM;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
5
|
+
function nauticalMilesToKm(n) {
|
|
6
|
+
return n * ONE_NM / 1e3;
|
|
7
7
|
}
|
|
8
|
-
export {
|
|
9
|
-
n as kmToNauticalMiles,
|
|
10
|
-
o as nauticalMilesToKm
|
|
11
|
-
};
|
|
8
|
+
export { kmToNauticalMiles, nauticalMilesToKm };
|
|
@@ -1,97 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
|
|
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
|
|
8
|
-
|
|
7
|
+
function createLineString(e) {
|
|
8
|
+
return new LineString(e);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
10
|
+
function createPolygon(e) {
|
|
11
|
+
return new Polygon(e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function createCircle(e, g) {
|
|
14
|
+
return new Circle(e, g);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
function createMultiPoint(e) {
|
|
17
|
+
return new MultiPoint(e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
function createMultiLineString(e) {
|
|
20
|
+
return new MultiLineString(e);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
22
|
+
function createMultiPolygon(e) {
|
|
23
|
+
return new MultiPolygon(e);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
function createPointFeature(e, g) {
|
|
33
|
+
let _ = createPoint(e);
|
|
34
|
+
return createFeature({
|
|
35
|
+
...g,
|
|
36
|
+
geometry: _
|
|
37
|
+
});
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
function createLineStringFeature(e, g) {
|
|
40
|
+
let _ = createLineString(e);
|
|
41
|
+
return createFeature({
|
|
42
|
+
...g,
|
|
43
|
+
geometry: _
|
|
44
|
+
});
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
function createPolygonFeature(e, g) {
|
|
47
|
+
let _ = createPolygon(e);
|
|
48
|
+
return createFeature({
|
|
49
|
+
...g,
|
|
50
|
+
geometry: _
|
|
51
|
+
});
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
function createCircleFeature(e, g, _) {
|
|
54
|
+
let v = createCircle(e, g);
|
|
55
|
+
return createFeature({
|
|
56
|
+
..._,
|
|
57
|
+
geometry: v
|
|
58
|
+
});
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
function createMultiPointFeature(e, g) {
|
|
61
|
+
let _ = createMultiPoint(e);
|
|
62
|
+
return createFeature({
|
|
63
|
+
...g,
|
|
64
|
+
geometry: _
|
|
65
|
+
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
function createMultiLineStringFeature(e, g) {
|
|
68
|
+
let _ = createMultiLineString(e);
|
|
69
|
+
return createFeature({
|
|
70
|
+
...g,
|
|
71
|
+
geometry: _
|
|
72
|
+
});
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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 };
|
package/es/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { 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 { createVectorLayer, getBingLayer, getOSMLayer, getTianDiTuLayer, getTianDiTuUrl } 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,4 +1,3 @@
|
|
|
1
|
-
import { T_MAP_TYPE } from '@summeruse/common';
|
|
2
1
|
import { Feature } from 'ol';
|
|
3
2
|
import { Geometry } from 'ol/geom';
|
|
4
3
|
import { ProjectionLike } from 'ol/proj';
|
|
@@ -7,6 +6,7 @@ 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';
|
|
9
|
+
export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
|
|
10
10
|
export declare function getTianDiTuUrl(data: {
|
|
11
11
|
url?: string;
|
|
12
12
|
type: T_MAP_TYPE;
|
package/es/utils/layer/index.mjs
CHANGED
|
@@ -1,65 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
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 getTianDiTuUrl(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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
function getTianDiTuLayer(e) {
|
|
12
|
+
let { zIndex: s, projection: c, className: l } = e;
|
|
13
|
+
return new Tile({
|
|
14
|
+
className: l,
|
|
15
|
+
source: new XYZ({
|
|
16
|
+
url: getTianDiTuUrl(e),
|
|
17
|
+
projection: c,
|
|
18
|
+
crossOrigin: "Anonymous"
|
|
19
|
+
}),
|
|
20
|
+
zIndex: s
|
|
21
|
+
});
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
imagerySet: e,
|
|
34
|
-
placeholderTiles: !1
|
|
35
|
-
}),
|
|
36
|
-
zIndex: r
|
|
37
|
-
});
|
|
23
|
+
function getBingLayer({ name: e, zIndex: s, key: c, className: l }) {
|
|
24
|
+
return new Tile({
|
|
25
|
+
className: l,
|
|
26
|
+
source: new BingMaps({
|
|
27
|
+
key: c,
|
|
28
|
+
imagerySet: e,
|
|
29
|
+
placeholderTiles: !1
|
|
30
|
+
}),
|
|
31
|
+
zIndex: s
|
|
32
|
+
});
|
|
38
33
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
zIndex: e == null ? void 0 : e.zIndex
|
|
46
|
-
});
|
|
34
|
+
function getOSMLayer(e) {
|
|
35
|
+
return new Tile({
|
|
36
|
+
className: e?.className,
|
|
37
|
+
source: new OSM({ crossOrigin: "Anonymous" }),
|
|
38
|
+
zIndex: e?.zIndex
|
|
39
|
+
});
|
|
47
40
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
function createVectorLayer(e) {
|
|
42
|
+
let { styleOptions: s,...d } = e || {}, f = s ? createStyle(s) : void 0, p = new VectorSource();
|
|
43
|
+
return {
|
|
44
|
+
source: p,
|
|
45
|
+
layer: new VectorLayer({
|
|
46
|
+
source: p,
|
|
47
|
+
...d,
|
|
48
|
+
style: f || d.style
|
|
49
|
+
})
|
|
50
|
+
};
|
|
58
51
|
}
|
|
59
|
-
export {
|
|
60
|
-
A as createVectorLayer,
|
|
61
|
-
j as getBingLayer,
|
|
62
|
-
x as getOSMLayer,
|
|
63
|
-
R as getTianDiTuLayer,
|
|
64
|
-
E as getTianDiTuUrl
|
|
65
|
-
};
|
|
52
|
+
export { createVectorLayer, getBingLayer, getOSMLayer, getTianDiTuLayer, getTianDiTuUrl };
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
|
|
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
|
|
7
|
-
function
|
|
8
|
-
|
|
6
|
+
const EPSG_4326ToEPSG_3857 = wgs84ToMercator;
|
|
7
|
+
function mercatorToWgs84(d) {
|
|
8
|
+
return transform(d, EPSG_3857, EPSG_4326);
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
|
|
10
|
+
const EPSG_3857ToEPSG_4326 = mercatorToWgs84;
|
|
11
|
+
function wgs84ExtentToMercator(u) {
|
|
12
|
+
return transformExtent(u, EPSG_4326, EPSG_3857);
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
|
|
14
|
+
const EPSG_4326ExtentToEPSG_3857 = wgs84ExtentToMercator;
|
|
15
|
+
function mercatorExtentToWgs84(u) {
|
|
16
|
+
return transformExtent(u, EPSG_3857, EPSG_4326);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
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 };
|
package/es/utils/style/index.mjs
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import { Circle
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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 +1 @@
|
|
|
1
|
-
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`../../utils/style/index.js`);require(`../../utils/index.js`);const n=require(`../common/index.js`);let r=require(`vue`);r=e.__toESM(r);let i=require(`ol`);i=e.__toESM(i);let a=require(`ol/interaction`);a=e.__toESM(a);let o=require(`ol/extent`);o=e.__toESM(o);let s=require(`ol/geom`);s=e.__toESM(s);let c=require(`ol/layer/Vector`);c=e.__toESM(c);let l=require(`ol/source/Vector`);l=e.__toESM(l);function u(e,u){let d=(0,r.ref)(!0),f=(0,r.ref)([]),p=(0,r.computed)(()=>f.value.map(e=>e.getGeometry().getCoordinates())),m=new l.default,h=u.styleOptions?t.createStyle(u.styleOptions):u?.style,g=new c.default({source:m,style:h,zIndex:u?.zIndex});e.addLayer(g);let _=new a.Draw({source:m,style:(u.drawStyleOptions?t.createStyle(u.drawStyleOptions):u?.drawStyle)||h,type:`LineString`});_.setActive(!1);let v=new a.Modify({source:m,style:(u.modifyStyleOptions?t.createStyle(u.modifyStyleOptions):u?.modifyStyle)||h}),y=new Set;e.addInteraction(_),(0,r.onMounted)(()=>{e.addInteraction(v)}),m.on(`addfeature`,()=>{u.size&&m.getFeatures().length>=u.size&&_.setActive(!1)}),m.on(`removefeature`,()=>{u.size&&m.getFeatures().length<u.size&&_.setActive(!0)});let b=()=>{y.forEach(t=>{e.removeOverlay(t)}),y.clear()};m.on(`change`,()=>{b(),m.getFeatures().forEach(t=>{let a=t.getGeometry();a.getCoordinates();let c=(0,o.getCenter)(a.getExtent()),l=document.createElement(`div`);u.deleteFeatureLabel?(0,r.render)(u.deleteFeatureLabel,l):l=n.createToolTipElement(`删除线`),l.addEventListener(`click`,()=>{m.removeFeature(t)});let d=new i.Overlay({position:c,positioning:`center-center`,element:l});y.add(d),e.addOverlay(d);let f=a.getCoordinates();f.length<3||f.forEach((a,o)=>{let c=document.createElement(`div`);u.deletePointLabel?(0,r.render)(u.deletePointLabel,c):c=n.createToolTipElement(`删除点`),c.addEventListener(`click`,()=>{t.setGeometry(new s.LineString(f.filter((e,t)=>t!==o)))});let l=new i.Overlay({position:a,positioning:`top-center`,offset:[0,-30],element:c});y.add(l),e.addOverlay(l)})})}),_.on(`change:active`,()=>{d.value=_.getActive()}),m.on(`change`,()=>{f.value=m.getFeatures()});let x=()=>{b(),e.removeLayer(g),e.removeInteraction(_),e.removeInteraction(v)},S=()=>{u.size&&f.value.length>=u.size||_.setActive(!0)},C=()=>{_.setActive(!1)},w=e=>{m.clear(),e.forEach(e=>{if(e.length<2)return;let t=new i.Feature({geometry:new s.LineString(e)});m.addFeature(t)})},T=()=>{w(u.defaultCoordinates||[])};return T(),(0,r.onUnmounted)(()=>{x()}),{inDraw:d,start:S,stop:C,clear:()=>{m.clear(),C()},setFeatures:w,reset:T,features:f,coordinates:p,destroy:x}}exports.useDrawLineString=u;
|