gisviewer-vue3-arcgis 1.0.284 → 1.0.286
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/es/index.mjs +6 -5
- package/es/src/gis-map/gis-map.vue.d.ts +126 -3
- package/es/src/gis-map/gis-map.vue.mjs +63 -63
- package/es/src/gis-map/index.d.ts +126 -3
- package/es/src/gis-map/utils/edpass-device-controller.mjs +278 -0
- package/es/src/gis-map/utils/green-wave-band-controller/index.mjs +362 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +101 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.mjs +153 -0
- package/es/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.mjs +4 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.mjs +336 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +240 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +106 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +578 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +386 -0
- package/es/src/gis-map/utils/index.mjs +2 -2
- package/es/src/gis-map/utils/overlay.d.ts +2 -2
- package/es/src/gis-map/utils/overlay.mjs +2 -2
- package/es/src/gis-map/utils/police-jurisdiction.mjs +202 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/signal-control-area/cross-renderer.mjs +593 -0
- package/es/src/gis-map/utils/signal-control-area/district-controller.mjs +84 -0
- package/es/src/gis-map/utils/signal-control-area/district-renderer.mjs +122 -0
- package/es/src/gis-map/utils/signal-control-area/edit-area.mjs +550 -0
- package/es/src/gis-map/utils/signal-control-area/layer-symbol.mjs +984 -0
- package/es/src/gis-map/utils/signal-control-area/signal-area-controller.mjs +140 -0
- package/es/src/gis-map/utils/signal-control-area/signal-cross-controller.mjs +423 -0
- package/es/src/gis-map/utils/signal-control-area/signal-renderer.mjs +123 -0
- package/es/src/gis-map/utils/signal-control-area/sub-district-renderer.mjs +367 -0
- package/es/src/gis-map/utils/signal-system/signal-system-controller.mjs +137 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.d.ts +79 -0
- package/es/src/gis-map-ol/gis-map-ol.vue.mjs +93 -0
- package/es/src/gis-map-ol/gis-map-ol.vue2.mjs +4 -0
- package/es/src/gis-map-ol/gis-map-ol.vue3.mjs +5 -0
- package/es/src/gis-map-ol/index.d.ts +69 -1
- package/es/src/gis-map-ol/index.mjs +8 -0
- package/es/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/es/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.mjs +122 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.d.ts +29 -0
- package/es/src/gis-map-ol/utils/ol-map-initializer.mjs +183 -0
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/es/src/gis-map-ol/utils/overlay/cluster-point-controller.mjs +102 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/es/src/gis-map-ol/utils/overlay/overlay-controller.mjs +276 -0
- package/es/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/es/src/gis-map-ol/utils/police-area-controller.mjs +155 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +33 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-cross-controller.mjs +221 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/es/src/gis-map-ol/utils/signal-control/signal-system-controller.mjs +127 -0
- package/es/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/es/src/gis-map-ol/utils/style/line-style.mjs +151 -0
- package/es/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/es/src/gis-map-ol/utils/style/point-style.mjs +206 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/es/src/gis-map-ol/utils/style/polygon-style.mjs +166 -0
- package/es/src/index.mjs +4 -4
- package/es/src/types/index.d.ts +2 -1
- package/es/src/types/index.mjs +5 -0
- package/lib/index.js +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +126 -3
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +126 -3
- package/lib/src/gis-map/utils/edpass-device-controller.js +1 -0
- package/lib/src/gis-map/utils/green-wave-band-controller/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.d.ts +125 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-countdown-panel.vue2.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow-lsr.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -0
- package/lib/src/gis-map/utils/index.js +1 -1
- package/lib/src/gis-map/utils/overlay.d.ts +2 -2
- package/lib/src/gis-map/utils/overlay.js +1 -1
- package/lib/src/gis-map/utils/police-jurisdiction.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/cross-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/edit-area.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/layer-symbol.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-area-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-cross-controller.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/signal-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-control-area/sub-district-renderer.js +1 -0
- package/lib/src/gis-map/utils/signal-system/signal-system-controller.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.d.ts +79 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue2.js +1 -0
- package/lib/src/gis-map-ol/gis-map-ol.vue3.js +1 -0
- package/lib/src/gis-map-ol/index.d.ts +69 -1
- package/lib/src/gis-map-ol/index.js +1 -0
- package/lib/src/gis-map-ol/utils/cluster/index.d.ts +2 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.d.ts +65 -0
- package/lib/src/gis-map-ol/utils/cluster/pixel-cluster-calculator.js +1 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.d.ts +29 -0
- package/lib/src/gis-map-ol/utils/ol-map-initializer.js +1 -0
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.d.ts +23 -0
- package/lib/src/gis-map-ol/utils/overlay/cluster-point-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.d.ts +116 -0
- package/lib/src/gis-map-ol/utils/overlay/overlay-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.d.ts +16 -0
- package/lib/src/gis-map-ol/utils/police-area-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.d.ts +33 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-cross-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.d.ts +49 -0
- package/lib/src/gis-map-ol/utils/signal-control/signal-system-controller.js +1 -0
- package/lib/src/gis-map-ol/utils/style/line-style.d.ts +64 -0
- package/lib/src/gis-map-ol/utils/style/line-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/point-style.d.ts +78 -0
- package/lib/src/gis-map-ol/utils/style/point-style.js +1 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.d.ts +60 -0
- package/lib/src/gis-map-ol/utils/style/polygon-style.js +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/types/index.d.ts +2 -1
- package/lib/src/types/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
export declare const GisMapOl:
|
|
1
|
+
export declare const GisMapOl: import("@easyest/utils/dist/lib/withinstall").SFCWithInstall<import("vue").DefineComponent<{
|
|
2
|
+
config: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
assetsRoot: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
required: false;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
mapContainer: import("vue").Ref<any>;
|
|
12
|
+
mapInitializer: import("./utils/ol-map-initializer").default;
|
|
13
|
+
map: import("ol/Map").default;
|
|
14
|
+
viewEventKeys: import("ol/events").EventsKey[];
|
|
15
|
+
lastEmittedZoomInt: number | null;
|
|
16
|
+
emitZoomIfChanged: (z: number) => void;
|
|
17
|
+
signalCrossController: import("./utils/signal-control/signal-cross-controller").default;
|
|
18
|
+
signalSystemController: import("./utils/signal-control/signal-system-controller").default;
|
|
19
|
+
clusterPointController: import("./utils/overlay/cluster-point-controller").default;
|
|
20
|
+
policeAreaController: import("./utils/police-area-controller").default;
|
|
21
|
+
overlayController: import("./utils/overlay/overlay-controller").default;
|
|
22
|
+
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
23
|
+
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
24
|
+
setLayerVisibility: (params: import("../types").ILayerVisibleParams) => Promise<import("../types").IResult>;
|
|
25
|
+
setMapZoom: (zoom: number) => import("../types").IResult;
|
|
26
|
+
showSignalCross: (params: import("../types").IShowSignalCrossParams) => import("../types").IResult;
|
|
27
|
+
changeSignalCrossShowName: (showName: "detail" | "crossName" | "signalId") => void | {
|
|
28
|
+
success: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
clearSignalCross: () => void;
|
|
32
|
+
showSignalSystem: (params: import("../types").IShowSignalSystemParams) => Promise<import("../types").IResult> | {
|
|
33
|
+
status: number;
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
removeSignalSystem: (areaCode?: string | undefined) => void | {
|
|
37
|
+
success: boolean;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
showSubSignalSystem: (params: import("../types").IShowSubSignalSystemParams) => Promise<import("../types").IResult>;
|
|
41
|
+
removeSubSignalSystem: (subCode?: string | undefined) => void | {
|
|
42
|
+
success: boolean;
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
addClusterPoints: (params: import("../types").IClusterPointParams) => void;
|
|
46
|
+
removeAllClusterPoints: () => void;
|
|
47
|
+
showPoliceArea: (params: import("../types").IShowJurisdictionParams) => Promise<void>;
|
|
48
|
+
clearPoliceArea: () => void;
|
|
49
|
+
addOverlays: (params: import("../types").IOverlayParam) => import("../types").IResult;
|
|
50
|
+
removeOverlaysById: (ids: string | string[]) => void;
|
|
51
|
+
removeOverlaysByType: (type: string | string[]) => void;
|
|
52
|
+
removeAllOverlays: () => void;
|
|
53
|
+
props: any;
|
|
54
|
+
emit: (event: "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", ...args: any[]) => void;
|
|
55
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("mapLoaded" | "markerClick" | "mapClick" | "update:zoom")[], "mapLoaded" | "markerClick" | "mapClick" | "update:zoom", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
|
+
config: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
required: true;
|
|
59
|
+
};
|
|
60
|
+
assetsRoot: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
required: false;
|
|
63
|
+
};
|
|
64
|
+
}>> & {
|
|
65
|
+
onMapLoaded?: ((...args: any[]) => any) | undefined;
|
|
66
|
+
onMarkerClick?: ((...args: any[]) => any) | undefined;
|
|
67
|
+
onMapClick?: ((...args: any[]) => any) | undefined;
|
|
68
|
+
"onUpdate:zoom"?: ((...args: any[]) => any) | undefined;
|
|
69
|
+
}, {}, {}>>;
|
|
2
70
|
export default GisMapOl;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { ICluster, IClusterLocation } from '../../../types';
|
|
3
|
+
export interface IPixelClusterOptions {
|
|
4
|
+
/** 聚合半径(像素),默认 120 */
|
|
5
|
+
clusterRadius?: number;
|
|
6
|
+
/** 最小聚合点数,默认 2 */
|
|
7
|
+
minClusterPoints?: number;
|
|
8
|
+
/** 最大聚合符号大小,默认 40 */
|
|
9
|
+
maxClusterSymbolSize?: number;
|
|
10
|
+
/** 最小聚合符号大小,默认 20 */
|
|
11
|
+
minClusterSymbolSize?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 像素聚合计算器
|
|
15
|
+
* 基于屏幕像素距离进行点聚合
|
|
16
|
+
*/
|
|
17
|
+
export declare class PixelClusterCalculator {
|
|
18
|
+
private map;
|
|
19
|
+
private options;
|
|
20
|
+
private clusteredLocations;
|
|
21
|
+
constructor(map: OlMap, options?: IPixelClusterOptions);
|
|
22
|
+
/**
|
|
23
|
+
* 计算聚合结果
|
|
24
|
+
* @param locations 原始点位数组
|
|
25
|
+
* @returns 聚合结果
|
|
26
|
+
*/
|
|
27
|
+
calculate(locations: IClusterLocation[]): ICluster[];
|
|
28
|
+
/**
|
|
29
|
+
* 计算聚合符号大小
|
|
30
|
+
* @param clusters 聚合结果
|
|
31
|
+
* @returns 带有符号大小信息的聚合结果
|
|
32
|
+
*/
|
|
33
|
+
calculateSymbolSizes(clusters: ICluster[]): (ICluster & {
|
|
34
|
+
symbolSize?: number;
|
|
35
|
+
})[];
|
|
36
|
+
/**
|
|
37
|
+
* 更新配置
|
|
38
|
+
*/
|
|
39
|
+
updateOptions(options: Partial<IPixelClusterOptions>): void;
|
|
40
|
+
/**
|
|
41
|
+
* 获取当前配置
|
|
42
|
+
*/
|
|
43
|
+
getOptions(): Required<IPixelClusterOptions>;
|
|
44
|
+
/**
|
|
45
|
+
* 将地理坐标转换为屏幕坐标
|
|
46
|
+
*/
|
|
47
|
+
private locationToScreen;
|
|
48
|
+
/**
|
|
49
|
+
* 基于像素距离的聚合算法
|
|
50
|
+
*/
|
|
51
|
+
private doPixelCluster;
|
|
52
|
+
/**
|
|
53
|
+
* 获取指定点的邻近点
|
|
54
|
+
*/
|
|
55
|
+
private getNeighbors;
|
|
56
|
+
/**
|
|
57
|
+
* 计算两点之间的屏幕距离
|
|
58
|
+
*/
|
|
59
|
+
private getDistance;
|
|
60
|
+
/**
|
|
61
|
+
* 根据聚合结果创建聚合对象
|
|
62
|
+
*/
|
|
63
|
+
private createClusters;
|
|
64
|
+
}
|
|
65
|
+
export default PixelClusterCalculator;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const d = {
|
|
2
|
+
clusterRadius: 120,
|
|
3
|
+
minClusterPoints: 2,
|
|
4
|
+
maxClusterSymbolSize: 40,
|
|
5
|
+
minClusterSymbolSize: 20
|
|
6
|
+
};
|
|
7
|
+
class m {
|
|
8
|
+
constructor(s, e) {
|
|
9
|
+
this.clusteredLocations = [], this.map = s, this.options = { ...d, ...e };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 计算聚合结果
|
|
13
|
+
* @param locations 原始点位数组
|
|
14
|
+
* @returns 聚合结果
|
|
15
|
+
*/
|
|
16
|
+
calculate(s) {
|
|
17
|
+
return this.locationToScreen(s), this.doPixelCluster(this.options.clusterRadius);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 计算聚合符号大小
|
|
21
|
+
* @param clusters 聚合结果
|
|
22
|
+
* @returns 带有符号大小信息的聚合结果
|
|
23
|
+
*/
|
|
24
|
+
calculateSymbolSizes(s) {
|
|
25
|
+
let e = Number.MIN_VALUE, i = Number.MAX_VALUE;
|
|
26
|
+
return s.forEach((t) => {
|
|
27
|
+
t.count > 1 && (i = Math.min(i, t.count), e = Math.max(e, t.count));
|
|
28
|
+
}), s.map((t) => {
|
|
29
|
+
if (t.id !== -1 && t.center) {
|
|
30
|
+
let r = i === e ? (this.options.maxClusterSymbolSize + this.options.minClusterSymbolSize) / 2 : this.options.minClusterSymbolSize + (t.count - i) / (e - i) * (this.options.maxClusterSymbolSize - this.options.minClusterSymbolSize);
|
|
31
|
+
return r *= 0.75, { ...t, symbolSize: r };
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 更新配置
|
|
38
|
+
*/
|
|
39
|
+
updateOptions(s) {
|
|
40
|
+
this.options = { ...this.options, ...s };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 获取当前配置
|
|
44
|
+
*/
|
|
45
|
+
getOptions() {
|
|
46
|
+
return { ...this.options };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 将地理坐标转换为屏幕坐标
|
|
50
|
+
*/
|
|
51
|
+
locationToScreen(s) {
|
|
52
|
+
this.clusteredLocations = [], s.forEach((e) => {
|
|
53
|
+
const i = this.map.getPixelFromCoordinate([e.x, e.y]), [t, r] = i || [NaN, NaN];
|
|
54
|
+
Number.isFinite(t) && Number.isFinite(r) && t > 0 && r > 0 && (e.properties = e.properties || {}, e.properties.screenX = t, e.properties.screenY = r, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 基于像素距离的聚合算法
|
|
59
|
+
*/
|
|
60
|
+
doPixelCluster(s) {
|
|
61
|
+
let e = 0;
|
|
62
|
+
for (let i = 0; i < this.clusteredLocations.length; i++) {
|
|
63
|
+
const t = this.clusteredLocations[i];
|
|
64
|
+
if (t.visited)
|
|
65
|
+
continue;
|
|
66
|
+
t.visited = !0;
|
|
67
|
+
const r = this.getNeighbors(t, s);
|
|
68
|
+
r.length < this.options.minClusterPoints ? t.clusterId = -1 : (r.forEach((o) => {
|
|
69
|
+
o.visited = !0, o.clusterId = e;
|
|
70
|
+
}), t.clusterId = e, e++);
|
|
71
|
+
}
|
|
72
|
+
return this.createClusters();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 获取指定点的邻近点
|
|
76
|
+
*/
|
|
77
|
+
getNeighbors(s, e) {
|
|
78
|
+
return this.clusteredLocations.filter((i) => i.id === s.id || i.visited ? !1 : this.getDistance(s, i) <= e);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 计算两点之间的屏幕距离
|
|
82
|
+
*/
|
|
83
|
+
getDistance(s, e) {
|
|
84
|
+
var i, t, r, o;
|
|
85
|
+
return Math.sqrt(
|
|
86
|
+
Math.pow(
|
|
87
|
+
(((i = s.properties) == null ? void 0 : i.screenX) ?? 0) - (((t = e.properties) == null ? void 0 : t.screenX) ?? 0),
|
|
88
|
+
2
|
|
89
|
+
) + Math.pow(
|
|
90
|
+
(((r = s.properties) == null ? void 0 : r.screenY) ?? 0) - (((o = e.properties) == null ? void 0 : o.screenY) ?? 0),
|
|
91
|
+
2
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 根据聚合结果创建聚合对象
|
|
97
|
+
*/
|
|
98
|
+
createClusters() {
|
|
99
|
+
const s = {}, e = [];
|
|
100
|
+
for (const t of this.clusteredLocations)
|
|
101
|
+
t.clusterId === void 0 || t.clusterId === -1 ? e.push(t) : (s[t.clusterId] || (s[t.clusterId] = []), s[t.clusterId].push(t));
|
|
102
|
+
const i = Object.keys(s).map((t) => {
|
|
103
|
+
const r = s[Number(t)], o = r.length, c = r.reduce((n, u) => n + u.x, 0), l = r.reduce((n, u) => n + u.y, 0), h = c / o, p = l / o;
|
|
104
|
+
return {
|
|
105
|
+
id: Number(t),
|
|
106
|
+
items: r,
|
|
107
|
+
count: o,
|
|
108
|
+
center: { x: h, y: p }
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
return e.length > 0 && i.push({
|
|
112
|
+
id: -1,
|
|
113
|
+
items: e,
|
|
114
|
+
count: e.length,
|
|
115
|
+
center: null
|
|
116
|
+
}), i;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
m as PixelClusterCalculator,
|
|
121
|
+
m as default
|
|
122
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { ILayerVisibleParams, IMapInitializerParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
|
|
3
|
+
export default class OlMapInitializer {
|
|
4
|
+
private mapConfig;
|
|
5
|
+
private map;
|
|
6
|
+
private mapView;
|
|
7
|
+
private pointerMoveRaf;
|
|
8
|
+
private markerClick;
|
|
9
|
+
initialize(params: IMapInitializerParams): OlMap;
|
|
10
|
+
private processUrl;
|
|
11
|
+
private loadLayers;
|
|
12
|
+
private createMap;
|
|
13
|
+
/**
|
|
14
|
+
* 设置地图中心点和缩放级别
|
|
15
|
+
* @param params
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
setMapCenter(params: ISetMapCenterParams): Promise<IResult>;
|
|
19
|
+
setMapZoom(params: {
|
|
20
|
+
zoom: number;
|
|
21
|
+
}): IResult;
|
|
22
|
+
/**
|
|
23
|
+
* 设置地图预存的相机视图
|
|
24
|
+
* @param params
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
setMapCamera(params: ISetMapCameraParams): Promise<IResult>;
|
|
28
|
+
setLayerVisibility(params: ILayerVisibleParams): Promise<IResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import p from "ol/layer/Image";
|
|
2
|
+
import c from "ol/layer/Tile";
|
|
3
|
+
import h from "ol/Map";
|
|
4
|
+
import "ol/ol.css";
|
|
5
|
+
import { Projection as l } from "ol/proj";
|
|
6
|
+
import { ImageWMS as w, WMTS as f, TileWMS as g, XYZ as d } from "ol/source";
|
|
7
|
+
import { TileGrid as z } from "ol/tilegrid";
|
|
8
|
+
import S from "ol/tilegrid/WMTS";
|
|
9
|
+
import M from "ol/View";
|
|
10
|
+
class I {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.mapConfig = {}, this.pointerMoveRaf = null;
|
|
13
|
+
}
|
|
14
|
+
initialize(e) {
|
|
15
|
+
return this.mapConfig = e.mapConfig || {}, this.markerClick = e.markerClickCallback, this.map = this.createMap(e.container), this.mapConfig.baseLayers && this.loadLayers(this.mapConfig.baseLayers), this.map;
|
|
16
|
+
}
|
|
17
|
+
processUrl(e) {
|
|
18
|
+
return e && (e.startsWith("http://") || e.startsWith("https://") ? e : e.startsWith("{{") ? e.replace("{{geoServer}}", this.mapConfig.geoServer) : e);
|
|
19
|
+
}
|
|
20
|
+
loadLayers(e) {
|
|
21
|
+
if (!this.map)
|
|
22
|
+
return;
|
|
23
|
+
const i = 1 / 0, s = 16384;
|
|
24
|
+
e.forEach((t) => {
|
|
25
|
+
var o, a;
|
|
26
|
+
(o = t.source) != null && o.url && (t.source.url = this.processUrl(t.source.url));
|
|
27
|
+
let r;
|
|
28
|
+
switch (t.type.toLowerCase()) {
|
|
29
|
+
case "webtile": {
|
|
30
|
+
console.log(t), r = new c({
|
|
31
|
+
preload: i,
|
|
32
|
+
cacheSize: s,
|
|
33
|
+
source: new d({
|
|
34
|
+
url: t.source.url,
|
|
35
|
+
projection: t.source.projection || "EPSG:4326",
|
|
36
|
+
tileSize: t.source.tileSize || 256
|
|
37
|
+
// minZoom: layerConfig.source.minZoom,
|
|
38
|
+
// maxZoom: layerConfig.source.maxZoom,
|
|
39
|
+
// crossOrigin: layerConfig.source.crossOrigin || 'anonymous'
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "gwc-wms": {
|
|
45
|
+
r = new c({
|
|
46
|
+
preload: i,
|
|
47
|
+
cacheSize: s,
|
|
48
|
+
source: new g({
|
|
49
|
+
...t.source,
|
|
50
|
+
tileGrid: new z({
|
|
51
|
+
...t.source.tileGrid
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
...t.options
|
|
55
|
+
});
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "wmts": {
|
|
59
|
+
const n = t.source.matrixSet || "", m = Array.from(
|
|
60
|
+
{ length: 22 },
|
|
61
|
+
(V, u) => `${n}:${u}`
|
|
62
|
+
);
|
|
63
|
+
r = new c({
|
|
64
|
+
preload: i,
|
|
65
|
+
cacheSize: s,
|
|
66
|
+
source: new f({
|
|
67
|
+
...t.source,
|
|
68
|
+
format: "image/png",
|
|
69
|
+
projection: new l({
|
|
70
|
+
code: t.source.projection || "EPSG:4326"
|
|
71
|
+
}),
|
|
72
|
+
tileGrid: new S({
|
|
73
|
+
resolutions: [
|
|
74
|
+
1.4078260157100582,
|
|
75
|
+
0.703913007855028,
|
|
76
|
+
0.35195650392751515,
|
|
77
|
+
0.17597825196375638,
|
|
78
|
+
0.08798912598187819,
|
|
79
|
+
0.043994562990939096,
|
|
80
|
+
0.021997281495469548,
|
|
81
|
+
0.010998640747734774,
|
|
82
|
+
0.005499320373868577,
|
|
83
|
+
0.0027496601869330985,
|
|
84
|
+
0.001374830093467739,
|
|
85
|
+
6874150467326798e-19,
|
|
86
|
+
3437075233663399e-19,
|
|
87
|
+
17185376168316996e-20,
|
|
88
|
+
8592688084158498e-20,
|
|
89
|
+
4296344042198222e-20,
|
|
90
|
+
2148172021099111e-20,
|
|
91
|
+
10740860104305824e-21,
|
|
92
|
+
53704300533426425e-22,
|
|
93
|
+
2685215025481591e-21,
|
|
94
|
+
13426075127407955e-22,
|
|
95
|
+
6713037563703978e-22
|
|
96
|
+
],
|
|
97
|
+
matrixIds: m,
|
|
98
|
+
tileSize: 256,
|
|
99
|
+
origin: [-400, 400]
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
...t.options
|
|
103
|
+
});
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case "image-wms": {
|
|
107
|
+
r = new p({
|
|
108
|
+
source: new w({ ...t.source }),
|
|
109
|
+
...t.options
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
r && (r.set("id", t.id), r.set("group", t.group), (a = this.map) == null || a.addLayer(r));
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
createMap(e) {
|
|
118
|
+
const i = this.mapConfig.view;
|
|
119
|
+
this.mapView = new M({ ...i }), this.mapConfig.camera ? this.mapConfig.camera.home = i : this.mapConfig.camera = {
|
|
120
|
+
home: i
|
|
121
|
+
};
|
|
122
|
+
const s = new h({
|
|
123
|
+
target: e,
|
|
124
|
+
view: this.mapView
|
|
125
|
+
});
|
|
126
|
+
return s.on("pointermove", (t) => {
|
|
127
|
+
t.dragging || this.pointerMoveRaf === null && (this.pointerMoveRaf = requestAnimationFrame(() => {
|
|
128
|
+
const r = s.hasFeatureAtPixel(t.pixel), o = s.getTargetElement();
|
|
129
|
+
o && (o.style.cursor = r ? "pointer" : ""), this.pointerMoveRaf = null;
|
|
130
|
+
}));
|
|
131
|
+
}), s.on("click", (t) => {
|
|
132
|
+
const r = s.forEachFeatureAtPixel(t.pixel, (o) => o);
|
|
133
|
+
if (r && this.markerClick) {
|
|
134
|
+
const o = r.get("type") ?? "", a = r.get("id") ?? "", n = r.getProperties();
|
|
135
|
+
this.markerClick(o, a, n, t);
|
|
136
|
+
}
|
|
137
|
+
}), s;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 设置地图中心点和缩放级别
|
|
141
|
+
* @param params
|
|
142
|
+
* @returns
|
|
143
|
+
*/
|
|
144
|
+
async setMapCenter(e) {
|
|
145
|
+
return this.map ? new Promise((i) => {
|
|
146
|
+
e.duration && e.duration > 0 ? this.mapView.animate(
|
|
147
|
+
{
|
|
148
|
+
center: e.center || this.mapView.getCenter(),
|
|
149
|
+
zoom: e.zoom || this.mapView.getZoom(),
|
|
150
|
+
duration: e.duration * 1e3
|
|
151
|
+
},
|
|
152
|
+
() => {
|
|
153
|
+
i({ status: 0, message: "成功" });
|
|
154
|
+
}
|
|
155
|
+
) : (e.zoom && this.mapView.setZoom(e.zoom), e.center && this.mapView.setCenter(e.center), i({ status: 0, message: "成功" }));
|
|
156
|
+
}) : { status: -1, message: "地图未初始化" };
|
|
157
|
+
}
|
|
158
|
+
setMapZoom(e) {
|
|
159
|
+
return this.map ? (this.mapView.setZoom(e.zoom), { status: 0, message: "成功" }) : { status: -1, message: "地图未初始化" };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 设置地图预存的相机视图
|
|
163
|
+
* @param params
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
async setMapCamera(e) {
|
|
167
|
+
if (!this.map)
|
|
168
|
+
return { status: -1, message: "地图未初始化" };
|
|
169
|
+
const i = this.mapConfig.camera[e.name];
|
|
170
|
+
return i ? await this.setMapCenter({
|
|
171
|
+
center: i.center,
|
|
172
|
+
zoom: e.zoom || i.zoom,
|
|
173
|
+
duration: e.duration || 0
|
|
174
|
+
}) : { status: -1, message: `未找到名称为 ${e.name} 的相机视图` };
|
|
175
|
+
}
|
|
176
|
+
async setLayerVisibility(e) {
|
|
177
|
+
const i = this.map.getLayers().getArray().filter((s) => s.get("id") === e.id || s.get("group") === e.id);
|
|
178
|
+
return i.length > 0 ? (i.forEach((s) => s.setVisible(e.visible)), { status: 0, message: "成功" }) : { status: -1, message: `未找到ID为 ${e.id} 的图层` };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
I as default
|
|
183
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as OlMap } from 'ol/Map';
|
|
2
|
+
import { IClusterPointParams } from '../../../types';
|
|
3
|
+
export default class ClusterPointController {
|
|
4
|
+
private map;
|
|
5
|
+
private clusterLayer;
|
|
6
|
+
private source;
|
|
7
|
+
private view;
|
|
8
|
+
private clusterCalculator;
|
|
9
|
+
private countBackgroundColor;
|
|
10
|
+
private countFontColor;
|
|
11
|
+
private locations;
|
|
12
|
+
private clusterMarkUrl;
|
|
13
|
+
private viewChangeKey;
|
|
14
|
+
private mapMoveKey;
|
|
15
|
+
private resolutionChangeTimeout;
|
|
16
|
+
constructor(map: OlMap);
|
|
17
|
+
addClusterPoints(params: IClusterPointParams): void;
|
|
18
|
+
removeAllClusterPoints(): void;
|
|
19
|
+
private configureVectorLayerStyle;
|
|
20
|
+
private getClusterStyle;
|
|
21
|
+
private showClusterResult;
|
|
22
|
+
private calculateCluster;
|
|
23
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import r from "ol/Feature";
|
|
2
|
+
import i from "ol/geom/Point";
|
|
3
|
+
import a from "ol/layer/Vector";
|
|
4
|
+
import { unByKey as l } from "ol/Observable";
|
|
5
|
+
import m from "ol/source/Vector";
|
|
6
|
+
import n from "ol/style/Fill";
|
|
7
|
+
import y from "ol/style/Icon";
|
|
8
|
+
import g from "ol/style/Stroke";
|
|
9
|
+
import u from "ol/style/Style";
|
|
10
|
+
import C from "ol/style/Text";
|
|
11
|
+
import { PixelClusterCalculator as f } from "../cluster/pixel-cluster-calculator.mjs";
|
|
12
|
+
import { getPointStyle as c } from "../style/point-style.mjs";
|
|
13
|
+
class L {
|
|
14
|
+
constructor(e) {
|
|
15
|
+
this.countBackgroundColor = [2, 72, 200, 0.8], this.countFontColor = [255, 255, 255, 1], this.locations = [], this.clusterMarkUrl = "", this.viewChangeKey = null, this.mapMoveKey = null, this.resolutionChangeTimeout = null, this.map = e, this.view = e.getView(), this.clusterCalculator = new f(e), this.source = new m(), this.clusterLayer = new a({
|
|
16
|
+
source: this.source
|
|
17
|
+
}), this.clusterLayer.set("id", "cluster-points-layer"), this.map.addLayer(this.clusterLayer), this.configureVectorLayerStyle();
|
|
18
|
+
}
|
|
19
|
+
addClusterPoints(e) {
|
|
20
|
+
var t;
|
|
21
|
+
this.clusterMarkUrl = ((t = e.clusterSymbol) == null ? void 0 : t.url) || "/GisViewerAssets/Images/cross/gis_xhj_blue.png", this.countBackgroundColor = e.countBackgroundColor || this.countBackgroundColor, this.countFontColor = e.countFontColor || this.countFontColor, this.locations = e.points, this.locations.forEach((o) => {
|
|
22
|
+
o.symbol = o.symbol || e.pointSymbol;
|
|
23
|
+
}), this.viewChangeKey || (this.viewChangeKey = this.view.on("change:resolution", () => {
|
|
24
|
+
this.resolutionChangeTimeout && clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = setTimeout(() => {
|
|
25
|
+
this.calculateCluster();
|
|
26
|
+
}, 150);
|
|
27
|
+
})), this.mapMoveKey || (this.mapMoveKey = this.map.on("moveend", () => {
|
|
28
|
+
this.calculateCluster();
|
|
29
|
+
})), this.calculateCluster();
|
|
30
|
+
}
|
|
31
|
+
removeAllClusterPoints() {
|
|
32
|
+
this.source.clear(), this.viewChangeKey && (l(this.viewChangeKey), this.viewChangeKey = null), this.mapMoveKey && (l(this.mapMoveKey), this.mapMoveKey = null), this.resolutionChangeTimeout && (clearTimeout(this.resolutionChangeTimeout), this.resolutionChangeTimeout = null);
|
|
33
|
+
}
|
|
34
|
+
configureVectorLayerStyle() {
|
|
35
|
+
const e = this.view.getResolutionForZoom(18);
|
|
36
|
+
this.clusterLayer.setStyle((t, o) => {
|
|
37
|
+
const s = t.get("type");
|
|
38
|
+
if (o <= e)
|
|
39
|
+
return c(t.getProperties().symbol);
|
|
40
|
+
if (s === "cluster-point")
|
|
41
|
+
return c(t.getProperties().symbol);
|
|
42
|
+
if (s === "cluster-cluster")
|
|
43
|
+
return this.getClusterStyle(t.getProperties());
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
getClusterStyle(e) {
|
|
47
|
+
const t = e.clusterSymbolSize, o = new y({
|
|
48
|
+
src: this.clusterMarkUrl,
|
|
49
|
+
scale: t / 32
|
|
50
|
+
// 近似缩放
|
|
51
|
+
}), s = -(t + 10), h = new C({
|
|
52
|
+
text: String(e.count ?? 0),
|
|
53
|
+
font: "16px Arial Unicode MS",
|
|
54
|
+
fill: new n({ color: this.countFontColor }),
|
|
55
|
+
backgroundFill: new n({ color: this.countBackgroundColor }),
|
|
56
|
+
backgroundStroke: new g({
|
|
57
|
+
color: [
|
|
58
|
+
this.countBackgroundColor[0],
|
|
59
|
+
this.countBackgroundColor[1],
|
|
60
|
+
this.countBackgroundColor[2],
|
|
61
|
+
0.5
|
|
62
|
+
],
|
|
63
|
+
width: 4
|
|
64
|
+
}),
|
|
65
|
+
padding: [1, 2, 1, 2],
|
|
66
|
+
offsetY: s,
|
|
67
|
+
textAlign: "center",
|
|
68
|
+
justify: "center",
|
|
69
|
+
textBaseline: "middle"
|
|
70
|
+
});
|
|
71
|
+
return [new u({ image: o }), new u({ text: h })];
|
|
72
|
+
}
|
|
73
|
+
showClusterResult(e) {
|
|
74
|
+
this.source.clear(), e.forEach((t) => {
|
|
75
|
+
if (t.id !== -1 && t.center && t.symbolSize) {
|
|
76
|
+
const o = new r({
|
|
77
|
+
geometry: new i([t.center.x, t.center.y]),
|
|
78
|
+
type: "cluster-cluster",
|
|
79
|
+
count: t.count,
|
|
80
|
+
clusterSymbolSize: t.symbolSize
|
|
81
|
+
});
|
|
82
|
+
this.source.addFeature(o);
|
|
83
|
+
} else
|
|
84
|
+
t.items.forEach((o) => {
|
|
85
|
+
const s = new r({
|
|
86
|
+
...o.properties,
|
|
87
|
+
geometry: new i([o.x, o.y]),
|
|
88
|
+
type: "cluster-point",
|
|
89
|
+
symbol: o.symbol
|
|
90
|
+
});
|
|
91
|
+
this.source.addFeature(s);
|
|
92
|
+
});
|
|
93
|
+
}), this.clusterLayer.changed();
|
|
94
|
+
}
|
|
95
|
+
calculateCluster() {
|
|
96
|
+
const e = this.clusterCalculator.calculate(this.locations), t = this.clusterCalculator.calculateSymbolSizes(e);
|
|
97
|
+
this.showClusterResult(t);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
L as default
|
|
102
|
+
};
|