map-ol-utils 0.1.25 → 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 +7 -7
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +7 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -545,6 +545,7 @@ var createMassMarksLayer = (dataList, styleList = []) => {
|
|
|
545
545
|
var addMassMarksLayer = (getImgUrlFn) => {
|
|
546
546
|
return (dataList = [], iconConfig, openClick = true) => {
|
|
547
547
|
const {
|
|
548
|
+
offset = [0, 0],
|
|
548
549
|
baseUrl,
|
|
549
550
|
hasLine,
|
|
550
551
|
hasFace,
|
|
@@ -568,6 +569,7 @@ var addMassMarksLayer = (getImgUrlFn) => {
|
|
|
568
569
|
const massMarksLayer = createMassMarksLayer(dataList, massMarksStyles);
|
|
569
570
|
if (openClick) {
|
|
570
571
|
massMarksLayer.setProperties({
|
|
572
|
+
_offset: offset,
|
|
571
573
|
_isAutoFit: isAutoFit
|
|
572
574
|
});
|
|
573
575
|
createSelectByLayer(massMarksLayer);
|
|
@@ -610,6 +612,7 @@ var addMassMarksLayer = (getImgUrlFn) => {
|
|
|
610
612
|
}
|
|
611
613
|
massMarksLayer.setProperties({
|
|
612
614
|
_isCustom: true,
|
|
615
|
+
_offset: offset,
|
|
613
616
|
_hasLine: hasLine,
|
|
614
617
|
_hasFace: hasFace,
|
|
615
618
|
className: layerName,
|
|
@@ -658,7 +661,8 @@ var createClusterLayer = (dataList, config) => {
|
|
|
658
661
|
openClick,
|
|
659
662
|
buildStyle,
|
|
660
663
|
singleStyles,
|
|
661
|
-
computedRadius
|
|
664
|
+
computedRadius,
|
|
665
|
+
layerName = "cluster-layer"
|
|
662
666
|
} = config;
|
|
663
667
|
const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
|
|
664
668
|
styleCache[1] = singleStyles;
|
|
@@ -701,6 +705,7 @@ var createClusterLayer = (dataList, config) => {
|
|
|
701
705
|
};
|
|
702
706
|
const vectorLayer = new import_Vector.default({
|
|
703
707
|
zIndex: 200,
|
|
708
|
+
className: layerName,
|
|
704
709
|
source: new import_Cluster.default({
|
|
705
710
|
distance: distance || 80,
|
|
706
711
|
minDistance: minDistance || 0,
|
|
@@ -734,7 +739,6 @@ var import_source2 = require("ol/source");
|
|
|
734
739
|
var import_tilegrid = require("ol/tilegrid");
|
|
735
740
|
var import_layer = require("ol/layer");
|
|
736
741
|
var import_WMTS = __toESM(require("ol/tilegrid/WMTS"), 1);
|
|
737
|
-
var import_WebGLTile = __toESM(require("ol/layer/WebGLTile"), 1);
|
|
738
742
|
var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
739
743
|
const config = {
|
|
740
744
|
zIndex: -5,
|
|
@@ -781,7 +785,7 @@ var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
|
781
785
|
_layerName: layerName
|
|
782
786
|
}
|
|
783
787
|
};
|
|
784
|
-
return
|
|
788
|
+
return new import_layer.Tile(config);
|
|
785
789
|
};
|
|
786
790
|
var createMapWorldLayer = (layerName, tk = "c77eddc667c5bed016fded560baf93e7") => {
|
|
787
791
|
const [name, matrixSet] = layerName.split("_");
|
|
@@ -1040,10 +1044,6 @@ var determineGeometryType = (coordinates) => {
|
|
|
1040
1044
|
return "Invalid" /* Invalid */;
|
|
1041
1045
|
}
|
|
1042
1046
|
};
|
|
1043
|
-
var isWebGLSupported = () => {
|
|
1044
|
-
const canvas = document.createElement("canvas");
|
|
1045
|
-
return !!canvas.getContext("webgl") || !!canvas.getContext("experimental-webgl");
|
|
1046
|
-
};
|
|
1047
1047
|
|
|
1048
1048
|
// src/ogc-utils.ts
|
|
1049
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[];
|
|
@@ -79,6 +79,7 @@ type IconConfig = {
|
|
|
79
79
|
activeScale?: number;
|
|
80
80
|
isAutoFit?: boolean;
|
|
81
81
|
marksStyles?: Style[];
|
|
82
|
+
offset?: [number, number];
|
|
82
83
|
vectorConfig?: VectorConfig;
|
|
83
84
|
markerSize: [number, number];
|
|
84
85
|
};
|
|
@@ -129,7 +130,7 @@ declare const createWmtsLayer: (serverUrl: string) => (config: WmtsSourceOptions
|
|
|
129
130
|
* 创建杭州规自地图
|
|
130
131
|
* @param layerName - 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark'
|
|
131
132
|
*/
|
|
132
|
-
declare const createBaseLayer: (layerName?: HzsyType) =>
|
|
133
|
+
declare const createBaseLayer: (layerName?: HzsyType) => Tile<XYZ>;
|
|
133
134
|
/**
|
|
134
135
|
* 创建全国天地图
|
|
135
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[];
|
|
@@ -79,6 +79,7 @@ type IconConfig = {
|
|
|
79
79
|
activeScale?: number;
|
|
80
80
|
isAutoFit?: boolean;
|
|
81
81
|
marksStyles?: Style[];
|
|
82
|
+
offset?: [number, number];
|
|
82
83
|
vectorConfig?: VectorConfig;
|
|
83
84
|
markerSize: [number, number];
|
|
84
85
|
};
|
|
@@ -129,7 +130,7 @@ declare const createWmtsLayer: (serverUrl: string) => (config: WmtsSourceOptions
|
|
|
129
130
|
* 创建杭州规自地图
|
|
130
131
|
* @param layerName - 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark'
|
|
131
132
|
*/
|
|
132
|
-
declare const createBaseLayer: (layerName?: HzsyType) =>
|
|
133
|
+
declare const createBaseLayer: (layerName?: HzsyType) => Tile<XYZ>;
|
|
133
134
|
/**
|
|
134
135
|
* 创建全国天地图
|
|
135
136
|
* @param layerName - 图层名称
|
package/dist/index.js
CHANGED
|
@@ -483,6 +483,7 @@ var createMassMarksLayer = (dataList, styleList = []) => {
|
|
|
483
483
|
var addMassMarksLayer = (getImgUrlFn) => {
|
|
484
484
|
return (dataList = [], iconConfig, openClick = true) => {
|
|
485
485
|
const {
|
|
486
|
+
offset = [0, 0],
|
|
486
487
|
baseUrl,
|
|
487
488
|
hasLine,
|
|
488
489
|
hasFace,
|
|
@@ -506,6 +507,7 @@ var addMassMarksLayer = (getImgUrlFn) => {
|
|
|
506
507
|
const massMarksLayer = createMassMarksLayer(dataList, massMarksStyles);
|
|
507
508
|
if (openClick) {
|
|
508
509
|
massMarksLayer.setProperties({
|
|
510
|
+
_offset: offset,
|
|
509
511
|
_isAutoFit: isAutoFit
|
|
510
512
|
});
|
|
511
513
|
createSelectByLayer(massMarksLayer);
|
|
@@ -548,6 +550,7 @@ var addMassMarksLayer = (getImgUrlFn) => {
|
|
|
548
550
|
}
|
|
549
551
|
massMarksLayer.setProperties({
|
|
550
552
|
_isCustom: true,
|
|
553
|
+
_offset: offset,
|
|
551
554
|
_hasLine: hasLine,
|
|
552
555
|
_hasFace: hasFace,
|
|
553
556
|
className: layerName,
|
|
@@ -596,7 +599,8 @@ var createClusterLayer = (dataList, config) => {
|
|
|
596
599
|
openClick,
|
|
597
600
|
buildStyle,
|
|
598
601
|
singleStyles,
|
|
599
|
-
computedRadius
|
|
602
|
+
computedRadius,
|
|
603
|
+
layerName = "cluster-layer"
|
|
600
604
|
} = config;
|
|
601
605
|
const innerComputedRadius = (size) => Math.pow(size / count, 1 / 18);
|
|
602
606
|
styleCache[1] = singleStyles;
|
|
@@ -639,6 +643,7 @@ var createClusterLayer = (dataList, config) => {
|
|
|
639
643
|
};
|
|
640
644
|
const vectorLayer = new VectorLayer({
|
|
641
645
|
zIndex: 200,
|
|
646
|
+
className: layerName,
|
|
642
647
|
source: new Cluster({
|
|
643
648
|
distance: distance || 80,
|
|
644
649
|
minDistance: minDistance || 0,
|
|
@@ -672,7 +677,6 @@ import { WMTS } from "ol/source";
|
|
|
672
677
|
import { TileGrid } from "ol/tilegrid";
|
|
673
678
|
import { Tile } from "ol/layer";
|
|
674
679
|
import WMTSTileGrid from "ol/tilegrid/WMTS";
|
|
675
|
-
import WebGLTileLayer from "ol/layer/WebGLTile";
|
|
676
680
|
var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
677
681
|
const config = {
|
|
678
682
|
zIndex: -5,
|
|
@@ -719,7 +723,7 @@ var createBaseLayer = (layerName = "hzsyvector_dark") => {
|
|
|
719
723
|
_layerName: layerName
|
|
720
724
|
}
|
|
721
725
|
};
|
|
722
|
-
return
|
|
726
|
+
return new Tile(config);
|
|
723
727
|
};
|
|
724
728
|
var createMapWorldLayer = (layerName, tk = "c77eddc667c5bed016fded560baf93e7") => {
|
|
725
729
|
const [name, matrixSet] = layerName.split("_");
|
|
@@ -978,10 +982,6 @@ var determineGeometryType = (coordinates) => {
|
|
|
978
982
|
return "Invalid" /* Invalid */;
|
|
979
983
|
}
|
|
980
984
|
};
|
|
981
|
-
var isWebGLSupported = () => {
|
|
982
|
-
const canvas = document.createElement("canvas");
|
|
983
|
-
return !!canvas.getContext("webgl") || !!canvas.getContext("experimental-webgl");
|
|
984
|
-
};
|
|
985
985
|
|
|
986
986
|
// src/ogc-utils.ts
|
|
987
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"
|