@summeruse/ol 0.2.0-alpha.1 → 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 +7 -0
- package/dist/index.js +27 -18
- package/es/index.mjs +3 -3
- package/es/utils/distance/index.d.ts +4 -0
- package/es/utils/distance/index.mjs +11 -5
- package/es/utils/index.mjs +2 -2
- package/es/utils/layer/index.d.ts +24 -20
- package/es/utils/layer/index.mjs +21 -18
- 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/layer/index.d.ts +24 -20
- package/lib/utils/layer/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -198,6 +198,12 @@ function kmToNauticalMiles(e) {
|
|
|
198
198
|
function nauticalMilesToKm(e) {
|
|
199
199
|
return e * ONE_NM / 1e3;
|
|
200
200
|
}
|
|
201
|
+
function formatRotation(e) {
|
|
202
|
+
return e < 0 ? formatRotation(e + 2 * Math.PI) : e > 2 * Math.PI ? formatRotation(e - 2 * Math.PI) : e;
|
|
203
|
+
}
|
|
204
|
+
function formatAngle(e) {
|
|
205
|
+
return e < 0 ? formatAngle(e + 360) : e >= 360 ? formatAngle(e - 360) : e;
|
|
206
|
+
}
|
|
201
207
|
function createCircleStyle(e) {
|
|
202
208
|
let { fillOptions: b, strokeOptions: x,...S } = e;
|
|
203
209
|
return new Circle$1({
|
|
@@ -303,38 +309,41 @@ function createMultiPolygonFeature(e, b) {
|
|
|
303
309
|
geometry: x
|
|
304
310
|
});
|
|
305
311
|
}
|
|
306
|
-
function
|
|
312
|
+
function createTianDiTuUrl(e) {
|
|
307
313
|
let { type: b = "img", projection: x = WebMercatorProjection, key: S } = e, C = e.url || "https://t{0-4}.tianditu.gov.cn", w = `&tk=${S}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;
|
|
308
314
|
return `${C}/${b}_${x === "EPSG:4326" ? "c" : x === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${b}${w}`;
|
|
309
315
|
}
|
|
310
|
-
function
|
|
311
|
-
let {
|
|
316
|
+
function createTianDiTuLayer(e) {
|
|
317
|
+
let { layerOptions: b, sourceOptions: x,...S } = e;
|
|
312
318
|
return new Tile({
|
|
313
|
-
className: S,
|
|
314
319
|
source: new XYZ({
|
|
315
|
-
url:
|
|
316
|
-
projection:
|
|
317
|
-
crossOrigin: "Anonymous"
|
|
320
|
+
url: createTianDiTuUrl(S),
|
|
321
|
+
projection: S.projection,
|
|
322
|
+
crossOrigin: "Anonymous",
|
|
323
|
+
...x
|
|
318
324
|
}),
|
|
319
|
-
|
|
325
|
+
...b
|
|
320
326
|
});
|
|
321
327
|
}
|
|
322
|
-
function
|
|
328
|
+
function createBingLayer({ name: e, key: b, layerOptions: x, sourceOptions: S }) {
|
|
323
329
|
return new Tile({
|
|
324
|
-
className: S,
|
|
325
330
|
source: new BingMaps({
|
|
326
|
-
key:
|
|
331
|
+
key: b,
|
|
327
332
|
imagerySet: e,
|
|
328
|
-
placeholderTiles: !1
|
|
333
|
+
placeholderTiles: !1,
|
|
334
|
+
...S
|
|
329
335
|
}),
|
|
330
|
-
|
|
336
|
+
...x
|
|
331
337
|
});
|
|
332
338
|
}
|
|
333
|
-
function
|
|
339
|
+
function createOpenStreetMapLayer(e) {
|
|
340
|
+
let { layerOptions: b, sourceOptions: x } = e || {};
|
|
334
341
|
return new Tile({
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
342
|
+
source: new OSM({
|
|
343
|
+
crossOrigin: "Anonymous",
|
|
344
|
+
...x
|
|
345
|
+
}),
|
|
346
|
+
...b
|
|
338
347
|
});
|
|
339
348
|
}
|
|
340
349
|
function createVectorLayer(e) {
|
|
@@ -687,4 +696,4 @@ function useSwitchBaseLayer(e) {
|
|
|
687
696
|
});
|
|
688
697
|
}, { immediate: !0 }), { visibleLayerName: b };
|
|
689
698
|
}
|
|
690
|
-
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,
|
|
699
|
+
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 };
|
package/es/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ import "./components/index.mjs";
|
|
|
4
4
|
import { useContextmenu } from "./composables/useContextmenu/index.mjs";
|
|
5
5
|
import { ONE_NM } from "./constants/distance.mjs";
|
|
6
6
|
import { EPSG_3857, EPSG_4326, WGS84Projection, WebMercatorProjection } from "./constants/projection.mjs";
|
|
7
|
-
import { kmToNauticalMiles, nauticalMilesToKm } from "./utils/distance/index.mjs";
|
|
7
|
+
import { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm } from "./utils/distance/index.mjs";
|
|
8
8
|
import { createCircleStyle, createStyle, createTextStyle } from "./utils/style/index.mjs";
|
|
9
9
|
import { createCircle, createCircleFeature, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature } from "./utils/feature/index.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer } from "./utils/layer/index.mjs";
|
|
11
11
|
import { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator } from "./utils/projection/index.mjs";
|
|
12
12
|
import "./utils/index.mjs";
|
|
13
13
|
import { useDrawLineString } from "./composables/useDrawLineString/index.mjs";
|
|
@@ -16,4 +16,4 @@ import { useGraticule } from "./composables/useGraticule/index.mjs";
|
|
|
16
16
|
import { usePointermove } from "./composables/usePointermove/index.mjs";
|
|
17
17
|
import { useSwitchBaseLayer } from "./composables/useSwitchBaseLayer/index.mjs";
|
|
18
18
|
import "./composables/index.mjs";
|
|
19
|
-
export { EPSG_3857, EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, ONE_NM, ol_map_default as OlMap, WGS84Projection, WebMercatorProjection, createCircle, createCircleFeature, createCircleStyle, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature, createStyle, createTextStyle,
|
|
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,8 +1,14 @@
|
|
|
1
1
|
import { ONE_NM } from "../../constants/distance.mjs";
|
|
2
|
-
function kmToNauticalMiles(
|
|
3
|
-
return
|
|
2
|
+
function kmToNauticalMiles(i) {
|
|
3
|
+
return i * 1e3 / ONE_NM;
|
|
4
4
|
}
|
|
5
|
-
function nauticalMilesToKm(
|
|
6
|
-
return
|
|
5
|
+
function nauticalMilesToKm(i) {
|
|
6
|
+
return i * ONE_NM / 1e3;
|
|
7
7
|
}
|
|
8
|
-
|
|
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 };
|
package/es/utils/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { kmToNauticalMiles, nauticalMilesToKm } from "./distance/index.mjs";
|
|
1
|
+
import { formatAngle, formatRotation, kmToNauticalMiles, nauticalMilesToKm } from "./distance/index.mjs";
|
|
2
2
|
import { createCircleStyle, createStyle, createTextStyle } from "./style/index.mjs";
|
|
3
3
|
import { createCircle, createCircleFeature, createFeature, createLineString, createLineStringFeature, createMultiLineString, createMultiLineStringFeature, createMultiPoint, createMultiPointFeature, createMultiPolygon, createMultiPolygonFeature, createPoint, createPointFeature, createPolygon, createPolygonFeature } from "./feature/index.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer } from "./layer/index.mjs";
|
|
5
5
|
import { EPSG_3857ExtentToEPSG_4326, EPSG_3857ToEPSG_4326, EPSG_4326ExtentToEPSG_3857, EPSG_4326ToEPSG_3857, mercatorExtentToWgs84, mercatorToWgs84, wgs84ExtentToMercator, wgs84ToMercator } from "./projection/index.mjs";
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
+
import { StyleOptions } from '../style';
|
|
1
2
|
import { Feature } from 'ol';
|
|
2
3
|
import { Geometry } from 'ol/geom';
|
|
3
4
|
import { ProjectionLike } from 'ol/proj';
|
|
4
|
-
import { StyleOptions } from '../style';
|
|
5
5
|
import { Tile as TileLayer } from 'ol/layer';
|
|
6
6
|
import { default as VectorLayer } from 'ol/layer/Vector';
|
|
7
7
|
import { BingMaps, OSM, XYZ } from 'ol/source';
|
|
8
8
|
import { default as VectorSource } from 'ol/source/Vector';
|
|
9
9
|
export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
|
|
10
|
-
export
|
|
11
|
-
url?: string;
|
|
12
|
-
type: T_MAP_TYPE;
|
|
13
|
-
projection: ProjectionLike;
|
|
14
|
-
key: string;
|
|
15
|
-
}): string;
|
|
16
|
-
export declare function getTianDiTuLayer(data: {
|
|
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
|
@@ -4,38 +4,41 @@ import VectorLayer from "ol/layer/Vector";
|
|
|
4
4
|
import VectorSource from "ol/source/Vector";
|
|
5
5
|
import { Tile } from "ol/layer";
|
|
6
6
|
import { BingMaps, OSM, XYZ } from "ol/source";
|
|
7
|
-
function
|
|
7
|
+
function createTianDiTuUrl(e) {
|
|
8
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
9
|
return `${d}/${c}_${l === "EPSG:4326" ? "c" : l === "EPSG:3857" ? "w" : "c"}/wmts?LAYER=${c}${f}`;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
let {
|
|
11
|
+
function createTianDiTuLayer(e) {
|
|
12
|
+
let { layerOptions: s, sourceOptions: c,...l } = e;
|
|
13
13
|
return new Tile({
|
|
14
|
-
className: l,
|
|
15
14
|
source: new XYZ({
|
|
16
|
-
url:
|
|
17
|
-
projection:
|
|
18
|
-
crossOrigin: "Anonymous"
|
|
15
|
+
url: createTianDiTuUrl(l),
|
|
16
|
+
projection: l.projection,
|
|
17
|
+
crossOrigin: "Anonymous",
|
|
18
|
+
...c
|
|
19
19
|
}),
|
|
20
|
-
|
|
20
|
+
...s
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function createBingLayer({ name: e, key: s, layerOptions: c, sourceOptions: l }) {
|
|
24
24
|
return new Tile({
|
|
25
|
-
className: l,
|
|
26
25
|
source: new BingMaps({
|
|
27
|
-
key:
|
|
26
|
+
key: s,
|
|
28
27
|
imagerySet: e,
|
|
29
|
-
placeholderTiles: !1
|
|
28
|
+
placeholderTiles: !1,
|
|
29
|
+
...l
|
|
30
30
|
}),
|
|
31
|
-
|
|
31
|
+
...c
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function createOpenStreetMapLayer(e) {
|
|
35
|
+
let { layerOptions: s, sourceOptions: c } = e || {};
|
|
35
36
|
return new Tile({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
source: new OSM({
|
|
38
|
+
crossOrigin: "Anonymous",
|
|
39
|
+
...c
|
|
40
|
+
}),
|
|
41
|
+
...s
|
|
39
42
|
});
|
|
40
43
|
}
|
|
41
44
|
function createVectorLayer(e) {
|
|
@@ -49,4 +52,4 @@ function createVectorLayer(e) {
|
|
|
49
52
|
})
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
|
-
export {
|
|
55
|
+
export { createBingLayer, createOpenStreetMapLayer, createTianDiTuLayer, createTianDiTuUrl, createVectorLayer };
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./components/ol-map/props.js`),t=require(`./components/ol-map/index.js`);require(`./components/index.js`);const n=require(`./composables/useContextmenu/index.js`),r=require(`./constants/distance.js`),i=require(`./constants/projection.js`),a=require(`./utils/distance/index.js`),o=require(`./utils/style/index.js`),s=require(`./utils/feature/index.js`),c=require(`./utils/layer/index.js`),l=require(`./utils/projection/index.js`);require(`./utils/index.js`);const u=require(`./composables/useDrawLineString/index.js`),d=require(`./composables/useDrawPolygon/index.js`),f=require(`./composables/useGraticule/index.js`),p=require(`./composables/usePointermove/index.js`),m=require(`./composables/useSwitchBaseLayer/index.js`);require(`./composables/index.js`),exports.EPSG_3857=i.EPSG_3857,exports.EPSG_3857ExtentToEPSG_4326=l.EPSG_3857ExtentToEPSG_4326,exports.EPSG_3857ToEPSG_4326=l.EPSG_3857ToEPSG_4326,exports.EPSG_4326=i.EPSG_4326,exports.EPSG_4326ExtentToEPSG_3857=l.EPSG_4326ExtentToEPSG_3857,exports.EPSG_4326ToEPSG_3857=l.EPSG_4326ToEPSG_3857,exports.ONE_NM=r.ONE_NM,exports.OlMap=t.default,exports.WGS84Projection=i.WGS84Projection,exports.WebMercatorProjection=i.WebMercatorProjection,exports.createCircle=s.createCircle,exports.createCircleFeature=s.createCircleFeature,exports.createCircleStyle=o.createCircleStyle,exports.createFeature=s.createFeature,exports.createLineString=s.createLineString,exports.createLineStringFeature=s.createLineStringFeature,exports.createMultiLineString=s.createMultiLineString,exports.createMultiLineStringFeature=s.createMultiLineStringFeature,exports.createMultiPoint=s.createMultiPoint,exports.createMultiPointFeature=s.createMultiPointFeature,exports.createMultiPolygon=s.createMultiPolygon,exports.createMultiPolygonFeature=s.createMultiPolygonFeature,exports.createPoint=s.createPoint,exports.createPointFeature=s.createPointFeature,exports.createPolygon=s.createPolygon,exports.createPolygonFeature=s.createPolygonFeature,exports.createStyle=o.createStyle,exports.createTextStyle=o.createTextStyle,exports.
|
|
1
|
+
const e=require(`./components/ol-map/props.js`),t=require(`./components/ol-map/index.js`);require(`./components/index.js`);const n=require(`./composables/useContextmenu/index.js`),r=require(`./constants/distance.js`),i=require(`./constants/projection.js`),a=require(`./utils/distance/index.js`),o=require(`./utils/style/index.js`),s=require(`./utils/feature/index.js`),c=require(`./utils/layer/index.js`),l=require(`./utils/projection/index.js`);require(`./utils/index.js`);const u=require(`./composables/useDrawLineString/index.js`),d=require(`./composables/useDrawPolygon/index.js`),f=require(`./composables/useGraticule/index.js`),p=require(`./composables/usePointermove/index.js`),m=require(`./composables/useSwitchBaseLayer/index.js`);require(`./composables/index.js`),exports.EPSG_3857=i.EPSG_3857,exports.EPSG_3857ExtentToEPSG_4326=l.EPSG_3857ExtentToEPSG_4326,exports.EPSG_3857ToEPSG_4326=l.EPSG_3857ToEPSG_4326,exports.EPSG_4326=i.EPSG_4326,exports.EPSG_4326ExtentToEPSG_3857=l.EPSG_4326ExtentToEPSG_3857,exports.EPSG_4326ToEPSG_3857=l.EPSG_4326ToEPSG_3857,exports.ONE_NM=r.ONE_NM,exports.OlMap=t.default,exports.WGS84Projection=i.WGS84Projection,exports.WebMercatorProjection=i.WebMercatorProjection,exports.createBingLayer=c.createBingLayer,exports.createCircle=s.createCircle,exports.createCircleFeature=s.createCircleFeature,exports.createCircleStyle=o.createCircleStyle,exports.createFeature=s.createFeature,exports.createLineString=s.createLineString,exports.createLineStringFeature=s.createLineStringFeature,exports.createMultiLineString=s.createMultiLineString,exports.createMultiLineStringFeature=s.createMultiLineStringFeature,exports.createMultiPoint=s.createMultiPoint,exports.createMultiPointFeature=s.createMultiPointFeature,exports.createMultiPolygon=s.createMultiPolygon,exports.createMultiPolygonFeature=s.createMultiPolygonFeature,exports.createOpenStreetMapLayer=c.createOpenStreetMapLayer,exports.createPoint=s.createPoint,exports.createPointFeature=s.createPointFeature,exports.createPolygon=s.createPolygon,exports.createPolygonFeature=s.createPolygonFeature,exports.createStyle=o.createStyle,exports.createTextStyle=o.createTextStyle,exports.createTianDiTuLayer=c.createTianDiTuLayer,exports.createTianDiTuUrl=c.createTianDiTuUrl,exports.createVectorLayer=c.createVectorLayer,exports.formatAngle=a.formatAngle,exports.formatRotation=a.formatRotation,exports.kmToNauticalMiles=a.kmToNauticalMiles,exports.mercatorExtentToWgs84=l.mercatorExtentToWgs84,exports.mercatorToWgs84=l.mercatorToWgs84,exports.nauticalMilesToKm=a.nauticalMilesToKm,exports.olMapInjectionKey=e.olMapInjectionKey,exports.useContextmenu=n.useContextmenu,exports.useDrawLineString=u.useDrawLineString,exports.useDrawPolygon=d.useDrawPolygon,exports.useGraticule=f.useGraticule,exports.useOlMap=e.useOlMap,exports.usePointermove=p.usePointermove,exports.useSwitchBaseLayer=m.useSwitchBaseLayer,exports.wgs84ExtentToMercator=l.wgs84ExtentToMercator,exports.wgs84ToMercator=l.wgs84ToMercator;
|
|
@@ -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 +1 @@
|
|
|
1
|
-
const e=require(`../../constants/distance.js`);function t(t){return t*1e3/e.ONE_NM}function n(t){return t*e.ONE_NM/1e3}exports.kmToNauticalMiles=t,exports.nauticalMilesToKm=n;
|
|
1
|
+
const e=require(`../../constants/distance.js`);function t(t){return t*1e3/e.ONE_NM}function n(t){return t*e.ONE_NM/1e3}function r(e){return e<0?r(e+2*Math.PI):e>2*Math.PI?r(e-2*Math.PI):e}function i(e){return e<0?i(e+360):e>=360?i(e-360):e}exports.formatAngle=i,exports.formatRotation=r,exports.kmToNauticalMiles=t,exports.nauticalMilesToKm=n;
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
+
import { StyleOptions } from '../style';
|
|
1
2
|
import { Feature } from 'ol';
|
|
2
3
|
import { Geometry } from 'ol/geom';
|
|
3
4
|
import { ProjectionLike } from 'ol/proj';
|
|
4
|
-
import { StyleOptions } from '../style';
|
|
5
5
|
import { Tile as TileLayer } from 'ol/layer';
|
|
6
6
|
import { default as VectorLayer } from 'ol/layer/Vector';
|
|
7
7
|
import { BingMaps, OSM, XYZ } from 'ol/source';
|
|
8
8
|
import { default as VectorSource } from 'ol/source/Vector';
|
|
9
9
|
export type T_MAP_TYPE = 'vec' | 'cva' | 'img' | 'cia' | 'ter' | 'cta' | 'ibo';
|
|
10
|
-
export
|
|
11
|
-
url?: string;
|
|
12
|
-
type: T_MAP_TYPE;
|
|
13
|
-
projection: ProjectionLike;
|
|
14
|
-
key: string;
|
|
15
|
-
}): string;
|
|
16
|
-
export declare function getTianDiTuLayer(data: {
|
|
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/lib/utils/layer/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`../../constants/projection.js`),n=require(`../style/index.js`);let r=require(`ol/layer/Vector`);r=e.__toESM(r);let i=require(`ol/source/Vector`);i=e.__toESM(i);let a=require(`ol/layer`);a=e.__toESM(a);let o=require(`ol/source`);o=e.__toESM(o);function s(e){let{type:n=`img`,projection:r=t.WebMercatorProjection,key:i}=e,a=e.url||`https://t{0-4}.tianditu.gov.cn`,o=`&tk=${i}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;return`${a}/${n}_${r===`EPSG:4326`?`c`:r===`EPSG:3857`?`w`:`c`}/wmts?LAYER=${n}${o}`}function c(e){let{
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.js`),t=require(`../../constants/projection.js`),n=require(`../style/index.js`);let r=require(`ol/layer/Vector`);r=e.__toESM(r);let i=require(`ol/source/Vector`);i=e.__toESM(i);let a=require(`ol/layer`);a=e.__toESM(a);let o=require(`ol/source`);o=e.__toESM(o);function s(e){let{type:n=`img`,projection:r=t.WebMercatorProjection,key:i}=e,a=e.url||`https://t{0-4}.tianditu.gov.cn`,o=`&tk=${i}&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}`;return`${a}/${n}_${r===`EPSG:4326`?`c`:r===`EPSG:3857`?`w`:`c`}/wmts?LAYER=${n}${o}`}function c(e){let{layerOptions:t,sourceOptions:n,...r}=e;return new a.Tile({source:new o.XYZ({url:s(r),projection:r.projection,crossOrigin:`Anonymous`,...n}),...t})}function l({name:e,key:t,layerOptions:n,sourceOptions:r}){return new a.Tile({source:new o.BingMaps({key:t,imagerySet:e,placeholderTiles:!1,...r}),...n})}function u(e){let{layerOptions:t,sourceOptions:n}=e||{};return new a.Tile({source:new o.OSM({crossOrigin:`Anonymous`,...n}),...t})}function d(e){let{styleOptions:t,...a}=e||{},o=t?n.createStyle(t):void 0,s=new i.default;return{source:s,layer:new r.default({source:s,...a,style:o||a.style})}}exports.createBingLayer=l,exports.createOpenStreetMapLayer=u,exports.createTianDiTuLayer=c,exports.createTianDiTuUrl=s,exports.createVectorLayer=d;
|