ym-giswidget-2d 1.0.52 → 1.0.54

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.
@@ -0,0 +1,272 @@
1
+ import { ElRadioGroup, ElRadio, ElForm, ElFormItem, 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/form-item/style/css";
5
+ import "element-plus/es/components/input/style/css";
6
+ import "element-plus/es/components/radio-group/style/css";
7
+ import "element-plus/es/components/radio/style/css";
8
+ import { defineComponent, reactive, onMounted, onUnmounted, withDirectives, createBlock, openBlock, withCtx, createVNode, unref, createTextVNode, createElementBlock, createCommentVNode, Fragment, createElementVNode, vShow } from "vue";
9
+ import DraggablePanel from "../../panel/DraggablePanel.vue.js";
10
+ import { getSpheroidProjection } from "ym-gis-2d/utils/RegisterProjUtil";
11
+ import locationIcon from "../../assets/img/dw.png.js";
12
+ import FeatureManager from "ym-gis-2d/feature/FeatureManager";
13
+ import { ElMessage } from "element-plus";
14
+ const _hoisted_1 = { class: "dfm" };
15
+ const _hoisted_2 = { class: "dfm" };
16
+ const _hoisted_3 = { class: "input" };
17
+ const _hoisted_4 = { class: "input" };
18
+ const _hoisted_5 = { class: "input" };
19
+ const _hoisted_6 = { class: "input" };
20
+ const featureTag = "location";
21
+ const _sfc_main = /* @__PURE__ */ defineComponent({
22
+ __name: "Location",
23
+ props: {
24
+ map: {}
25
+ },
26
+ emits: ["activeInteraction"],
27
+ setup(__props, { emit: __emit }) {
28
+ const emit = __emit;
29
+ const props = __props;
30
+ let reactiveValue = reactive({
31
+ visible: true,
32
+ currentType: "dfm"
33
+ });
34
+ onMounted(() => {
35
+ });
36
+ onUnmounted(() => {
37
+ reactiveValue.visible = false;
38
+ });
39
+ function handleClose() {
40
+ const featureManager = new FeatureManager(props.map);
41
+ featureManager.clearTempFeatures(featureTag);
42
+ emit("activeInteraction", { success: false, message: "" });
43
+ }
44
+ function handleOk() {
45
+ let x;
46
+ let y;
47
+ let prj = "EPSG:4490";
48
+ if (reactiveValue.currentType == "dfm") {
49
+ if (reactiveValue.xD == void 0 || reactiveValue.xF == void 0 || reactiveValue.xM == void 0 || reactiveValue.yD == void 0 || reactiveValue.yF == void 0 || reactiveValue.yM == void 0) {
50
+ ElMessage.warning("请输入完整的度分秒坐标");
51
+ return;
52
+ }
53
+ x = Number(reactiveValue.xD) + Number(reactiveValue.xF) / 60 + Number(reactiveValue.xM) / 3600;
54
+ y = Number(reactiveValue.yD) + Number(reactiveValue.yF) / 60 + Number(reactiveValue.yM) / 3600;
55
+ } else {
56
+ if (reactiveValue.x == void 0 || reactiveValue.y == void 0) {
57
+ ElMessage.warning("请输入完整的坐标");
58
+ return;
59
+ }
60
+ x = Number(reactiveValue.x);
61
+ y = Number(reactiveValue.y);
62
+ if (reactiveValue.currentType == "xy") {
63
+ if (x < 1e7) {
64
+ ElMessage.warning("请输入含带号的X坐标");
65
+ return;
66
+ }
67
+ const dh = Number(x.toString().substring(0, 2));
68
+ prj = `EPSG:${4488 + dh}`;
69
+ }
70
+ }
71
+ if (reactiveValue.currentType == "dfm" || reactiveValue.currentType == "jwd") {
72
+ const dlProj = getSpheroidProjection(props.map.getView().getProjection());
73
+ if (dlProj) {
74
+ prj = dlProj.getCode();
75
+ }
76
+ }
77
+ props.map.addWKT(`POINT(${x} ${y})`, prj, featureTag, true, null, { imgurl: locationIcon });
78
+ }
79
+ return (_ctx, _cache) => {
80
+ const _component_el_radio = ElRadio;
81
+ const _component_el_radio_group = ElRadioGroup;
82
+ const _component_el_input = ElInput;
83
+ const _component_el_form_item = ElFormItem;
84
+ const _component_el_form = ElForm;
85
+ return withDirectives((openBlock(), createBlock(DraggablePanel, {
86
+ ref: "locationRef",
87
+ class: "el-current",
88
+ title: "定位方式",
89
+ drag: true,
90
+ width: 320,
91
+ height: 268,
92
+ showMaximize: false,
93
+ showOk: true,
94
+ "show-cancel": false,
95
+ "ok-text": "定位",
96
+ onOk: handleOk,
97
+ onClose: handleClose
98
+ }, {
99
+ default: withCtx(() => [
100
+ createVNode(_component_el_radio_group, {
101
+ modelValue: unref(reactiveValue).currentType,
102
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(reactiveValue).currentType = $event)
103
+ }, {
104
+ default: withCtx(() => [
105
+ createVNode(_component_el_radio, { value: "dfm" }, {
106
+ default: withCtx(() => _cache[11] || (_cache[11] = [
107
+ createTextVNode("度分秒")
108
+ ])),
109
+ _: 1
110
+ }),
111
+ createVNode(_component_el_radio, { label: "jwd" }, {
112
+ default: withCtx(() => _cache[12] || (_cache[12] = [
113
+ createTextVNode("经纬度")
114
+ ])),
115
+ _: 1
116
+ }),
117
+ createVNode(_component_el_radio, { label: "xy" }, {
118
+ default: withCtx(() => _cache[13] || (_cache[13] = [
119
+ createTextVNode("平面坐标")
120
+ ])),
121
+ _: 1
122
+ })
123
+ ]),
124
+ _: 1
125
+ }, 8, ["modelValue"]),
126
+ createVNode(_component_el_form, {
127
+ ref: "formRef",
128
+ model: unref(reactiveValue),
129
+ "label-width": "54"
130
+ }, {
131
+ default: withCtx(() => [
132
+ unref(reactiveValue).currentType == "dfm" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
133
+ createVNode(_component_el_form_item, { label: "经度:" }, {
134
+ default: withCtx(() => [
135
+ createElementVNode("div", _hoisted_1, [
136
+ createVNode(_component_el_input, {
137
+ modelValue: unref(reactiveValue).xD,
138
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => unref(reactiveValue).xD = $event),
139
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
140
+ }, {
141
+ append: withCtx(() => _cache[14] || (_cache[14] = [
142
+ createTextVNode("°")
143
+ ])),
144
+ _: 1
145
+ }, 8, ["modelValue"]),
146
+ createVNode(_component_el_input, {
147
+ modelValue: unref(reactiveValue).xF,
148
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(reactiveValue).xF = $event),
149
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
150
+ }, {
151
+ append: withCtx(() => _cache[15] || (_cache[15] = [
152
+ createTextVNode("′")
153
+ ])),
154
+ _: 1
155
+ }, 8, ["modelValue"]),
156
+ createVNode(_component_el_input, {
157
+ modelValue: unref(reactiveValue).xM,
158
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(reactiveValue).xM = $event),
159
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
160
+ }, {
161
+ append: withCtx(() => _cache[16] || (_cache[16] = [
162
+ createTextVNode("″")
163
+ ])),
164
+ _: 1
165
+ }, 8, ["modelValue"])
166
+ ])
167
+ ]),
168
+ _: 1
169
+ }),
170
+ createVNode(_component_el_form_item, { label: "维度:" }, {
171
+ default: withCtx(() => [
172
+ createElementVNode("div", _hoisted_2, [
173
+ createVNode(_component_el_input, {
174
+ modelValue: unref(reactiveValue).yD,
175
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(reactiveValue).yD = $event),
176
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
177
+ }, {
178
+ append: withCtx(() => _cache[17] || (_cache[17] = [
179
+ createTextVNode("°")
180
+ ])),
181
+ _: 1
182
+ }, 8, ["modelValue"]),
183
+ createVNode(_component_el_input, {
184
+ modelValue: unref(reactiveValue).yF,
185
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(reactiveValue).yF = $event),
186
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
187
+ }, {
188
+ append: withCtx(() => _cache[18] || (_cache[18] = [
189
+ createTextVNode("′")
190
+ ])),
191
+ _: 1
192
+ }, 8, ["modelValue"]),
193
+ createVNode(_component_el_input, {
194
+ modelValue: unref(reactiveValue).yM,
195
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(reactiveValue).yM = $event),
196
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
197
+ }, {
198
+ append: withCtx(() => _cache[19] || (_cache[19] = [
199
+ createTextVNode("″")
200
+ ])),
201
+ _: 1
202
+ }, 8, ["modelValue"])
203
+ ])
204
+ ]),
205
+ _: 1
206
+ })
207
+ ], 64)) : unref(reactiveValue).currentType == "jwd" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
208
+ createVNode(_component_el_form_item, { label: "经度:" }, {
209
+ default: withCtx(() => [
210
+ createElementVNode("div", _hoisted_3, [
211
+ createVNode(_component_el_input, {
212
+ modelValue: unref(reactiveValue).x,
213
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => unref(reactiveValue).x = $event),
214
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
215
+ }, null, 8, ["modelValue"])
216
+ ])
217
+ ]),
218
+ _: 1
219
+ }),
220
+ createVNode(_component_el_form_item, { label: "维度:" }, {
221
+ default: withCtx(() => [
222
+ createElementVNode("div", _hoisted_4, [
223
+ createVNode(_component_el_input, {
224
+ modelValue: unref(reactiveValue).y,
225
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(reactiveValue).y = $event),
226
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
227
+ }, null, 8, ["modelValue"])
228
+ ])
229
+ ]),
230
+ _: 1
231
+ })
232
+ ], 64)) : unref(reactiveValue).currentType == "xy" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
233
+ createVNode(_component_el_form_item, { label: "X:" }, {
234
+ default: withCtx(() => [
235
+ createElementVNode("div", _hoisted_5, [
236
+ createVNode(_component_el_input, {
237
+ modelValue: unref(reactiveValue).x,
238
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(reactiveValue).x = $event),
239
+ placeholder: "请输入含带号的X坐标",
240
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
241
+ }, null, 8, ["modelValue"])
242
+ ])
243
+ ]),
244
+ _: 1
245
+ }),
246
+ createVNode(_component_el_form_item, { label: "Y:" }, {
247
+ default: withCtx(() => [
248
+ createElementVNode("div", _hoisted_6, [
249
+ createVNode(_component_el_input, {
250
+ modelValue: unref(reactiveValue).y,
251
+ "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => unref(reactiveValue).y = $event),
252
+ oninput: "value= value.replace(/[^\\-\\d.]/g, '')"
253
+ }, null, 8, ["modelValue"])
254
+ ])
255
+ ]),
256
+ _: 1
257
+ })
258
+ ], 64)) : createCommentVNode("", true)
259
+ ]),
260
+ _: 1
261
+ }, 8, ["model"])
262
+ ]),
263
+ _: 1
264
+ }, 512)), [
265
+ [vShow, unref(reactiveValue).visible]
266
+ ]);
267
+ };
268
+ }
269
+ });
270
+ export {
271
+ _sfc_main as default
272
+ };
@@ -0,0 +1,16 @@
1
+ .dfm[data-v-bc1c2409] {
2
+ display: flex;
3
+ gap: 5px;
4
+ }
5
+ .dfm .el-input[data-v-bc1c2409] {
6
+ width: 70px;
7
+ }
8
+ .dfm .el-input[data-v-bc1c2409] .el-input-group__append {
9
+ padding: 0 5px;
10
+ }
11
+ .input .el-input[data-v-bc1c2409] {
12
+ width: 220px;
13
+ }
14
+ .el-radio-group[data-v-bc1c2409] {
15
+ margin-bottom: 10px;
16
+ }
@@ -0,0 +1,154 @@
1
+ export declare const Location: import('../../utils').WithInstall<import('vue').DefineComponent<{
2
+ map: import('ym-gis-2d/mapView/Map').default;
3
+ }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
4
+ activeInteraction: (...args: any[]) => void;
5
+ }, string, import('vue').PublicProps, Readonly<{
6
+ map: import('ym-gis-2d/mapView/Map').default;
7
+ }> & Readonly<{
8
+ onActiveInteraction?: ((...args: any[]) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
10
+ locationRef: ({
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 Location;
@@ -0,0 +1,8 @@
1
+ import "./index.css";
2
+ import { withInstall } from "../../utils/wthInstall.js";
3
+ import _Location from "./Location.vue.js";
4
+ const Location = withInstall(_Location);
5
+ export {
6
+ Location,
7
+ Location as default
8
+ };
@@ -12,8 +12,9 @@ type __VLS_Props = {
12
12
  };
13
13
  declare function addWKT(wkt: string, proj: string, tag?: string, location?: boolean, properties?: any, style?: IStyle): void;
14
14
  declare function addWKTs(wkts: string[], proj: string, tag?: string, location?: boolean, style?: IStyle, properties?: any): void;
15
+ declare function clearTempFeatures(tag?: string): void;
15
16
  declare const _default: import('vue').DefineComponent<__VLS_Props, {
16
- mapView: {
17
+ map: {
17
18
  currentEditLayer?: {
18
19
  id: string;
19
20
  parentId?: string | undefined;
@@ -499,6 +500,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
499
500
  } | undefined;
500
501
  addWKT: typeof addWKT;
501
502
  addWKTs: typeof addWKTs;
503
+ clearTempFeatures: typeof clearTempFeatures;
502
504
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
503
505
  init: (...args: any[]) => void;
504
506
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
@@ -1,5 +1,6 @@
1
1
  import { defineComponent, ref, reactive, onMounted, createElementBlock, openBlock } from "vue";
2
2
  import OLMap from "ym-gis-2d/mapView/Map";
3
+ import FeatureManager from "ym-gis-2d/feature/FeatureManager";
3
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
4
5
  __name: "MapView",
5
6
  props: {
@@ -49,10 +50,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
50
  console.error("地图未初始化完成,无法添加WKT数据");
50
51
  }
51
52
  }
53
+ function clearTempFeatures(tag) {
54
+ if (reactiveValue.mapView) {
55
+ const featureManager = new FeatureManager(reactiveValue.mapView);
56
+ featureManager.clearTempFeatures(tag);
57
+ } else {
58
+ console.error("地图未初始化完成,无法添加WKT数据");
59
+ }
60
+ }
52
61
  __expose({
53
- mapView: reactiveValue.mapView,
62
+ map: reactiveValue.mapView,
54
63
  addWKT,
55
- addWKTs
64
+ addWKTs,
65
+ clearTempFeatures
56
66
  });
57
67
  return (_ctx, _cache) => {
58
68
  return openBlock(), createElementBlock("div", {
@@ -9,7 +9,7 @@ export declare const MapView: import('../../utils').WithInstall<import('vue').De
9
9
  maxResolution?: number;
10
10
  constrainResolution?: boolean;
11
11
  }, {
12
- mapView: {
12
+ map: {
13
13
  currentEditLayer?: {
14
14
  id: string;
15
15
  parentId?: string | undefined;
@@ -495,6 +495,7 @@ export declare const MapView: import('../../utils').WithInstall<import('vue').De
495
495
  } | undefined;
496
496
  addWKT: (wkt: string, proj: string, tag?: string, location?: boolean, properties?: any, style?: import('ym-gis-2d/entity/style/IStyle').default) => void;
497
497
  addWKTs: (wkts: string[], proj: string, tag?: string, location?: boolean, style?: import('ym-gis-2d/entity/style/IStyle').default, properties?: any) => void;
498
+ clearTempFeatures: (tag?: string) => void;
498
499
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
499
500
  init: (...args: any[]) => void;
500
501
  }, string, import('vue').PublicProps, Readonly<{
@@ -56,6 +56,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
56
56
  if (event.selectGeom) {
57
57
  clearSelected(event.selectGeom);
58
58
  }
59
+ const features = event.allFeatures;
60
+ if (features && features.length > 0) {
61
+ features.forEach((feature) => {
62
+ feature.isSelected = true;
63
+ });
64
+ }
59
65
  reactiveData.features = event.allFeatures;
60
66
  if (event.allFeatures) {
61
67
  addFeaturesToTempLayer(event.allFeatures);
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./Split.vue2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,78 @@
1
+ import { defineComponent, reactive, onMounted, toRaw, onUnmounted } from "vue";
2
+ import Split from "ym-gis-2d/interaction/Split";
3
+ import { ElLoading } from "element-plus";
4
+ import FeatureManager from "ym-gis-2d/feature/FeatureManager";
5
+ import "ym-gis-2d/utils/GeometryUtil";
6
+ import { getStyle, getSelectCancePointStyle, getSelectCancelLineStyle, getSelectCancelPolygonStyle } from "ym-gis-2d/style/StyleManager";
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "Split",
9
+ props: {
10
+ map: {},
11
+ pointStyle: {},
12
+ cancePointStyle: {},
13
+ lineStyle: {},
14
+ canceLineStyle: {},
15
+ polygonStyle: {},
16
+ cancePolygonStyle: {},
17
+ selectLayers: {},
18
+ showLoading: { type: Boolean, default: true },
19
+ selectType: { default: "rectangle" }
20
+ },
21
+ emits: ["activeInteraction"],
22
+ setup(__props, { expose: __expose, emit: __emit }) {
23
+ const props = __props;
24
+ props.cancePointStyle ? getStyle(props.cancePointStyle) : getSelectCancePointStyle();
25
+ props.canceLineStyle ? getStyle(props.canceLineStyle) : getSelectCancelLineStyle();
26
+ props.cancePolygonStyle ? getStyle(props.cancePolygonStyle) : getSelectCancelPolygonStyle();
27
+ const emit = __emit;
28
+ const reactiveData = reactive({
29
+ features: []
30
+ });
31
+ onMounted(() => {
32
+ const featureManager = new FeatureManager(props.map);
33
+ const editFeatures = featureManager.getEditFeatures();
34
+ if (!editFeatures || editFeatures.length === 0) {
35
+ emit("activeInteraction", { success: false, message: "请先选择分割的地块" });
36
+ return;
37
+ }
38
+ reactiveData.splitTool = new Split(editFeatures, {
39
+ tipText: "分割线完全穿过面",
40
+ addTempLayer: true
41
+ //是否添加临时图层
42
+ });
43
+ props.map.interactionManager.addInteraction("split", toRaw(reactiveData.splitTool));
44
+ let loadingInstance;
45
+ reactiveData.splitTool.on("splitStart", (event) => {
46
+ if (props.showLoading) {
47
+ loadingInstance = ElLoading.service({ text: "正在分割...", background: "rgba(0, 0, 0, 0.5)", target: props.map.getTarget() });
48
+ }
49
+ });
50
+ reactiveData.splitTool.on("splited", (event) => {
51
+ loadingInstance == null ? void 0 : loadingInstance.close();
52
+ const features = event.polygonFeatures;
53
+ if (features && features.length > 0) {
54
+ features.forEach((feature) => {
55
+ feature.isSelected = true;
56
+ });
57
+ }
58
+ });
59
+ });
60
+ onUnmounted(() => {
61
+ props.map.interactionManager.removeInteraction("select");
62
+ });
63
+ function setSelectLayers(layers) {
64
+ var _a;
65
+ (_a = reactiveData.selectTool) == null ? void 0 : _a.setSelectLayers(layers);
66
+ }
67
+ __expose({
68
+ setSelectLayers,
69
+ features: reactiveData.features
70
+ });
71
+ return (_ctx, _cache) => {
72
+ return null;
73
+ };
74
+ }
75
+ });
76
+ export {
77
+ _sfc_main as default
78
+ };
@@ -0,0 +1,7 @@
1
+ import { withInstall } from "../../utils/wthInstall.js";
2
+ import _sfc_main from "./Split.vue2.js";
3
+ const Split = withInstall(_sfc_main);
4
+ export {
5
+ Split,
6
+ Split as default
7
+ };
package/index.d.ts CHANGED
@@ -14,3 +14,4 @@ export * from './components/map-view';
14
14
  export * from './components/legend';
15
15
  export * from './components/layer-switcher';
16
16
  export * from './components/area-measurement';
17
+ export * from './components/location';
package/index.js CHANGED
@@ -15,6 +15,7 @@ import { MapView } from "./components/map-view/index.js";
15
15
  import { Legend } from "./components/legend/index.js";
16
16
  import { LayerSwitcher } from "./components/layer-switcher/index.js";
17
17
  import { AreaMeasurement } from "./components/area-measurement/index.js";
18
+ import { Location } from "./components/location/index.js";
18
19
  export {
19
20
  AreaMeasurement,
20
21
  Clear,
@@ -25,6 +26,7 @@ export {
25
26
  Import,
26
27
  LayerSwitcher,
27
28
  Legend,
29
+ Location,
28
30
  MapView,
29
31
  MousePositon,
30
32
  MultiScreen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ym-giswidget-2d",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -10,6 +10,6 @@
10
10
  "element-plus": "^2.9.0",
11
11
  "jszip": "^3.10.1",
12
12
  "ol": "^9.2.4",
13
- "ym-gis-2d": "1.0.30"
13
+ "ym-gis-2d": "1.0.32"
14
14
  }
15
15
  }