@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.
- package/CHANGELOG.md +15 -0
- package/dist/index.js +698 -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.d.ts +4 -0
- package/es/utils/distance/index.mjs +12 -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 +25 -21
- package/es/utils/layer/index.mjs +50 -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.d.ts +4 -0
- 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 +25 -21
- 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 { 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
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
import { ONE_NM } from "../../constants/distance.mjs";
|
|
2
|
+
function kmToNauticalMiles(i) {
|
|
3
|
+
return i * 1e3 / ONE_NM;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
5
|
+
function nauticalMilesToKm(i) {
|
|
6
|
+
return i * ONE_NM / 1e3;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 {
|
|
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 { 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 {
|
|
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
|
|
11
|
-
|
|
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
|
-
|
|
23
|
-
}
|
|
24
|
-
export declare function
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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;
|
package/es/utils/layer/index.mjs
CHANGED
|
@@ -1,65 +1,55 @@
|
|
|
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 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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 {
|
|
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;
|