map-ol-utils 0.1.26 → 0.1.27
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/dist/index.cjs +6 -10
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -455,13 +455,11 @@ var selectEventHandle = (vectorLayer, feature) => {
|
|
|
455
455
|
}
|
|
456
456
|
const isAutoFit = vectorLayer.get("_isAutoFit");
|
|
457
457
|
if (isAutoFit) {
|
|
458
|
-
const [x, y] = (0, import_extent.getCenter)(feature.getGeometry().getExtent());
|
|
459
|
-
const [offsetX, offsetY] = vectorLayer.get("_offset") || [0, 0];
|
|
460
458
|
const view = instance.getView();
|
|
461
459
|
view.animate({
|
|
462
460
|
duration: 1e3,
|
|
463
461
|
zoom: view.getZoom(),
|
|
464
|
-
center:
|
|
462
|
+
center: (0, import_extent.getCenter)(feature.getGeometry().getExtent())
|
|
465
463
|
});
|
|
466
464
|
}
|
|
467
465
|
};
|
|
@@ -614,6 +612,7 @@ var addMassMarksLayer = (getImgUrlFn) => {
|
|
|
614
612
|
}
|
|
615
613
|
massMarksLayer.setProperties({
|
|
616
614
|
_isCustom: true,
|
|
615
|
+
_offset: offset,
|
|
617
616
|
_hasLine: hasLine,
|
|
618
617
|
_hasFace: hasFace,
|
|
619
618
|
className: layerName,
|
|
@@ -662,7 +661,8 @@ var createClusterLayer = (dataList, config) => {
|
|
|
662
661
|
openClick,
|
|
663
662
|
buildStyle,
|
|
664
663
|
singleStyles,
|
|
665
|
-
computedRadius
|
|
664
|
+
computedRadius,
|
|
665
|
+
layerName = "cluster-layer"
|
|
666
666
|
} = config;
|
|
667
667
|
const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
|
|
668
668
|
styleCache[1] = singleStyles;
|
|
@@ -705,6 +705,7 @@ var createClusterLayer = (dataList, config) => {
|
|
|
705
705
|
};
|
|
706
706
|
const vectorLayer = new import_Vector.default({
|
|
707
707
|
zIndex: 200,
|
|
708
|
+
className: layerName,
|
|
708
709
|
source: new import_Cluster.default({
|
|
709
710
|
distance: distance || 80,
|
|
710
711
|
minDistance: minDistance || 0,
|
|
@@ -738,7 +739,6 @@ var import_source2 = require("ol/source");
|
|
|
738
739
|
var import_tilegrid = require("ol/tilegrid");
|
|
739
740
|
var import_layer = require("ol/layer");
|
|
740
741
|
var import_WMTS = __toESM(require("ol/tilegrid/WMTS"), 1);
|
|
741
|
-
var import_WebGLTile = __toESM(require("ol/layer/WebGLTile"), 1);
|
|
742
742
|
var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
743
743
|
const config = {
|
|
744
744
|
zIndex: -5,
|
|
@@ -785,7 +785,7 @@ var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
|
785
785
|
_layerName: layerName
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
|
-
return
|
|
788
|
+
return new import_layer.Tile(config);
|
|
789
789
|
};
|
|
790
790
|
var createMapWorldLayer = (layerName, tk = "c77eddc667c5bed016fded560baf93e7") => {
|
|
791
791
|
const [name, matrixSet] = layerName.split("_");
|
|
@@ -1044,10 +1044,6 @@ var determineGeometryType = (coordinates) => {
|
|
|
1044
1044
|
return "Invalid" /* Invalid */;
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
|
-
var isWebGLSupported = () => {
|
|
1048
|
-
const canvas = document.createElement("canvas");
|
|
1049
|
-
return !!canvas.getContext("webgl") || !!canvas.getContext("experimental-webgl");
|
|
1050
|
-
};
|
|
1051
1047
|
|
|
1052
1048
|
// src/ogc-utils.ts
|
|
1053
1049
|
var import_source3 = require("ol/source");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Layer, Tile } from 'ol/layer';
|
|
2
2
|
import { Style } from 'ol/style';
|
|
3
|
-
import { Map as Map$1,
|
|
3
|
+
import { Map as Map$1, Feature, Overlay } from 'ol';
|
|
4
4
|
import { CRSTypes } from 'gcoord';
|
|
5
5
|
import * as ol_source from 'ol/source';
|
|
6
6
|
import { Source, XYZ, WMTS } from 'ol/source';
|
|
@@ -9,9 +9,8 @@ import { FeatureLike } from 'ol/Feature';
|
|
|
9
9
|
import { Emitter, EventType } from 'mitt';
|
|
10
10
|
import TileLayer from 'ol/layer/Tile';
|
|
11
11
|
import * as ol_renderer_Layer from 'ol/renderer/Layer';
|
|
12
|
-
import WebGLTileLayer from 'ol/layer/WebGLTile';
|
|
13
12
|
import * as ol_geom from 'ol/geom';
|
|
14
|
-
import {
|
|
13
|
+
import { Point, SimpleGeometry } from 'ol/geom';
|
|
15
14
|
import { Options } from 'ol/Overlay';
|
|
16
15
|
import Cluster from 'ol/source/Cluster';
|
|
17
16
|
import { Select } from 'ol/interaction';
|
|
@@ -62,6 +61,7 @@ type ClusterData = {
|
|
|
62
61
|
};
|
|
63
62
|
type ClusterConfig = {
|
|
64
63
|
distance: number;
|
|
64
|
+
layerName?: string;
|
|
65
65
|
openClick?: boolean;
|
|
66
66
|
minDistance: number;
|
|
67
67
|
singleStyles: Style[];
|
|
@@ -130,7 +130,7 @@ declare const createWmtsLayer: (serverUrl: string) => (config: WmtsSourceOptions
|
|
|
130
130
|
* 创建杭州规自地图
|
|
131
131
|
* @param layerName - 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark'
|
|
132
132
|
*/
|
|
133
|
-
declare const createBaseLayer: (layerName?: HzsyType) =>
|
|
133
|
+
declare const createBaseLayer: (layerName?: HzsyType) => Tile<XYZ>;
|
|
134
134
|
/**
|
|
135
135
|
* 创建全国天地图
|
|
136
136
|
* @param layerName - 图层名称
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Layer, Tile } from 'ol/layer';
|
|
2
2
|
import { Style } from 'ol/style';
|
|
3
|
-
import { Map as Map$1,
|
|
3
|
+
import { Map as Map$1, Feature, Overlay } from 'ol';
|
|
4
4
|
import { CRSTypes } from 'gcoord';
|
|
5
5
|
import * as ol_source from 'ol/source';
|
|
6
6
|
import { Source, XYZ, WMTS } from 'ol/source';
|
|
@@ -9,9 +9,8 @@ import { FeatureLike } from 'ol/Feature';
|
|
|
9
9
|
import { Emitter, EventType } from 'mitt';
|
|
10
10
|
import TileLayer from 'ol/layer/Tile';
|
|
11
11
|
import * as ol_renderer_Layer from 'ol/renderer/Layer';
|
|
12
|
-
import WebGLTileLayer from 'ol/layer/WebGLTile';
|
|
13
12
|
import * as ol_geom from 'ol/geom';
|
|
14
|
-
import {
|
|
13
|
+
import { Point, SimpleGeometry } from 'ol/geom';
|
|
15
14
|
import { Options } from 'ol/Overlay';
|
|
16
15
|
import Cluster from 'ol/source/Cluster';
|
|
17
16
|
import { Select } from 'ol/interaction';
|
|
@@ -62,6 +61,7 @@ type ClusterData = {
|
|
|
62
61
|
};
|
|
63
62
|
type ClusterConfig = {
|
|
64
63
|
distance: number;
|
|
64
|
+
layerName?: string;
|
|
65
65
|
openClick?: boolean;
|
|
66
66
|
minDistance: number;
|
|
67
67
|
singleStyles: Style[];
|
|
@@ -130,7 +130,7 @@ declare const createWmtsLayer: (serverUrl: string) => (config: WmtsSourceOptions
|
|
|
130
130
|
* 创建杭州规自地图
|
|
131
131
|
* @param layerName - 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark'
|
|
132
132
|
*/
|
|
133
|
-
declare const createBaseLayer: (layerName?: HzsyType) =>
|
|
133
|
+
declare const createBaseLayer: (layerName?: HzsyType) => Tile<XYZ>;
|
|
134
134
|
/**
|
|
135
135
|
* 创建全国天地图
|
|
136
136
|
* @param layerName - 图层名称
|
package/dist/index.js
CHANGED
|
@@ -393,13 +393,11 @@ var selectEventHandle = (vectorLayer, feature) => {
|
|
|
393
393
|
}
|
|
394
394
|
const isAutoFit = vectorLayer.get("_isAutoFit");
|
|
395
395
|
if (isAutoFit) {
|
|
396
|
-
const [x, y] = getCenter(feature.getGeometry().getExtent());
|
|
397
|
-
const [offsetX, offsetY] = vectorLayer.get("_offset") || [0, 0];
|
|
398
396
|
const view = instance.getView();
|
|
399
397
|
view.animate({
|
|
400
398
|
duration: 1e3,
|
|
401
399
|
zoom: view.getZoom(),
|
|
402
|
-
center:
|
|
400
|
+
center: getCenter(feature.getGeometry().getExtent())
|
|
403
401
|
});
|
|
404
402
|
}
|
|
405
403
|
};
|
|
@@ -552,6 +550,7 @@ var addMassMarksLayer = (getImgUrlFn) => {
|
|
|
552
550
|
}
|
|
553
551
|
massMarksLayer.setProperties({
|
|
554
552
|
_isCustom: true,
|
|
553
|
+
_offset: offset,
|
|
555
554
|
_hasLine: hasLine,
|
|
556
555
|
_hasFace: hasFace,
|
|
557
556
|
className: layerName,
|
|
@@ -600,7 +599,8 @@ var createClusterLayer = (dataList, config) => {
|
|
|
600
599
|
openClick,
|
|
601
600
|
buildStyle,
|
|
602
601
|
singleStyles,
|
|
603
|
-
computedRadius
|
|
602
|
+
computedRadius,
|
|
603
|
+
layerName = "cluster-layer"
|
|
604
604
|
} = config;
|
|
605
605
|
const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
|
|
606
606
|
styleCache[1] = singleStyles;
|
|
@@ -643,6 +643,7 @@ var createClusterLayer = (dataList, config) => {
|
|
|
643
643
|
};
|
|
644
644
|
const vectorLayer = new VectorLayer({
|
|
645
645
|
zIndex: 200,
|
|
646
|
+
className: layerName,
|
|
646
647
|
source: new Cluster({
|
|
647
648
|
distance: distance || 80,
|
|
648
649
|
minDistance: minDistance || 0,
|
|
@@ -676,7 +677,6 @@ import { WMTS } from "ol/source";
|
|
|
676
677
|
import { TileGrid } from "ol/tilegrid";
|
|
677
678
|
import { Tile } from "ol/layer";
|
|
678
679
|
import WMTSTileGrid from "ol/tilegrid/WMTS";
|
|
679
|
-
import WebGLTileLayer from "ol/layer/WebGLTile";
|
|
680
680
|
var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
681
681
|
const config = {
|
|
682
682
|
zIndex: -5,
|
|
@@ -723,7 +723,7 @@ var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
|
723
723
|
_layerName: layerName
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
|
-
return
|
|
726
|
+
return new Tile(config);
|
|
727
727
|
};
|
|
728
728
|
var createMapWorldLayer = (layerName, tk = "c77eddc667c5bed016fded560baf93e7") => {
|
|
729
729
|
const [name, matrixSet] = layerName.split("_");
|
|
@@ -982,10 +982,6 @@ var determineGeometryType = (coordinates) => {
|
|
|
982
982
|
return "Invalid" /* Invalid */;
|
|
983
983
|
}
|
|
984
984
|
};
|
|
985
|
-
var isWebGLSupported = () => {
|
|
986
|
-
const canvas = document.createElement("canvas");
|
|
987
|
-
return !!canvas.getContext("webgl") || !!canvas.getContext("experimental-webgl");
|
|
988
|
-
};
|
|
989
985
|
|
|
990
986
|
// src/ogc-utils.ts
|
|
991
987
|
import { WMTS as WMTS2 } from "ol/source";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map-ol-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Openlayers utils library",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"gcoord": "^1.0.7",
|
|
29
29
|
"mitt": "^3.0.1",
|
|
30
|
-
"ol": "^10.
|
|
30
|
+
"ol": "^10.7.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"ol": ">=10.5.0"
|