ym-giswidget-2d 1.0.5 → 1.0.7
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/_virtual/_commonjs-dynamic-modules.js +6 -0
- package/_virtual/_commonjsHelpers.js +8 -0
- package/_virtual/jszip.min.js +4 -0
- package/components/clear/Clear.vue.d.ts +6 -0
- package/components/clear/Clear.vue.js +19 -0
- package/components/clear/Clear.vue2.js +4 -0
- package/components/clear/index.d.ts +6 -0
- package/components/clear/index.js +8 -0
- package/components/draw/Draw.vue.d.ts +6 -0
- package/components/draw/Draw.vue.js +71 -0
- package/components/draw/Draw.vue2.js +4 -0
- package/components/draw/index.d.ts +6 -0
- package/components/draw/index.js +8 -0
- package/components/export/Export.vue.d.ts +154 -0
- package/components/export/Export.vue.js +7 -0
- package/components/export/Export.vue2.js +298 -0
- package/components/export/index.css +3 -0
- package/components/export/index.d.ts +154 -0
- package/components/export/index.js +8 -0
- package/components/horizontally-top-toolbar/{horizontallyTopToolbar.vue.js → HorizontallyTopToolbar.vue.js} +2 -2
- package/components/horizontally-top-toolbar/{horizontallyTopToolbar.vue2.js → HorizontallyTopToolbar.vue2.js} +3 -3
- package/components/horizontally-top-toolbar/index.css +9 -9
- package/components/horizontally-top-toolbar/index.js +1 -1
- package/components/identify/Identify.vue.d.ts +13 -0
- package/components/identify/Identify.vue.js +96 -0
- package/components/identify/Identify.vue2.js +4 -0
- package/components/identify/index.d.ts +18 -0
- package/components/identify/index.js +8 -0
- package/components/import/Import.vue.d.ts +13 -0
- package/components/import/Import.vue.js +162 -0
- package/components/import/Import.vue2.js +4 -0
- package/components/import/index.d.ts +15 -0
- package/components/import/index.js +8 -0
- package/components/layer-tree/{layerTree.vue.d.ts → LayerTree.vue.d.ts} +212 -186
- package/components/layer-tree/{layerTree.vue.js → LayerTree.vue.js} +2 -2
- package/components/layer-tree/{layerTree.vue2.js → LayerTree.vue2.js} +2 -2
- package/components/layer-tree/index.css +11 -11
- package/components/layer-tree/index.d.ts +194 -184
- package/components/layer-tree/index.js +1 -1
- package/components/multi-screen/MultiScreen.vue.d.ts +425 -0
- package/components/multi-screen/MultiScreen.vue2.js +1 -1
- package/components/multi-screen/index.d.ts +426 -0
- package/components/multi-screen-panel/PanelMultiScreen.vue2.js +1 -1
- package/components/popup/Popup.vue.d.ts +158 -0
- package/components/popup/Popup.vue.js +8 -0
- package/components/popup/Popup.vue2.js +266 -0
- package/components/popup/index.css +61 -0
- package/components/popup/index.d.ts +157 -0
- package/components/popup/index.js +8 -0
- package/components/popup/index2.css +5 -0
- package/components/select/Select.vue.d.ts +13 -0
- package/components/select/Select.vue.js +142 -0
- package/components/select/Select.vue2.js +4 -0
- package/components/select/index.d.ts +18 -0
- package/components/select/index.js +8 -0
- package/components/swipe-layer/SwipeLayer.vue.d.ts +6 -0
- package/components/swipe-layer/SwipeLayer.vue.js +24 -0
- package/components/swipe-layer/SwipeLayer.vue2.js +4 -0
- package/components/swipe-layer/index.d.ts +6 -0
- package/components/swipe-layer/index.js +8 -0
- package/components/toc-card/{tocCard.vue.js → TocCard.vue.js} +2 -2
- package/components/toc-card/{tocCard.vue2.js → TocCard.vue2.js} +2 -2
- package/components/toc-card/index.css +1 -1
- package/components/toc-card/index.js +1 -1
- package/config/Config.d.ts +13 -0
- package/config/Config.js +8 -0
- package/css/index.css +64 -14
- package/http/Axios.d.ts +14 -0
- package/http/Axios.js +37 -0
- package/http/LayerField.js +29 -0
- package/http/SpaceFile.d.ts +3 -0
- package/http/SpaceFile.js +38 -0
- package/http/layerField.d.ts +19 -0
- package/index.d.ts +7 -0
- package/index.js +14 -0
- package/package.json +2 -2
- package/panel/DraggablePanel.vue.d.ts +82 -0
- package/panel/DraggablePanel.vue2.js +1 -1
- /package/components/horizontally-top-toolbar/{horizontallyTopToolbar.vue.d.ts → HorizontallyTopToolbar.vue.d.ts} +0 -0
- /package/components/toc-card/{tocCard.vue.d.ts → TocCard.vue.d.ts} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function commonjsRequire(path) {
|
|
2
|
+
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3
|
+
}
|
|
4
|
+
export {
|
|
5
|
+
commonjsRequire
|
|
6
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
2
|
+
function getDefaultExportFromCjs(x) {
|
|
3
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
commonjsGlobal,
|
|
7
|
+
getDefaultExportFromCjs
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as OLMap } from 'ym-giscomm-2d/mapView/Map';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
map: OLMap;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineComponent, onMounted } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "Clear",
|
|
4
|
+
props: {
|
|
5
|
+
map: {}
|
|
6
|
+
},
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const props = __props;
|
|
9
|
+
onMounted(() => {
|
|
10
|
+
props.map.clearTempFeatures();
|
|
11
|
+
});
|
|
12
|
+
return (_ctx, _cache) => {
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
_sfc_main as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const Clear: import('../../utils').WithInstall<import('vue').DefineComponent<{
|
|
2
|
+
map: import('ym-giscomm-2d/mapView/Map').default;
|
|
3
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
4
|
+
map: import('ym-giscomm-2d/mapView/Map').default;
|
|
5
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>>;
|
|
6
|
+
export default Clear;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as OLMap } from 'ym-giscomm-2d/mapView/Map';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
map: OLMap;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineComponent, onMounted, onUnmounted } from "vue";
|
|
2
|
+
import Draw from "ym-giscomm-2d/interaction/Draw";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "Draw",
|
|
5
|
+
props: {
|
|
6
|
+
map: {}
|
|
7
|
+
},
|
|
8
|
+
setup(__props) {
|
|
9
|
+
const props = __props;
|
|
10
|
+
onMounted(() => {
|
|
11
|
+
const currentLayerInfo = props.map.currentEditLayer;
|
|
12
|
+
let geometryType = "polygon";
|
|
13
|
+
if (currentLayerInfo && currentLayerInfo.geometryType) {
|
|
14
|
+
switch (currentLayerInfo.geometryType) {
|
|
15
|
+
case 1:
|
|
16
|
+
geometryType = "point";
|
|
17
|
+
break;
|
|
18
|
+
case 2:
|
|
19
|
+
geometryType = "polyline";
|
|
20
|
+
break;
|
|
21
|
+
case 3:
|
|
22
|
+
geometryType = "polygon";
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const tempLayer = getTempLayerByGeometryType(geometryType);
|
|
27
|
+
let source = void 0;
|
|
28
|
+
const layersource = tempLayer == null ? void 0 : tempLayer.getSource();
|
|
29
|
+
if (layersource) {
|
|
30
|
+
source = layersource;
|
|
31
|
+
}
|
|
32
|
+
const draw = new Draw(geometryType, {
|
|
33
|
+
source
|
|
34
|
+
});
|
|
35
|
+
props.map.interactionManager.addInteraction("draw", draw);
|
|
36
|
+
draw.on("drawend", (event) => {
|
|
37
|
+
const features = event.feature;
|
|
38
|
+
if (features) {
|
|
39
|
+
features.isSelected = true;
|
|
40
|
+
features.tempLayer = tempLayer;
|
|
41
|
+
features.fromType = "draw";
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
onUnmounted(() => {
|
|
46
|
+
props.map.interactionManager.removeInteraction("draw");
|
|
47
|
+
});
|
|
48
|
+
function getTempLayerByGeometryType(geometryType) {
|
|
49
|
+
switch (geometryType) {
|
|
50
|
+
case "point":
|
|
51
|
+
return props.map.getPointTempLayer();
|
|
52
|
+
case "polyline":
|
|
53
|
+
return props.map.getLineTempLayer();
|
|
54
|
+
case "polygon":
|
|
55
|
+
return props.map.getPolygonTempLayer();
|
|
56
|
+
case "rectangle":
|
|
57
|
+
return props.map.getPolygonTempLayer();
|
|
58
|
+
case "circle":
|
|
59
|
+
return props.map.getPolygonTempLayer();
|
|
60
|
+
default:
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return (_ctx, _cache) => {
|
|
65
|
+
return null;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
_sfc_main as default
|
|
71
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const Draw: import('../../utils').WithInstall<import('vue').DefineComponent<{
|
|
2
|
+
map: import('ym-giscomm-2d/mapView/Map').default;
|
|
3
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
4
|
+
map: import('ym-giscomm-2d/mapView/Map').default;
|
|
5
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>>;
|
|
6
|
+
export default Draw;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { default as OLMap } from 'ym-giscomm-2d/mapView/Map';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
map: OLMap;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
+
activeInteraction: (...args: any[]) => void;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
+
onActiveInteraction?: ((...args: any[]) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
10
|
+
popupDom: ({
|
|
11
|
+
$: import('vue').ComponentInternalInstance;
|
|
12
|
+
$data: {};
|
|
13
|
+
$props: {
|
|
14
|
+
readonly title?: string | undefined;
|
|
15
|
+
readonly width?: number | undefined;
|
|
16
|
+
readonly height?: number | undefined;
|
|
17
|
+
readonly minWidth?: number | undefined;
|
|
18
|
+
readonly minHeight?: number | undefined;
|
|
19
|
+
readonly resizable?: boolean | undefined;
|
|
20
|
+
readonly showClose?: boolean | undefined;
|
|
21
|
+
readonly showMinimize?: boolean | undefined;
|
|
22
|
+
readonly showMaximize?: boolean | undefined;
|
|
23
|
+
readonly showDock?: boolean | undefined;
|
|
24
|
+
readonly drag?: boolean | undefined;
|
|
25
|
+
readonly showOk?: boolean | undefined;
|
|
26
|
+
readonly showCancel?: boolean | undefined;
|
|
27
|
+
readonly okText?: string | undefined;
|
|
28
|
+
readonly cancelText?: string | undefined;
|
|
29
|
+
readonly onClose?: ((...args: any[]) => any) | undefined;
|
|
30
|
+
readonly onResize?: ((...args: any[]) => any) | undefined;
|
|
31
|
+
readonly onMove?: ((...args: any[]) => any) | undefined;
|
|
32
|
+
readonly onOk?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
34
|
+
$attrs: {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
$refs: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} & {
|
|
40
|
+
panelRef: HTMLDivElement;
|
|
41
|
+
};
|
|
42
|
+
$slots: Readonly<{
|
|
43
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
$root: import('vue').ComponentPublicInstance | null;
|
|
46
|
+
$parent: import('vue').ComponentPublicInstance | null;
|
|
47
|
+
$host: Element | null;
|
|
48
|
+
$emit: ((event: "close", ...args: any[]) => void) & ((event: "resize", ...args: any[]) => void) & ((event: "move", ...args: any[]) => void) & ((event: "ok", ...args: any[]) => void);
|
|
49
|
+
$el: HTMLDivElement;
|
|
50
|
+
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
51
|
+
title?: string;
|
|
52
|
+
width?: number;
|
|
53
|
+
height?: number;
|
|
54
|
+
minWidth?: number;
|
|
55
|
+
minHeight?: number;
|
|
56
|
+
resizable?: boolean;
|
|
57
|
+
showClose?: boolean;
|
|
58
|
+
showMinimize?: boolean;
|
|
59
|
+
showMaximize?: boolean;
|
|
60
|
+
showDock?: boolean;
|
|
61
|
+
drag?: boolean;
|
|
62
|
+
showOk?: boolean;
|
|
63
|
+
showCancel?: boolean;
|
|
64
|
+
okText?: string;
|
|
65
|
+
cancelText?: string;
|
|
66
|
+
}> & Readonly<{
|
|
67
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
68
|
+
onResize?: ((...args: any[]) => any) | undefined;
|
|
69
|
+
onMove?: ((...args: any[]) => any) | undefined;
|
|
70
|
+
onOk?: ((...args: any[]) => any) | undefined;
|
|
71
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
72
|
+
close: (...args: any[]) => void;
|
|
73
|
+
resize: (...args: any[]) => void;
|
|
74
|
+
move: (...args: any[]) => void;
|
|
75
|
+
ok: (...args: any[]) => void;
|
|
76
|
+
}, string, {
|
|
77
|
+
title: string;
|
|
78
|
+
showClose: boolean;
|
|
79
|
+
drag: boolean;
|
|
80
|
+
minWidth: number;
|
|
81
|
+
minHeight: number;
|
|
82
|
+
resizable: boolean;
|
|
83
|
+
showMinimize: boolean;
|
|
84
|
+
showMaximize: boolean;
|
|
85
|
+
showDock: boolean;
|
|
86
|
+
showOk: boolean;
|
|
87
|
+
showCancel: boolean;
|
|
88
|
+
okText: string;
|
|
89
|
+
cancelText: string;
|
|
90
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
|
91
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
92
|
+
created?: (() => void) | (() => void)[];
|
|
93
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
94
|
+
mounted?: (() => void) | (() => void)[];
|
|
95
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
96
|
+
updated?: (() => void) | (() => void)[];
|
|
97
|
+
activated?: (() => void) | (() => void)[];
|
|
98
|
+
deactivated?: (() => void) | (() => void)[];
|
|
99
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
100
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
101
|
+
destroyed?: (() => void) | (() => void)[];
|
|
102
|
+
unmounted?: (() => void) | (() => void)[];
|
|
103
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
104
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
105
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
106
|
+
};
|
|
107
|
+
$forceUpdate: () => void;
|
|
108
|
+
$nextTick: typeof import('vue').nextTick;
|
|
109
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
110
|
+
} & Readonly<{
|
|
111
|
+
title: string;
|
|
112
|
+
showClose: boolean;
|
|
113
|
+
drag: boolean;
|
|
114
|
+
minWidth: number;
|
|
115
|
+
minHeight: number;
|
|
116
|
+
resizable: boolean;
|
|
117
|
+
showMinimize: boolean;
|
|
118
|
+
showMaximize: boolean;
|
|
119
|
+
showDock: boolean;
|
|
120
|
+
showOk: boolean;
|
|
121
|
+
showCancel: boolean;
|
|
122
|
+
okText: string;
|
|
123
|
+
cancelText: string;
|
|
124
|
+
}> & Omit<Readonly<{
|
|
125
|
+
title?: string;
|
|
126
|
+
width?: number;
|
|
127
|
+
height?: number;
|
|
128
|
+
minWidth?: number;
|
|
129
|
+
minHeight?: number;
|
|
130
|
+
resizable?: boolean;
|
|
131
|
+
showClose?: boolean;
|
|
132
|
+
showMinimize?: boolean;
|
|
133
|
+
showMaximize?: boolean;
|
|
134
|
+
showDock?: boolean;
|
|
135
|
+
drag?: boolean;
|
|
136
|
+
showOk?: boolean;
|
|
137
|
+
showCancel?: boolean;
|
|
138
|
+
okText?: string;
|
|
139
|
+
cancelText?: string;
|
|
140
|
+
}> & Readonly<{
|
|
141
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
142
|
+
onResize?: ((...args: any[]) => any) | undefined;
|
|
143
|
+
onMove?: ((...args: any[]) => any) | undefined;
|
|
144
|
+
onOk?: ((...args: any[]) => any) | undefined;
|
|
145
|
+
}>, "title" | "showClose" | "drag" | "minWidth" | "minHeight" | "resizable" | "showMinimize" | "showMaximize" | "showDock" | "showOk" | "showCancel" | "okText" | "cancelText"> & import('vue').ShallowUnwrapRef<{}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
146
|
+
$slots: {
|
|
147
|
+
header?(_: {}): any;
|
|
148
|
+
default?(_: {}): any;
|
|
149
|
+
footer?(_: {}): any;
|
|
150
|
+
};
|
|
151
|
+
}) | null;
|
|
152
|
+
formRef: unknown;
|
|
153
|
+
}, HTMLDivElement>;
|
|
154
|
+
export default _default;
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { ElForm, ElFormItem, ElSelect, ElOption, ElInput } from "element-plus/es";
|
|
2
|
+
import "element-plus/es/components/base/style/css";
|
|
3
|
+
import "element-plus/es/components/form/style/css";
|
|
4
|
+
import "element-plus/es/components/input/style/css";
|
|
5
|
+
import "element-plus/es/components/form-item/style/css";
|
|
6
|
+
import "element-plus/es/components/select/style/css";
|
|
7
|
+
import "element-plus/es/components/option/style/css";
|
|
8
|
+
import { defineComponent, reactive, ref, onMounted, onUnmounted, withDirectives, createBlock, openBlock, withCtx, createVNode, unref, createCommentVNode, createElementBlock, Fragment, renderList, vShow } from "vue";
|
|
9
|
+
import DraggablePanel from "../../panel/DraggablePanel.vue.js";
|
|
10
|
+
import FeatureManager from "ym-giscomm-2d/feature/FeatureManager";
|
|
11
|
+
import { toKml } from "ym-giscomm-2d/conver/kml";
|
|
12
|
+
import GeoJSON from "../../node_modules/.pnpm/ol@9.2.4/node_modules/ol/format/GeoJSON.js";
|
|
13
|
+
import { downloadBlob } from "ym-giscomm-2d/utils/UrlUtil";
|
|
14
|
+
import JSZip from "../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js";
|
|
15
|
+
import { exportFeatures } from "../../http/SpaceFile.js";
|
|
16
|
+
import { ElLoading, ElMessage } from "element-plus";
|
|
17
|
+
import { base64ToBlob } from "ym-giscomm-2d/utils/StringUtil";
|
|
18
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "Export",
|
|
20
|
+
props: {
|
|
21
|
+
map: {}
|
|
22
|
+
},
|
|
23
|
+
emits: ["activeInteraction"],
|
|
24
|
+
setup(__props, { emit: __emit }) {
|
|
25
|
+
const emit = __emit;
|
|
26
|
+
const props = __props;
|
|
27
|
+
let reactiveValue = reactive({
|
|
28
|
+
visible: true,
|
|
29
|
+
exportType: "shp",
|
|
30
|
+
fileName: "",
|
|
31
|
+
exportLayer: null,
|
|
32
|
+
layerInfos: []
|
|
33
|
+
});
|
|
34
|
+
const formRef = ref();
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
init();
|
|
37
|
+
});
|
|
38
|
+
onUnmounted(() => {
|
|
39
|
+
reactiveValue.visible = false;
|
|
40
|
+
});
|
|
41
|
+
function handleClose() {
|
|
42
|
+
reactiveValue.visible = false;
|
|
43
|
+
}
|
|
44
|
+
function handleOk() {
|
|
45
|
+
if (!formRef || !formRef.value) return;
|
|
46
|
+
formRef.value.validate(async (valid) => {
|
|
47
|
+
if (valid) {
|
|
48
|
+
const loadingInstance = ElLoading.service({ text: "正在导出...", background: "rgba(0, 0, 0, 0.5)", target: props.map.getTarget() });
|
|
49
|
+
try {
|
|
50
|
+
if (reactiveValue.exportType == "shp") {
|
|
51
|
+
await exportShp();
|
|
52
|
+
} else if (reactiveValue.exportType == "kml") {
|
|
53
|
+
const kml = exportKml();
|
|
54
|
+
const blob = new Blob([kml]);
|
|
55
|
+
downloadBlob(blob, reactiveValue.fileName + ".kml");
|
|
56
|
+
} else if (reactiveValue.exportType == "kmz") {
|
|
57
|
+
const kml = exportKml();
|
|
58
|
+
const zip = new JSZip();
|
|
59
|
+
zip.file(reactiveValue.fileName + ".kml", kml);
|
|
60
|
+
const blob = await zip.generateAsync({
|
|
61
|
+
type: "blob"
|
|
62
|
+
});
|
|
63
|
+
downloadBlob(blob, reactiveValue.fileName + ".kmz");
|
|
64
|
+
} else {
|
|
65
|
+
ElMessage.error("不支持的文件格式");
|
|
66
|
+
}
|
|
67
|
+
ElMessage.success("导出成功");
|
|
68
|
+
loadingInstance.close();
|
|
69
|
+
} catch (error) {
|
|
70
|
+
loadingInstance.close();
|
|
71
|
+
ElMessage.error("导出失败");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function init() {
|
|
77
|
+
const featureManager = new FeatureManager(props.map);
|
|
78
|
+
const features = featureManager.getSelectedFeatures(void 0, true);
|
|
79
|
+
if (!features || features.length == 0) {
|
|
80
|
+
emit("activeInteraction", { success: false, message: "请先选择要素" });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
reactiveValue.layerInfos = getLayerInfos(features);
|
|
84
|
+
}
|
|
85
|
+
function getLayerInfos(features) {
|
|
86
|
+
if (!features || features.length === 0) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
const layerIds = features.map((feature) => feature.layerId ?? "");
|
|
90
|
+
if (!layerIds || layerIds.length == 0) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
const uniqueArr = Array.from(new Set(layerIds));
|
|
94
|
+
const layers = props.map.getLayersByIds(uniqueArr);
|
|
95
|
+
let layerInfos = [];
|
|
96
|
+
if (layers && layers.length > 0) {
|
|
97
|
+
for (let i = 0; i < layers.length; i++) {
|
|
98
|
+
const layer = layers[i];
|
|
99
|
+
if (!layer) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const layerInfo = { ...layer.layerInfo, features: [] };
|
|
103
|
+
const newfeatures = features.filter((t) => t.layerId == layerInfo.id);
|
|
104
|
+
layerInfo.features = newfeatures;
|
|
105
|
+
layerInfos.push(layerInfo);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
let tempPointLayerInfo = { id: "tempPoint", title: "临时点要素", features: [] };
|
|
109
|
+
let tempLineLayerInfo = { id: "tempLine", title: "临时线要素", features: [] };
|
|
110
|
+
let tempPolygonLayerInfo = { id: "tempPolygon", title: "临时面要素", features: [] };
|
|
111
|
+
for (let i = 0, length = features.length; i < length; i++) {
|
|
112
|
+
const feature = features[i];
|
|
113
|
+
if (feature.layerId) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const geometry = feature.getGeometry();
|
|
117
|
+
if (!geometry) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const type = geometry.getType();
|
|
121
|
+
switch (type) {
|
|
122
|
+
case "Point":
|
|
123
|
+
case "MultiPoint":
|
|
124
|
+
tempPointLayerInfo.features.push(feature);
|
|
125
|
+
break;
|
|
126
|
+
case "LineString":
|
|
127
|
+
case "MultiLineString":
|
|
128
|
+
tempLineLayerInfo.features.push(feature);
|
|
129
|
+
break;
|
|
130
|
+
case "Polygon":
|
|
131
|
+
case "MultiPolygon":
|
|
132
|
+
tempPolygonLayerInfo.features.push(feature);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (tempPointLayerInfo.features.length > 0) {
|
|
137
|
+
layerInfos.push(tempPointLayerInfo);
|
|
138
|
+
}
|
|
139
|
+
if (tempLineLayerInfo.features.length > 0) {
|
|
140
|
+
layerInfos.push(tempLineLayerInfo);
|
|
141
|
+
}
|
|
142
|
+
if (tempPolygonLayerInfo.features.length > 0) {
|
|
143
|
+
layerInfos.push(tempPolygonLayerInfo);
|
|
144
|
+
}
|
|
145
|
+
return layerInfos;
|
|
146
|
+
}
|
|
147
|
+
async function exportShp() {
|
|
148
|
+
var _a;
|
|
149
|
+
const features = (_a = reactiveValue.exportLayer) == null ? void 0 : _a.features;
|
|
150
|
+
if (!features || features.length == 0) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const res = await exportFeatures(features, 4326, reactiveValue.fileName, "shp");
|
|
154
|
+
const blob = base64ToBlob(res);
|
|
155
|
+
downloadBlob(blob, reactiveValue.fileName + ".zip");
|
|
156
|
+
}
|
|
157
|
+
function exportKml() {
|
|
158
|
+
var _a;
|
|
159
|
+
const geojsonCollection = {
|
|
160
|
+
type: "FeatureCollection",
|
|
161
|
+
features: []
|
|
162
|
+
};
|
|
163
|
+
const features = (_a = reactiveValue.exportLayer) == null ? void 0 : _a.features;
|
|
164
|
+
if (!features || features.length == 0) {
|
|
165
|
+
return "";
|
|
166
|
+
}
|
|
167
|
+
const geojson = new GeoJSON();
|
|
168
|
+
for (let feature of features) {
|
|
169
|
+
const json = geojson.writeFeature(feature);
|
|
170
|
+
geojsonCollection.features.push(JSON.parse(json));
|
|
171
|
+
}
|
|
172
|
+
const kml = toKml(geojsonCollection, {});
|
|
173
|
+
return kml;
|
|
174
|
+
}
|
|
175
|
+
return (_ctx, _cache) => {
|
|
176
|
+
const _component_el_option = ElOption;
|
|
177
|
+
const _component_el_select = ElSelect;
|
|
178
|
+
const _component_el_form_item = ElFormItem;
|
|
179
|
+
const _component_el_input = ElInput;
|
|
180
|
+
const _component_el_form = ElForm;
|
|
181
|
+
return withDirectives((openBlock(), createBlock(DraggablePanel, {
|
|
182
|
+
ref: "popupDom",
|
|
183
|
+
class: "el-current",
|
|
184
|
+
title: "导出",
|
|
185
|
+
drag: true,
|
|
186
|
+
width: 300,
|
|
187
|
+
height: 267,
|
|
188
|
+
showMaximize: false,
|
|
189
|
+
showOk: true,
|
|
190
|
+
onClose: handleClose,
|
|
191
|
+
onOk: handleOk
|
|
192
|
+
}, {
|
|
193
|
+
default: withCtx(() => [
|
|
194
|
+
createVNode(_component_el_form, {
|
|
195
|
+
ref_key: "formRef",
|
|
196
|
+
ref: formRef,
|
|
197
|
+
model: unref(reactiveValue),
|
|
198
|
+
"label-width": "auto"
|
|
199
|
+
}, {
|
|
200
|
+
default: withCtx(() => [
|
|
201
|
+
unref(reactiveValue).layerInfos && unref(reactiveValue).layerInfos.length > 0 ? (openBlock(), createBlock(_component_el_form_item, {
|
|
202
|
+
key: 0,
|
|
203
|
+
label: "导出图层",
|
|
204
|
+
prop: "exportLayer",
|
|
205
|
+
rules: {
|
|
206
|
+
required: true,
|
|
207
|
+
message: "请选择导出图层",
|
|
208
|
+
trigger: "change"
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
default: withCtx(() => [
|
|
212
|
+
createVNode(_component_el_select, {
|
|
213
|
+
modelValue: unref(reactiveValue).exportLayer,
|
|
214
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(reactiveValue).exportLayer = $event),
|
|
215
|
+
"value-key": "id",
|
|
216
|
+
class: "el-current",
|
|
217
|
+
"popper-class": "el-current"
|
|
218
|
+
}, {
|
|
219
|
+
default: withCtx(() => [
|
|
220
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(reactiveValue).layerInfos, (item) => {
|
|
221
|
+
return openBlock(), createBlock(_component_el_option, {
|
|
222
|
+
key: item.id,
|
|
223
|
+
label: item.title,
|
|
224
|
+
value: item
|
|
225
|
+
}, null, 8, ["label", "value"]);
|
|
226
|
+
}), 128))
|
|
227
|
+
]),
|
|
228
|
+
_: 1
|
|
229
|
+
}, 8, ["modelValue"])
|
|
230
|
+
]),
|
|
231
|
+
_: 1
|
|
232
|
+
})) : createCommentVNode("", true),
|
|
233
|
+
createVNode(_component_el_form_item, {
|
|
234
|
+
label: "导出格式",
|
|
235
|
+
prop: "exportType",
|
|
236
|
+
rules: {
|
|
237
|
+
required: true,
|
|
238
|
+
message: "请选择文件格式",
|
|
239
|
+
trigger: "change"
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
default: withCtx(() => [
|
|
243
|
+
createVNode(_component_el_select, {
|
|
244
|
+
modelValue: unref(reactiveValue).exportType,
|
|
245
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(reactiveValue).exportType = $event),
|
|
246
|
+
class: "el-current",
|
|
247
|
+
"popper-class": "el-current"
|
|
248
|
+
}, {
|
|
249
|
+
default: withCtx(() => [
|
|
250
|
+
createVNode(_component_el_option, {
|
|
251
|
+
label: "shp文件",
|
|
252
|
+
value: "shp"
|
|
253
|
+
}),
|
|
254
|
+
createVNode(_component_el_option, {
|
|
255
|
+
label: "kml",
|
|
256
|
+
value: "kml"
|
|
257
|
+
}),
|
|
258
|
+
createVNode(_component_el_option, {
|
|
259
|
+
label: "kmz",
|
|
260
|
+
value: "kmz"
|
|
261
|
+
})
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
}, 8, ["modelValue"])
|
|
265
|
+
]),
|
|
266
|
+
_: 1
|
|
267
|
+
}),
|
|
268
|
+
createVNode(_component_el_form_item, {
|
|
269
|
+
label: "文件名",
|
|
270
|
+
prop: "fileName",
|
|
271
|
+
rules: {
|
|
272
|
+
required: true,
|
|
273
|
+
message: "请输入文件名",
|
|
274
|
+
trigger: "blur"
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
default: withCtx(() => [
|
|
278
|
+
createVNode(_component_el_input, {
|
|
279
|
+
modelValue: unref(reactiveValue).fileName,
|
|
280
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(reactiveValue).fileName = $event)
|
|
281
|
+
}, null, 8, ["modelValue"])
|
|
282
|
+
]),
|
|
283
|
+
_: 1
|
|
284
|
+
})
|
|
285
|
+
]),
|
|
286
|
+
_: 1
|
|
287
|
+
}, 8, ["model"])
|
|
288
|
+
]),
|
|
289
|
+
_: 1
|
|
290
|
+
}, 512)), [
|
|
291
|
+
[vShow, unref(reactiveValue).visible]
|
|
292
|
+
]);
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
export {
|
|
297
|
+
_sfc_main as default
|
|
298
|
+
};
|