@vunk/form 1.1.84 → 1.2.0
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/components/_plugin-vue_export-helper.cjs +11 -0
- package/components/button/index.cjs +112 -0
- package/components/cascader/index.cjs +130 -0
- package/components/checkbox/index.cjs +153 -0
- package/components/color-picker/index.cjs +80 -0
- package/components/date-picker/index.cjs +120 -0
- package/components/date-picker-range/index.cjs +170 -0
- package/components/download-plus/index.cjs +445 -0
- package/components/esri-input-geojson/index.cjs +1120 -0
- package/components/form/index.cjs +220 -0
- package/components/form-item/index.cjs +162 -0
- package/components/form-item-renderer/index.cjs +103 -0
- package/components/form-item-renderer-template/index.cjs +47 -0
- package/components/geoinput/index.cjs +95 -0
- package/components/geoinput-read/index.cjs +304 -0
- package/components/geoinput-update/index.cjs +406 -0
- package/components/index.cjs +13 -0
- package/components/index2.cjs +323 -0
- package/components/index3.cjs +486 -0
- package/components/input/index.cjs +119 -0
- package/components/input-link/index.cjs +157 -0
- package/components/input-number/index.cjs +100 -0
- package/components/radio/index.cjs +142 -0
- package/components/select/index.cjs +165 -0
- package/components/slider/index.cjs +89 -0
- package/components/switch/index.cjs +92 -0
- package/components/templates-default/index.cjs +308 -0
- package/components/templates-element-plus/index.cjs +112 -0
- package/components/templates-esri/index.cjs +65 -0
- package/components/templates-layout/index.cjs +137 -0
- package/components/templates-mapbox/index.cjs +65 -0
- package/components/templates-variant/index.cjs +70 -0
- package/components/upload/index.cjs +508 -0
- package/components/upload-plus/index.cjs +18658 -0
- package/components/van-cascader/index.cjs +128 -0
- package/components/var-datetime-picker/index.cjs +330 -0
- package/components/vditor/index.cjs +451 -0
- package/composables/index.cjs +89 -0
- package/package.json +97 -49
- package/shared/const/index.cjs +59 -0
- package/shared/element-plus/index.cjs +317 -0
- package/shared/form/index.cjs +33 -0
- package/shared/helper/index.cjs +11 -0
- package/shared/index.cjs +8 -0
- package/shared/infer-prop/index.cjs +36 -0
- package/shared/progress-it/index.cjs +40 -0
- package/shared/rules/index.cjs +56 -0
- package/shared/types/form/index.cjs +2 -0
- package/shared/types/index.cjs +2 -0
- package/shared/types/source/index.cjs +2 -0
- package/shared/types/source-manager/index.cjs +2 -0
- package/shared/upload/index.cjs +774 -0
|
@@ -0,0 +1,1120 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var input = require('@vunk/form/components/input');
|
|
7
|
+
var utilsVue = require('@vunk/core/shared/utils-vue');
|
|
8
|
+
var elementPlus = require('element-plus');
|
|
9
|
+
var index = require('../index2.cjs');
|
|
10
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
11
|
+
var core = require('@vuesri/core');
|
|
12
|
+
var MapView = require('@arcgis/core/views/MapView');
|
|
13
|
+
var SceneView = require('@arcgis/core/views/SceneView');
|
|
14
|
+
var index$1 = require('../index3.cjs');
|
|
15
|
+
var core$1 = require('@vunk/core');
|
|
16
|
+
var Graphic = require('@arcgis/core/Graphic');
|
|
17
|
+
var composables = require('@vunk/form/composables');
|
|
18
|
+
var utilsPromise = require('@vunk/core/shared/utils-promise');
|
|
19
|
+
|
|
20
|
+
var EDIT_TYPE = /* @__PURE__ */ ((EDIT_TYPE2) => {
|
|
21
|
+
EDIT_TYPE2["POINT"] = "point";
|
|
22
|
+
EDIT_TYPE2["POLYGON"] = "polygon";
|
|
23
|
+
EDIT_TYPE2["LINE_STRING"] = "line_string";
|
|
24
|
+
return EDIT_TYPE2;
|
|
25
|
+
})(EDIT_TYPE || {});
|
|
26
|
+
const EDIT_TYPE_OPTIONS = [
|
|
27
|
+
{
|
|
28
|
+
label: "\u70B9",
|
|
29
|
+
value: "point" /* POINT */,
|
|
30
|
+
availableCreatureTools: ["point"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "\u7EBF",
|
|
34
|
+
value: "line_string" /* LINE_STRING */,
|
|
35
|
+
availableCreatureTools: ["polyline"]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "\u9762",
|
|
39
|
+
value: "polygon" /* POLYGON */,
|
|
40
|
+
availableCreatureTools: ["polygon", "circle", "rectangle"]
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
const EDIT_TYPE_REFLECT = EDIT_TYPE_OPTIONS.reduce((acc, cur) => {
|
|
44
|
+
acc[cur.value] = cur;
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
const EMPTY_FEATURE_COLLECTION = {
|
|
48
|
+
type: "FeatureCollection",
|
|
49
|
+
features: []
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const props = {
|
|
53
|
+
...input._VkfInputCtx.props,
|
|
54
|
+
viewComponent: null,
|
|
55
|
+
viewComponentAttrs: null,
|
|
56
|
+
readonly: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: void 0
|
|
59
|
+
},
|
|
60
|
+
view: {
|
|
61
|
+
type: Object
|
|
62
|
+
},
|
|
63
|
+
editTypes: {
|
|
64
|
+
type: [Array, String],
|
|
65
|
+
default: () => "polygon"
|
|
66
|
+
},
|
|
67
|
+
viewModelActiveFillSymbol: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: () => ({
|
|
70
|
+
// 红色虚线,无色填充
|
|
71
|
+
type: "simple-fill",
|
|
72
|
+
color: [0, 0, 0, 0],
|
|
73
|
+
style: "solid",
|
|
74
|
+
outline: {
|
|
75
|
+
color: [255, 0, 0, 1],
|
|
76
|
+
width: 2,
|
|
77
|
+
style: "dash"
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
},
|
|
81
|
+
viewModelActiveLineSymbol: null,
|
|
82
|
+
viewModelActivePointSymbol: null,
|
|
83
|
+
modelValue: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => EMPTY_FEATURE_COLLECTION
|
|
86
|
+
},
|
|
87
|
+
multiple: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: true
|
|
90
|
+
},
|
|
91
|
+
skipSave: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false
|
|
94
|
+
},
|
|
95
|
+
showMap: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
dialogEdit: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: true
|
|
102
|
+
},
|
|
103
|
+
dialogEditFullscreen: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: true
|
|
106
|
+
},
|
|
107
|
+
dialogEditTitle: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: "\u7ED8\u5236\u56FE\u6591"
|
|
110
|
+
},
|
|
111
|
+
flying: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false
|
|
114
|
+
},
|
|
115
|
+
layerIndex: {
|
|
116
|
+
type: Number,
|
|
117
|
+
default: 100
|
|
118
|
+
},
|
|
119
|
+
visibleElements: {
|
|
120
|
+
type: Object,
|
|
121
|
+
default: void 0
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const createBindProps = utilsVue.bindPropsFactory(props);
|
|
125
|
+
const emits = {
|
|
126
|
+
...input._VkfInputCtx.emits,
|
|
127
|
+
"update:modelValue": (e) => e,
|
|
128
|
+
"update:flying": null,
|
|
129
|
+
/**
|
|
130
|
+
* 点击地图定位按钮
|
|
131
|
+
*/
|
|
132
|
+
"appendFly": null,
|
|
133
|
+
appendEdit: null
|
|
134
|
+
};
|
|
135
|
+
const createOnEmits = utilsVue.onEmitsFactory(emits);
|
|
136
|
+
|
|
137
|
+
var ctx = /*#__PURE__*/Object.freeze({
|
|
138
|
+
__proto__: null,
|
|
139
|
+
createBindProps: createBindProps,
|
|
140
|
+
createOnEmits: createOnEmits,
|
|
141
|
+
emits: emits,
|
|
142
|
+
props: props
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
var _sfc_main$3 = vue.defineComponent({
|
|
146
|
+
components: {
|
|
147
|
+
ElButton: elementPlus.ElButton,
|
|
148
|
+
ElIcon: elementPlus.ElIcon,
|
|
149
|
+
ElButtonGroup: elementPlus.ElButtonGroup,
|
|
150
|
+
Upload: index.upload_default,
|
|
151
|
+
Edit: index.edit_default,
|
|
152
|
+
ElUpload: elementPlus.ElUpload,
|
|
153
|
+
MapLocation: index.map_location_default
|
|
154
|
+
},
|
|
155
|
+
props: {
|
|
156
|
+
disabled: Boolean,
|
|
157
|
+
dialog: Boolean,
|
|
158
|
+
upload: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
default: true
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
emits: {
|
|
164
|
+
upload: (e) => e,
|
|
165
|
+
edit: null,
|
|
166
|
+
fly: null
|
|
167
|
+
},
|
|
168
|
+
methods: {
|
|
169
|
+
getFile(file) {
|
|
170
|
+
this.$emit("upload", file);
|
|
171
|
+
},
|
|
172
|
+
uploadClick(e) {
|
|
173
|
+
const target = e.target.querySelector("input[type=file]");
|
|
174
|
+
if (!target) return;
|
|
175
|
+
target.click();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
181
|
+
const _component_Upload = vue.resolveComponent("Upload");
|
|
182
|
+
const _component_ElIcon = vue.resolveComponent("ElIcon");
|
|
183
|
+
const _component_ElUpload = vue.resolveComponent("ElUpload");
|
|
184
|
+
const _component_Edit = vue.resolveComponent("Edit");
|
|
185
|
+
const _component_ElButton = vue.resolveComponent("ElButton");
|
|
186
|
+
const _component_MapLocation = vue.resolveComponent("MapLocation");
|
|
187
|
+
const _component_ElButtonGroup = vue.resolveComponent("ElButtonGroup");
|
|
188
|
+
return vue.openBlock(), vue.createBlock(_component_ElButtonGroup, null, {
|
|
189
|
+
default: vue.withCtx(() => [
|
|
190
|
+
_ctx.upload ? (vue.openBlock(), vue.createBlock(_component_ElUpload, {
|
|
191
|
+
key: 0,
|
|
192
|
+
class: "el-button el-button--default vkf-esri-input-geojson__upload",
|
|
193
|
+
action: "",
|
|
194
|
+
accept: "file",
|
|
195
|
+
multiple: false,
|
|
196
|
+
"show-file-list": false,
|
|
197
|
+
"auto-upload": false,
|
|
198
|
+
"on-change": _ctx.getFile,
|
|
199
|
+
disabled: _ctx.disabled,
|
|
200
|
+
onClick: _ctx.uploadClick
|
|
201
|
+
}, {
|
|
202
|
+
default: vue.withCtx(() => [
|
|
203
|
+
vue.createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
|
|
204
|
+
default: vue.withCtx(() => [
|
|
205
|
+
vue.createVNode(_component_Upload)
|
|
206
|
+
]),
|
|
207
|
+
_: 1
|
|
208
|
+
/* STABLE */
|
|
209
|
+
})
|
|
210
|
+
]),
|
|
211
|
+
_: 1
|
|
212
|
+
/* STABLE */
|
|
213
|
+
}, 8, ["on-change", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
|
|
214
|
+
_ctx.dialog ? (vue.openBlock(), vue.createBlock(_component_ElButton, {
|
|
215
|
+
key: 1,
|
|
216
|
+
disabled: _ctx.disabled,
|
|
217
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("edit"))
|
|
218
|
+
}, {
|
|
219
|
+
default: vue.withCtx(() => [
|
|
220
|
+
vue.createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
|
|
221
|
+
default: vue.withCtx(() => [
|
|
222
|
+
vue.createVNode(_component_Edit)
|
|
223
|
+
]),
|
|
224
|
+
_: 1
|
|
225
|
+
/* STABLE */
|
|
226
|
+
})
|
|
227
|
+
]),
|
|
228
|
+
_: 1
|
|
229
|
+
/* STABLE */
|
|
230
|
+
}, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
|
|
231
|
+
vue.createVNode(_component_ElButton, {
|
|
232
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("fly"))
|
|
233
|
+
}, {
|
|
234
|
+
default: vue.withCtx(() => [
|
|
235
|
+
vue.createVNode(_component_ElIcon, { color: "var(--el-color-primary)" }, {
|
|
236
|
+
default: vue.withCtx(() => [
|
|
237
|
+
vue.createVNode(_component_MapLocation)
|
|
238
|
+
]),
|
|
239
|
+
_: 1
|
|
240
|
+
/* STABLE */
|
|
241
|
+
})
|
|
242
|
+
]),
|
|
243
|
+
_: 1
|
|
244
|
+
/* STABLE */
|
|
245
|
+
})
|
|
246
|
+
]),
|
|
247
|
+
_: 1
|
|
248
|
+
/* STABLE */
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
var AppendVue = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/esri-input-geojson/src/append.vue"]]);
|
|
252
|
+
|
|
253
|
+
var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
254
|
+
__name: "default-view",
|
|
255
|
+
setup(__props, { expose: __expose }) {
|
|
256
|
+
__expose();
|
|
257
|
+
const __returned__ = { get VaTdtBasemap() {
|
|
258
|
+
return core.VaTdtBasemap;
|
|
259
|
+
}, get VaMapView() {
|
|
260
|
+
return core.VaMapView;
|
|
261
|
+
} };
|
|
262
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
263
|
+
return __returned__;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
268
|
+
return vue.openBlock(), vue.createBlock($setup["VaMapView"], null, {
|
|
269
|
+
default: vue.withCtx(() => [
|
|
270
|
+
vue.createVNode($setup["VaTdtBasemap"]),
|
|
271
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
272
|
+
]),
|
|
273
|
+
_: 3
|
|
274
|
+
/* FORWARDED */
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
var DefaultView = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/esri-input-geojson/src/default-view.vue"]]);
|
|
278
|
+
|
|
279
|
+
var _sfc_main$1 = vue.defineComponent({
|
|
280
|
+
components: {
|
|
281
|
+
VaTdtBasemap: core.VaTdtBasemap,
|
|
282
|
+
VaMapView: core.VaMapView
|
|
283
|
+
},
|
|
284
|
+
props: {
|
|
285
|
+
view: {
|
|
286
|
+
type: Object,
|
|
287
|
+
default: void 0
|
|
288
|
+
},
|
|
289
|
+
viewComponent: {
|
|
290
|
+
type: [Object, Function],
|
|
291
|
+
default: () => DefaultView
|
|
292
|
+
},
|
|
293
|
+
viewComponentAttrs: {
|
|
294
|
+
type: Object,
|
|
295
|
+
default: () => ({})
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
setup(props) {
|
|
299
|
+
if (props.view) {
|
|
300
|
+
vue.provide("vaView", props.view);
|
|
301
|
+
if (props.view instanceof MapView) {
|
|
302
|
+
vue.provide("vaMapView", props.view);
|
|
303
|
+
}
|
|
304
|
+
if (props.view instanceof SceneView) {
|
|
305
|
+
vue.provide("vaSceneView", props.view);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return {};
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
313
|
+
return !_ctx.view ? (vue.openBlock(), vue.createBlock(
|
|
314
|
+
vue.resolveDynamicComponent(_ctx.viewComponent),
|
|
315
|
+
vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.viewComponentAttrs)),
|
|
316
|
+
{
|
|
317
|
+
default: vue.withCtx(() => [
|
|
318
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
319
|
+
]),
|
|
320
|
+
_: 3
|
|
321
|
+
/* FORWARDED */
|
|
322
|
+
},
|
|
323
|
+
16
|
|
324
|
+
/* FULL_PROPS */
|
|
325
|
+
)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 });
|
|
326
|
+
}
|
|
327
|
+
var ViewerVue = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/esri-input-geojson/src/viewer.vue"]]);
|
|
328
|
+
|
|
329
|
+
/* @preserve
|
|
330
|
+
* @terraformer/arcgis - v2.1.1 - MIT
|
|
331
|
+
* Copyright (c) 2012-2022 Environmental Systems Research Institute, Inc.
|
|
332
|
+
* Tue Aug 02 2022 14:23:48 GMT-0700 (Pacific Daylight Time)
|
|
333
|
+
*/
|
|
334
|
+
/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
|
|
335
|
+
* Apache-2.0 */
|
|
336
|
+
|
|
337
|
+
var edgeIntersectsEdge = function edgeIntersectsEdge(a1, a2, b1, b2) {
|
|
338
|
+
var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);
|
|
339
|
+
var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);
|
|
340
|
+
var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);
|
|
341
|
+
|
|
342
|
+
if (uB !== 0) {
|
|
343
|
+
var ua = uaT / uB;
|
|
344
|
+
var ub = ubT / uB;
|
|
345
|
+
|
|
346
|
+
if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return false;
|
|
352
|
+
};
|
|
353
|
+
var coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {
|
|
354
|
+
var contains = false;
|
|
355
|
+
|
|
356
|
+
for (var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {
|
|
357
|
+
if ((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1] || coordinates[j][1] <= point[1] && point[1] < coordinates[i][1]) && point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0]) {
|
|
358
|
+
contains = !contains;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return contains;
|
|
363
|
+
};
|
|
364
|
+
var pointsEqual = function pointsEqual(a, b) {
|
|
365
|
+
for (var i = 0; i < a.length; i++) {
|
|
366
|
+
if (a[i] !== b[i]) {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return true;
|
|
372
|
+
};
|
|
373
|
+
var arrayIntersectsArray = function arrayIntersectsArray(a, b) {
|
|
374
|
+
for (var i = 0; i < a.length - 1; i++) {
|
|
375
|
+
for (var j = 0; j < b.length - 1; j++) {
|
|
376
|
+
if (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return false;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
|
|
386
|
+
* Apache-2.0 */
|
|
387
|
+
|
|
388
|
+
var closeRing = function closeRing(coordinates) {
|
|
389
|
+
if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {
|
|
390
|
+
coordinates.push(coordinates[0]);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return coordinates;
|
|
394
|
+
}; // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring
|
|
395
|
+
// or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-
|
|
396
|
+
// points-are-in-clockwise-order
|
|
397
|
+
|
|
398
|
+
var ringIsClockwise = function ringIsClockwise(ringToTest) {
|
|
399
|
+
var total = 0;
|
|
400
|
+
var i = 0;
|
|
401
|
+
var rLength = ringToTest.length;
|
|
402
|
+
var pt1 = ringToTest[i];
|
|
403
|
+
var pt2;
|
|
404
|
+
|
|
405
|
+
for (i; i < rLength - 1; i++) {
|
|
406
|
+
pt2 = ringToTest[i + 1];
|
|
407
|
+
total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);
|
|
408
|
+
pt1 = pt2;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return total >= 0;
|
|
412
|
+
}; // This function ensures that rings are oriented in the right directions
|
|
413
|
+
// from http://jsperf.com/cloning-an-object/2
|
|
414
|
+
|
|
415
|
+
var shallowClone = function shallowClone(obj) {
|
|
416
|
+
var target = {};
|
|
417
|
+
|
|
418
|
+
for (var i in obj) {
|
|
419
|
+
// both arcgis attributes and geojson props are just hardcoded keys
|
|
420
|
+
if (obj.hasOwnProperty(i)) {
|
|
421
|
+
// eslint-disable-line no-prototype-builtins
|
|
422
|
+
target[i] = obj[i];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return target;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
|
|
430
|
+
* Apache-2.0 */
|
|
431
|
+
|
|
432
|
+
var coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {
|
|
433
|
+
var intersects = arrayIntersectsArray(outer, inner);
|
|
434
|
+
var contains = coordinatesContainPoint(outer, inner[0]);
|
|
435
|
+
|
|
436
|
+
if (!intersects && contains) {
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return false;
|
|
441
|
+
}; // do any polygons in this array contain any other polygons in this array?
|
|
442
|
+
// used for checking for holes in arcgis rings
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
var convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {
|
|
446
|
+
var outerRings = [];
|
|
447
|
+
var holes = [];
|
|
448
|
+
var x; // iterator
|
|
449
|
+
|
|
450
|
+
var outerRing; // current outer ring being evaluated
|
|
451
|
+
|
|
452
|
+
var hole; // current hole being evaluated
|
|
453
|
+
// for each ring
|
|
454
|
+
|
|
455
|
+
for (var r = 0; r < rings.length; r++) {
|
|
456
|
+
var ring = closeRing(rings[r].slice(0));
|
|
457
|
+
|
|
458
|
+
if (ring.length < 4) {
|
|
459
|
+
continue;
|
|
460
|
+
} // is this ring an outer ring? is it clockwise?
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
if (ringIsClockwise(ring)) {
|
|
464
|
+
var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance
|
|
465
|
+
|
|
466
|
+
outerRings.push(polygon); // push to outer rings
|
|
467
|
+
} else {
|
|
468
|
+
holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
var uncontainedHoles = []; // while there are holes left...
|
|
473
|
+
|
|
474
|
+
while (holes.length) {
|
|
475
|
+
// pop a hole off out stack
|
|
476
|
+
hole = holes.pop(); // loop over all outer rings and see if they contain our hole.
|
|
477
|
+
|
|
478
|
+
var contained = false;
|
|
479
|
+
|
|
480
|
+
for (x = outerRings.length - 1; x >= 0; x--) {
|
|
481
|
+
outerRing = outerRings[x][0];
|
|
482
|
+
|
|
483
|
+
if (coordinatesContainCoordinates(outerRing, hole)) {
|
|
484
|
+
// the hole is contained push it into our polygon
|
|
485
|
+
outerRings[x].push(hole);
|
|
486
|
+
contained = true;
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
} // ring is not contained in any outer ring
|
|
490
|
+
// sometimes this happens https://github.com/Esri/esri-leaflet/issues/320
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
if (!contained) {
|
|
494
|
+
uncontainedHoles.push(hole);
|
|
495
|
+
}
|
|
496
|
+
} // if we couldn't match any holes using contains we can try intersects...
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
while (uncontainedHoles.length) {
|
|
500
|
+
// pop a hole off out stack
|
|
501
|
+
hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.
|
|
502
|
+
|
|
503
|
+
var intersects = false;
|
|
504
|
+
|
|
505
|
+
for (x = outerRings.length - 1; x >= 0; x--) {
|
|
506
|
+
outerRing = outerRings[x][0];
|
|
507
|
+
|
|
508
|
+
if (arrayIntersectsArray(outerRing, hole)) {
|
|
509
|
+
// the hole is contained push it into our polygon
|
|
510
|
+
outerRings[x].push(hole);
|
|
511
|
+
intersects = true;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if (!intersects) {
|
|
517
|
+
outerRings.push([hole.reverse()]);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
if (outerRings.length === 1) {
|
|
522
|
+
return {
|
|
523
|
+
type: 'Polygon',
|
|
524
|
+
coordinates: outerRings[0]
|
|
525
|
+
};
|
|
526
|
+
} else {
|
|
527
|
+
return {
|
|
528
|
+
type: 'MultiPolygon',
|
|
529
|
+
coordinates: outerRings
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
var getId = function getId(attributes, idAttribute) {
|
|
535
|
+
var keys = ['OBJECTID', 'FID'];
|
|
536
|
+
|
|
537
|
+
for (var i = 0; i < keys.length; i++) {
|
|
538
|
+
var key = keys[i];
|
|
539
|
+
|
|
540
|
+
if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {
|
|
541
|
+
return attributes[key];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
throw Error('No valid id attribute found');
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
var arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {
|
|
549
|
+
var geojson = {};
|
|
550
|
+
|
|
551
|
+
if (arcgis.features) {
|
|
552
|
+
geojson.type = 'FeatureCollection';
|
|
553
|
+
geojson.features = [];
|
|
554
|
+
|
|
555
|
+
for (var i = 0; i < arcgis.features.length; i++) {
|
|
556
|
+
geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {
|
|
561
|
+
geojson.type = 'Point';
|
|
562
|
+
geojson.coordinates = [arcgis.x, arcgis.y];
|
|
563
|
+
|
|
564
|
+
if (typeof arcgis.z === 'number') {
|
|
565
|
+
geojson.coordinates.push(arcgis.z);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (arcgis.points) {
|
|
570
|
+
geojson.type = 'MultiPoint';
|
|
571
|
+
geojson.coordinates = arcgis.points.slice(0);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (arcgis.paths) {
|
|
575
|
+
if (arcgis.paths.length === 1) {
|
|
576
|
+
geojson.type = 'LineString';
|
|
577
|
+
geojson.coordinates = arcgis.paths[0].slice(0);
|
|
578
|
+
} else {
|
|
579
|
+
geojson.type = 'MultiLineString';
|
|
580
|
+
geojson.coordinates = arcgis.paths.slice(0);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (arcgis.rings) {
|
|
585
|
+
geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
if (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {
|
|
589
|
+
geojson.type = 'Polygon';
|
|
590
|
+
geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if (arcgis.geometry || arcgis.attributes) {
|
|
594
|
+
geojson.type = 'Feature';
|
|
595
|
+
geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;
|
|
596
|
+
geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;
|
|
597
|
+
|
|
598
|
+
if (arcgis.attributes) {
|
|
599
|
+
try {
|
|
600
|
+
geojson.id = getId(arcgis.attributes, idAttribute);
|
|
601
|
+
} catch (err) {// don't set an id
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
} // if no valid geometry was encountered
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {
|
|
608
|
+
geojson.geometry = null;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {
|
|
612
|
+
console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
return geojson;
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
|
|
619
|
+
* Apache-2.0 */
|
|
620
|
+
// outer rings are clockwise, holes are counterclockwise
|
|
621
|
+
// used for converting GeoJSON Polygons to ArcGIS Polygons
|
|
622
|
+
|
|
623
|
+
var orientRings = function orientRings(poly) {
|
|
624
|
+
var output = [];
|
|
625
|
+
var polygon = poly.slice(0);
|
|
626
|
+
var outerRing = closeRing(polygon.shift().slice(0));
|
|
627
|
+
|
|
628
|
+
if (outerRing.length >= 4) {
|
|
629
|
+
if (!ringIsClockwise(outerRing)) {
|
|
630
|
+
outerRing.reverse();
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
output.push(outerRing);
|
|
634
|
+
|
|
635
|
+
for (var i = 0; i < polygon.length; i++) {
|
|
636
|
+
var hole = closeRing(polygon[i].slice(0));
|
|
637
|
+
|
|
638
|
+
if (hole.length >= 4) {
|
|
639
|
+
if (ringIsClockwise(hole)) {
|
|
640
|
+
hole.reverse();
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
output.push(hole);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return output;
|
|
649
|
+
}; // This function flattens holes in multipolygons to one array of polygons
|
|
650
|
+
// used for converting GeoJSON Polygons to ArcGIS Polygons
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
var flattenMultiPolygonRings = function flattenMultiPolygonRings(rings) {
|
|
654
|
+
var output = [];
|
|
655
|
+
|
|
656
|
+
for (var i = 0; i < rings.length; i++) {
|
|
657
|
+
var polygon = orientRings(rings[i]);
|
|
658
|
+
|
|
659
|
+
for (var x = polygon.length - 1; x >= 0; x--) {
|
|
660
|
+
var ring = polygon[x].slice(0);
|
|
661
|
+
output.push(ring);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return output;
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
var geojsonToArcGIS = function geojsonToArcGIS(geojson, idAttribute) {
|
|
669
|
+
idAttribute = idAttribute || 'OBJECTID';
|
|
670
|
+
var spatialReference = {
|
|
671
|
+
wkid: 4326
|
|
672
|
+
};
|
|
673
|
+
var result = {};
|
|
674
|
+
var i;
|
|
675
|
+
|
|
676
|
+
switch (geojson.type) {
|
|
677
|
+
case 'Point':
|
|
678
|
+
result.x = geojson.coordinates[0];
|
|
679
|
+
result.y = geojson.coordinates[1];
|
|
680
|
+
|
|
681
|
+
if (geojson.coordinates[2] != null) {
|
|
682
|
+
result.z = geojson.coordinates[2];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
result.spatialReference = spatialReference;
|
|
686
|
+
break;
|
|
687
|
+
|
|
688
|
+
case 'MultiPoint':
|
|
689
|
+
result.points = geojson.coordinates.slice(0);
|
|
690
|
+
|
|
691
|
+
if (geojson.coordinates[0][2] != null) {
|
|
692
|
+
result.hasZ = true;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
result.spatialReference = spatialReference;
|
|
696
|
+
break;
|
|
697
|
+
|
|
698
|
+
case 'LineString':
|
|
699
|
+
result.paths = [geojson.coordinates.slice(0)];
|
|
700
|
+
|
|
701
|
+
if (geojson.coordinates[0][2] != null) {
|
|
702
|
+
result.hasZ = true;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
result.spatialReference = spatialReference;
|
|
706
|
+
break;
|
|
707
|
+
|
|
708
|
+
case 'MultiLineString':
|
|
709
|
+
result.paths = geojson.coordinates.slice(0);
|
|
710
|
+
|
|
711
|
+
if (geojson.coordinates[0][0][2] != null) {
|
|
712
|
+
result.hasZ = true;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
result.spatialReference = spatialReference;
|
|
716
|
+
break;
|
|
717
|
+
|
|
718
|
+
case 'Polygon':
|
|
719
|
+
result.rings = orientRings(geojson.coordinates.slice(0));
|
|
720
|
+
|
|
721
|
+
if (geojson.coordinates[0][0][2] != null) {
|
|
722
|
+
result.hasZ = true;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
result.spatialReference = spatialReference;
|
|
726
|
+
break;
|
|
727
|
+
|
|
728
|
+
case 'MultiPolygon':
|
|
729
|
+
result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));
|
|
730
|
+
|
|
731
|
+
if (geojson.coordinates[0][0][0][2] != null) {
|
|
732
|
+
result.hasZ = true;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
result.spatialReference = spatialReference;
|
|
736
|
+
break;
|
|
737
|
+
|
|
738
|
+
case 'Feature':
|
|
739
|
+
if (geojson.geometry) {
|
|
740
|
+
result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
result.attributes = geojson.properties ? shallowClone(geojson.properties) : {};
|
|
744
|
+
|
|
745
|
+
if (geojson.id) {
|
|
746
|
+
result.attributes[idAttribute] = geojson.id;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
break;
|
|
750
|
+
|
|
751
|
+
case 'FeatureCollection':
|
|
752
|
+
result = [];
|
|
753
|
+
|
|
754
|
+
for (i = 0; i < geojson.features.length; i++) {
|
|
755
|
+
result.push(geojsonToArcGIS(geojson.features[i], idAttribute));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
break;
|
|
759
|
+
|
|
760
|
+
case 'GeometryCollection':
|
|
761
|
+
result = [];
|
|
762
|
+
|
|
763
|
+
for (i = 0; i < geojson.geometries.length; i++) {
|
|
764
|
+
result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute));
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
return result;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
774
|
+
name: "VkfEsriInputGeojson",
|
|
775
|
+
components: {
|
|
776
|
+
VkfInput: input.VkfInput,
|
|
777
|
+
VaSketch: core.VaSketch,
|
|
778
|
+
ViewerVue,
|
|
779
|
+
VkAsyncTeleport: core$1.VkAsyncTeleport,
|
|
780
|
+
DocumentChecked: index.document_checked_default,
|
|
781
|
+
VaGraphicsLayer: core.VaGraphicsLayer
|
|
782
|
+
},
|
|
783
|
+
props,
|
|
784
|
+
emits,
|
|
785
|
+
setup(props2, {
|
|
786
|
+
emit
|
|
787
|
+
}) {
|
|
788
|
+
const inputBindProps = input._VkfInputCtx.createBindProps(props2, ["inputSlots", "readonly", "modelValue"]);
|
|
789
|
+
const inputOnEmits = input._VkfInputCtx.createOnEmits(emit, ["update:modelValue"]);
|
|
790
|
+
const getInputModelValue = v => {
|
|
791
|
+
const emptyStr = "\u6682\u65E0\u6570\u636E";
|
|
792
|
+
if (!v) return emptyStr;
|
|
793
|
+
if (!v.features.length) return emptyStr;
|
|
794
|
+
return JSON.stringify(v);
|
|
795
|
+
};
|
|
796
|
+
const readonly = composables.useComputedReadonly(props2);
|
|
797
|
+
const sketchIf = vue.ref(!props2.view);
|
|
798
|
+
const sketchRef = vue.shallowRef();
|
|
799
|
+
const shetchPanel = vue.computed(() => {
|
|
800
|
+
const container = sketchRef.value?.container;
|
|
801
|
+
return container?.querySelector(".esri-sketch__panel");
|
|
802
|
+
});
|
|
803
|
+
const viewDef = new utilsPromise.Deferred();
|
|
804
|
+
const layerRef = vue.shallowRef();
|
|
805
|
+
const sketchLoad = async e => {
|
|
806
|
+
await e.sketch.when();
|
|
807
|
+
sketchRef.value = e.sketch;
|
|
808
|
+
viewDef.resolve(sketchRef.value.view);
|
|
809
|
+
};
|
|
810
|
+
const layerLoad = async ({
|
|
811
|
+
view,
|
|
812
|
+
layer
|
|
813
|
+
}) => {
|
|
814
|
+
viewDef.resolve(view);
|
|
815
|
+
layerRef.value = layer;
|
|
816
|
+
};
|
|
817
|
+
const availableCreatureTools = vue.computed(() => {
|
|
818
|
+
if (Array.isArray(props2.editTypes)) {
|
|
819
|
+
return props2.editTypes.reduce((pre, cur) => {
|
|
820
|
+
return pre.concat(EDIT_TYPE_REFLECT[cur].availableCreatureTools);
|
|
821
|
+
}, []);
|
|
822
|
+
} else {
|
|
823
|
+
return EDIT_TYPE_REFLECT[props2.editTypes].availableCreatureTools;
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
const sketchValueUpdating = vue.ref(false);
|
|
827
|
+
const sketchValue = vue.shallowRef([]);
|
|
828
|
+
vue.watch(() => props2.modelValue, (v, ov) => {
|
|
829
|
+
if (sketchValueUpdating.value) return;
|
|
830
|
+
uSketchValue();
|
|
831
|
+
if (!ov?.features.length) {
|
|
832
|
+
fly();
|
|
833
|
+
}
|
|
834
|
+
}, {
|
|
835
|
+
immediate: true
|
|
836
|
+
});
|
|
837
|
+
const handleUpdateSketchValue = e => {
|
|
838
|
+
sketchValue.value = e;
|
|
839
|
+
if (props2.skipSave) {
|
|
840
|
+
u();
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
const normalMapRef = vue.shallowRef();
|
|
844
|
+
const dialogMapRef = vue.shallowRef();
|
|
845
|
+
const mapTo = vue.shallowRef();
|
|
846
|
+
vue.onMounted(() => {
|
|
847
|
+
mapTo.value = normalMapRef.value;
|
|
848
|
+
});
|
|
849
|
+
const dialogShow = vue.ref(false);
|
|
850
|
+
const setDialogShow = v => {
|
|
851
|
+
dialogShow.value = v;
|
|
852
|
+
};
|
|
853
|
+
const dialogOnOpen = async () => {
|
|
854
|
+
mapTo.value = dialogMapRef.value;
|
|
855
|
+
};
|
|
856
|
+
const dialogOnClose = async () => {
|
|
857
|
+
mapTo.value = normalMapRef.value;
|
|
858
|
+
};
|
|
859
|
+
const doSave = () => {
|
|
860
|
+
u();
|
|
861
|
+
elementPlus.ElMessage({
|
|
862
|
+
message: "\u4FDD\u5B58\u6210\u529F",
|
|
863
|
+
type: "success"
|
|
864
|
+
});
|
|
865
|
+
dialogShow.value = false;
|
|
866
|
+
if (props2.view) {
|
|
867
|
+
sketchIf.value = false;
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
const append = () => vue.createVNode(AppendVue, {
|
|
871
|
+
"dialog": !readonly.value && props2.dialogEdit,
|
|
872
|
+
"upload": !readonly.value,
|
|
873
|
+
"disabled": props2.disabled,
|
|
874
|
+
"onUpload": onUpload,
|
|
875
|
+
"onEdit": onEdit,
|
|
876
|
+
"onFly": () => {
|
|
877
|
+
if (!props2.showMap && !props2.view) {
|
|
878
|
+
dialogShow.value = true;
|
|
879
|
+
}
|
|
880
|
+
emit("appendFly");
|
|
881
|
+
fly();
|
|
882
|
+
}
|
|
883
|
+
}, null);
|
|
884
|
+
async function onUpload(e) {
|
|
885
|
+
if (!e.raw) return;
|
|
886
|
+
index$1.toGeojson(e.raw).then(res => {
|
|
887
|
+
emit("update:modelValue", res);
|
|
888
|
+
}).then(() => {
|
|
889
|
+
elementPlus.ElMessage.success("\u4E0A\u4F20\u6210\u529F");
|
|
890
|
+
}).then(fly);
|
|
891
|
+
}
|
|
892
|
+
function onEdit() {
|
|
893
|
+
if (!props2.view) {
|
|
894
|
+
dialogShow.value = true;
|
|
895
|
+
} else {
|
|
896
|
+
sketchIf.value = true;
|
|
897
|
+
}
|
|
898
|
+
emit("appendEdit");
|
|
899
|
+
}
|
|
900
|
+
function u() {
|
|
901
|
+
sketchValueUpdating.value = true;
|
|
902
|
+
const features = sketchValue.value.map(item => {
|
|
903
|
+
return arcgisToGeoJSON(item);
|
|
904
|
+
});
|
|
905
|
+
emit("update:modelValue", {
|
|
906
|
+
type: "FeatureCollection",
|
|
907
|
+
features
|
|
908
|
+
});
|
|
909
|
+
vue.nextTick(() => {
|
|
910
|
+
sketchValueUpdating.value = false;
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
function uSketchValue() {
|
|
914
|
+
const esriData = geojsonToArcGIS(props2.modelValue);
|
|
915
|
+
const graphics = esriData.map(item => {
|
|
916
|
+
const g = item.geometry;
|
|
917
|
+
if (g.rings) {
|
|
918
|
+
g.type = "polygon";
|
|
919
|
+
item.symbol = props2.viewModelActiveFillSymbol;
|
|
920
|
+
} else if (g.paths) {
|
|
921
|
+
g.type = "polyline";
|
|
922
|
+
item.symbol = props2.viewModelActiveLineSymbol;
|
|
923
|
+
} else if (g.x) {
|
|
924
|
+
g.type = "point";
|
|
925
|
+
item.symbol = props2.viewModelActivePointSymbol;
|
|
926
|
+
}
|
|
927
|
+
return new Graphic(item);
|
|
928
|
+
});
|
|
929
|
+
sketchValue.value = graphics;
|
|
930
|
+
}
|
|
931
|
+
vue.watch(() => props2.flying, v => {
|
|
932
|
+
v && fly();
|
|
933
|
+
});
|
|
934
|
+
async function fly() {
|
|
935
|
+
const view = await viewDef.promise;
|
|
936
|
+
if (!view) return;
|
|
937
|
+
emit("update:flying", true);
|
|
938
|
+
await view.when();
|
|
939
|
+
view.goTo(sketchValue.value).finally(() => {
|
|
940
|
+
emit("update:flying", false);
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
return {
|
|
944
|
+
inputBindProps,
|
|
945
|
+
inputOnEmits,
|
|
946
|
+
append,
|
|
947
|
+
availableCreatureTools,
|
|
948
|
+
sketchValue,
|
|
949
|
+
handleUpdateSketchValue,
|
|
950
|
+
sketchRef,
|
|
951
|
+
sketchLoad,
|
|
952
|
+
shetchPanel,
|
|
953
|
+
dialogShow,
|
|
954
|
+
setDialogShow,
|
|
955
|
+
normalMapRef,
|
|
956
|
+
dialogMapRef,
|
|
957
|
+
dialogOnOpen,
|
|
958
|
+
dialogOnClose,
|
|
959
|
+
mapTo,
|
|
960
|
+
doSave,
|
|
961
|
+
readonly,
|
|
962
|
+
layerLoad,
|
|
963
|
+
sketchIf,
|
|
964
|
+
fly,
|
|
965
|
+
layerRef,
|
|
966
|
+
getInputModelValue
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
const _hoisted_1 = { class: "vkf-form-item" };
|
|
972
|
+
const _hoisted_2 = {
|
|
973
|
+
ref: "normalMapRef",
|
|
974
|
+
class: "vkf-esri-input-geojson__map"
|
|
975
|
+
};
|
|
976
|
+
const _hoisted_3 = {
|
|
977
|
+
ref: "dialogMapRef",
|
|
978
|
+
class: "vkf-esri-input-geojson-dialog__map"
|
|
979
|
+
};
|
|
980
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
981
|
+
const _component_VkfInput = vue.resolveComponent("VkfInput");
|
|
982
|
+
const _component_DocumentChecked = vue.resolveComponent("DocumentChecked");
|
|
983
|
+
const _component_ElIcon = vue.resolveComponent("ElIcon");
|
|
984
|
+
const _component_VkAsyncTeleport = vue.resolveComponent("VkAsyncTeleport");
|
|
985
|
+
const _component_VaSketch = vue.resolveComponent("VaSketch");
|
|
986
|
+
const _component_VaGraphicsLayer = vue.resolveComponent("VaGraphicsLayer");
|
|
987
|
+
const _component_ViewerVue = vue.resolveComponent("ViewerVue");
|
|
988
|
+
const _component_ElDialog = vue.resolveComponent("ElDialog");
|
|
989
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
990
|
+
vue.renderSlot(_ctx.$slots, "custom", {
|
|
991
|
+
modelValue: _ctx.modelValue,
|
|
992
|
+
fly: _ctx.fly,
|
|
993
|
+
setDialogShow: _ctx.setDialogShow,
|
|
994
|
+
layer: _ctx.layerRef,
|
|
995
|
+
showMap: _ctx.showMap
|
|
996
|
+
}, () => [
|
|
997
|
+
vue.createVNode(_component_VkfInput, vue.mergeProps({
|
|
998
|
+
readonly: true,
|
|
999
|
+
"model-value": _ctx.getInputModelValue(_ctx.modelValue)
|
|
1000
|
+
}, _ctx.inputBindProps, {
|
|
1001
|
+
"input-slots": {
|
|
1002
|
+
append: _ctx.append
|
|
1003
|
+
}
|
|
1004
|
+
}, vue.toHandlers(_ctx.inputOnEmits)), null, 16, ["model-value", "input-slots"])
|
|
1005
|
+
]),
|
|
1006
|
+
vue.createVNode(_component_VkAsyncTeleport, { to: _ctx.mapTo }, {
|
|
1007
|
+
default: vue.withCtx(() => [
|
|
1008
|
+
vue.createVNode(_component_ViewerVue, {
|
|
1009
|
+
view: _ctx.view,
|
|
1010
|
+
"view-component": _ctx.viewComponent,
|
|
1011
|
+
"view-component-attrs": _ctx.viewComponentAttrs
|
|
1012
|
+
}, {
|
|
1013
|
+
default: vue.withCtx(() => [
|
|
1014
|
+
vue.createVNode(_component_VaGraphicsLayer, {
|
|
1015
|
+
index: _ctx.layerIndex,
|
|
1016
|
+
graphics: _ctx.sketchValue,
|
|
1017
|
+
onLoad: _ctx.layerLoad
|
|
1018
|
+
}, {
|
|
1019
|
+
default: vue.withCtx(() => [
|
|
1020
|
+
!(_ctx.readonly || !_ctx.sketchIf) ? (vue.openBlock(), vue.createBlock(_component_VaSketch, {
|
|
1021
|
+
key: 0,
|
|
1022
|
+
"view-model-active-fill-symbol": _ctx.viewModelActiveFillSymbol,
|
|
1023
|
+
"view-model-active-line-symbol": _ctx.viewModelActiveLineSymbol,
|
|
1024
|
+
"view-model-active-point-symbol": _ctx.viewModelActivePointSymbol,
|
|
1025
|
+
multiple: _ctx.multiple,
|
|
1026
|
+
"available-creature-tools": _ctx.availableCreatureTools,
|
|
1027
|
+
"model-value": _ctx.sketchValue,
|
|
1028
|
+
"visible-elements": _ctx.visibleElements,
|
|
1029
|
+
"onUpdate:modelValue": _ctx.handleUpdateSketchValue,
|
|
1030
|
+
onLoad: _ctx.sketchLoad
|
|
1031
|
+
}, {
|
|
1032
|
+
default: vue.withCtx(() => [
|
|
1033
|
+
!_ctx.skipSave && _ctx.shetchPanel ? (vue.openBlock(), vue.createBlock(_component_VkAsyncTeleport, {
|
|
1034
|
+
key: 0,
|
|
1035
|
+
to: _ctx.shetchPanel
|
|
1036
|
+
}, {
|
|
1037
|
+
default: vue.withCtx(() => [
|
|
1038
|
+
vue.createVNode(_component_ElIcon, {
|
|
1039
|
+
class: "esri-sketch-ui-save esri-widget--button",
|
|
1040
|
+
onClick: _ctx.doSave
|
|
1041
|
+
}, {
|
|
1042
|
+
default: vue.withCtx(() => [
|
|
1043
|
+
vue.createVNode(_component_DocumentChecked)
|
|
1044
|
+
]),
|
|
1045
|
+
_: 1
|
|
1046
|
+
/* STABLE */
|
|
1047
|
+
}, 8, ["onClick"])
|
|
1048
|
+
]),
|
|
1049
|
+
_: 1
|
|
1050
|
+
/* STABLE */
|
|
1051
|
+
}, 8, ["to"])) : vue.createCommentVNode("v-if", true)
|
|
1052
|
+
]),
|
|
1053
|
+
_: 1
|
|
1054
|
+
/* STABLE */
|
|
1055
|
+
}, 8, ["view-model-active-fill-symbol", "view-model-active-line-symbol", "view-model-active-point-symbol", "multiple", "available-creature-tools", "model-value", "visible-elements", "onUpdate:modelValue", "onLoad"])) : vue.createCommentVNode("v-if", true)
|
|
1056
|
+
]),
|
|
1057
|
+
_: 1
|
|
1058
|
+
/* STABLE */
|
|
1059
|
+
}, 8, ["index", "graphics", "onLoad"])
|
|
1060
|
+
]),
|
|
1061
|
+
_: 1
|
|
1062
|
+
/* STABLE */
|
|
1063
|
+
}, 8, ["view", "view-component", "view-component-attrs"])
|
|
1064
|
+
]),
|
|
1065
|
+
_: 1
|
|
1066
|
+
/* STABLE */
|
|
1067
|
+
}, 8, ["to"]),
|
|
1068
|
+
vue.withDirectives(vue.createElementVNode(
|
|
1069
|
+
"div",
|
|
1070
|
+
_hoisted_2,
|
|
1071
|
+
null,
|
|
1072
|
+
512
|
|
1073
|
+
/* NEED_PATCH */
|
|
1074
|
+
), [
|
|
1075
|
+
[vue.vShow, _ctx.showMap]
|
|
1076
|
+
]),
|
|
1077
|
+
vue.createVNode(_component_ElDialog, {
|
|
1078
|
+
modelValue: _ctx.dialogShow,
|
|
1079
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.dialogShow = $event),
|
|
1080
|
+
title: _ctx.dialogEditTitle,
|
|
1081
|
+
fullscreen: _ctx.dialogEditFullscreen,
|
|
1082
|
+
"modal-class": "vkf-esri-input-geojson-dialog",
|
|
1083
|
+
"append-to-body": true,
|
|
1084
|
+
"close-on-click-modal": false,
|
|
1085
|
+
draggable: true,
|
|
1086
|
+
onOpen: _ctx.dialogOnOpen,
|
|
1087
|
+
onClose: _ctx.dialogOnClose
|
|
1088
|
+
}, {
|
|
1089
|
+
default: vue.withCtx(() => [
|
|
1090
|
+
vue.createElementVNode(
|
|
1091
|
+
"div",
|
|
1092
|
+
_hoisted_3,
|
|
1093
|
+
null,
|
|
1094
|
+
512
|
|
1095
|
+
/* NEED_PATCH */
|
|
1096
|
+
)
|
|
1097
|
+
]),
|
|
1098
|
+
_: 1
|
|
1099
|
+
/* STABLE */
|
|
1100
|
+
}, 8, ["modelValue", "title", "fullscreen", "onOpen", "onClose"])
|
|
1101
|
+
]);
|
|
1102
|
+
}
|
|
1103
|
+
var VkfEsriInputGeojson = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/esri-input-geojson/src/index.vue"]]);
|
|
1104
|
+
|
|
1105
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
1106
|
+
__proto__: null
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
VkfEsriInputGeojson.install = (app) => {
|
|
1110
|
+
app.component(VkfEsriInputGeojson.name, VkfEsriInputGeojson);
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
exports.EDIT_TYPE = EDIT_TYPE;
|
|
1114
|
+
exports.EDIT_TYPE_OPTIONS = EDIT_TYPE_OPTIONS;
|
|
1115
|
+
exports.EDIT_TYPE_REFLECT = EDIT_TYPE_REFLECT;
|
|
1116
|
+
exports.EMPTY_FEATURE_COLLECTION = EMPTY_FEATURE_COLLECTION;
|
|
1117
|
+
exports.VkfEsriInputGeojson = VkfEsriInputGeojson;
|
|
1118
|
+
exports._VkfEsriInputGeojsonCtx = ctx;
|
|
1119
|
+
exports.__VkfEsriInputGeojson = types;
|
|
1120
|
+
exports.default = VkfEsriInputGeojson;
|