gisviewer-vue3-arcgis 1.0.142 → 1.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/src/gis-map/gis-map.vue.d.ts +0 -17
- package/es/src/gis-map/gis-map.vue.mjs +113 -118
- package/es/src/gis-map/index.d.ts +0 -17
- package/es/src/gis-map/stores/appData.d.ts +1 -0
- package/es/src/gis-map/stores/appData.mjs +2 -1
- package/es/src/gis-map/utils/map-initializer.mjs +6 -6
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +231 -215
- package/es/src/gis-map/utils/signal-control-area-controller/index.mjs +3 -3
- package/es/src/gis-map/utils/sketchView.d.ts +14 -14
- package/es/src/gis-map/utils/sketchView.mjs +173 -164
- package/es/src/gis-map/utils/sketchViewTool.d.ts +16 -16
- package/es/src/gis-map/utils/sketchViewTool.mjs +39 -39
- package/es/style.css +1 -1
- package/lib/src/gis-map/gis-map.vue.d.ts +0 -17
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +0 -17
- package/lib/src/gis-map/stores/appData.d.ts +1 -0
- package/lib/src/gis-map/stores/appData.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -1
- package/lib/src/gis-map/utils/sketchView.d.ts +14 -14
- package/lib/src/gis-map/utils/sketchView.js +1 -1
- package/lib/src/gis-map/utils/sketchViewTool.d.ts +16 -16
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -1
- package/package.json +1 -1
- package/es/_virtual/_plugin-vue_export-helper.mjs +0 -9
- package/es/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
- package/es/src/gis-map/utils/components/sketch-tool.vue.mjs +0 -7
- package/es/src/gis-map/utils/components/sketch-tool.vue2.mjs +0 -48
- package/es/src/gis-map/utils/components/sketch-tool.vue3.mjs +0 -4
- package/lib/_virtual/_plugin-vue_export-helper.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue.d.ts +0 -18
- package/lib/src/gis-map/utils/components/sketch-tool.vue.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue2.js +0 -1
- package/lib/src/gis-map/utils/components/sketch-tool.vue3.js +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import b from "@arcgis/core/widgets/Sketch";
|
|
4
|
-
import * as y from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
5
|
-
import * as G from "@arcgis/core/geometry/geometryEngine.js";
|
|
1
|
+
import * as L from "@arcgis/core/geometry/geometryEngine.js";
|
|
2
|
+
import * as g from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
6
3
|
import l from "@arcgis/core/Graphic";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
4
|
+
import f from "@arcgis/core/layers/GraphicsLayer";
|
|
5
|
+
import G from "@arcgis/core/widgets/Sketch";
|
|
6
|
+
import P from "@arcgis/core/widgets/Sketch/SketchViewModel";
|
|
7
|
+
import S from "@arcgis/core/geometry/Polygon.js";
|
|
8
|
+
import b from "@arcgis/core/geometry/Polyline.js";
|
|
9
|
+
import * as d from "@turf/helpers";
|
|
10
|
+
import k from "@turf/intersect";
|
|
11
|
+
import { v4 as A } from "uuid";
|
|
12
|
+
import M from "../stores/index.mjs";
|
|
13
|
+
function u(c, t = []) {
|
|
13
14
|
if (c === null || typeof c != "object")
|
|
14
15
|
return c;
|
|
15
16
|
if (Object.prototype.toString.call(c) === "[object Date]")
|
|
@@ -18,29 +19,29 @@ function w(c, e = []) {
|
|
|
18
19
|
return new RegExp(c);
|
|
19
20
|
if (Object.prototype.toString.call(c) === "[object Error]")
|
|
20
21
|
return new Error(c);
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
22
|
+
const e = t.filter((s) => s.original === c)[0];
|
|
23
|
+
if (e)
|
|
24
|
+
return e.copy;
|
|
24
25
|
const i = Array.isArray(c) ? [] : {};
|
|
25
|
-
return
|
|
26
|
+
return t.push({
|
|
26
27
|
original: c,
|
|
27
28
|
copy: i
|
|
28
29
|
}), Object.keys(c).forEach((s) => {
|
|
29
|
-
i[s] =
|
|
30
|
+
i[s] = u(c[s], t);
|
|
30
31
|
}), i;
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
+
const x = {
|
|
33
34
|
maxAllowedGraphics: 0,
|
|
34
35
|
GraphicsLayer: {},
|
|
35
|
-
|
|
36
|
-
sketchPosition: "top-
|
|
37
|
-
|
|
36
|
+
sketchVisibleElements: {},
|
|
37
|
+
sketchPosition: "top-right",
|
|
38
|
+
defaultSketchVisible: !0,
|
|
38
39
|
sketchViewModelItemSymbol: {}
|
|
39
|
-
},
|
|
40
|
+
}, m = {
|
|
40
41
|
type: "simple-line",
|
|
41
42
|
color: "#556DEA",
|
|
42
43
|
width: 2
|
|
43
|
-
},
|
|
44
|
+
}, y = {
|
|
44
45
|
type: "simple-fill",
|
|
45
46
|
// autocasts as new SimpleFillSymbol()
|
|
46
47
|
color: [227, 139, 79, 0.4],
|
|
@@ -50,38 +51,42 @@ const S = {
|
|
|
50
51
|
width: 1
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
class
|
|
54
|
-
constructor(
|
|
55
|
-
this.viewer =
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
}, this.graphicsLayer = new
|
|
54
|
+
class B {
|
|
55
|
+
constructor(t, e) {
|
|
56
|
+
this.viewer = t, this.options = {
|
|
57
|
+
...x,
|
|
58
|
+
...e
|
|
59
|
+
}, this.graphicsLayer = new f({ ...this.options.GraphicsLayer }), this.TextGraphicsLayer = new f(), this.viewer.map.layers.add(this.graphicsLayer), this.viewer.map.layers.add(this.TextGraphicsLayer), this.init();
|
|
59
60
|
}
|
|
60
61
|
init() {
|
|
61
|
-
this.sketchViewModel = new
|
|
62
|
+
this.sketchViewModel = new P({
|
|
62
63
|
layer: this.graphicsLayer,
|
|
63
64
|
view: this.viewer,
|
|
64
65
|
updateOnGraphicClick: !0,
|
|
65
|
-
polylineSymbol:
|
|
66
|
-
polygonSymbol:
|
|
66
|
+
polylineSymbol: m,
|
|
67
|
+
polygonSymbol: y,
|
|
67
68
|
...this.options.sketchViewModelItemSymbol
|
|
68
69
|
});
|
|
69
|
-
const
|
|
70
|
-
|
|
70
|
+
const t = this.findLayerById("TrafficMarkings"), e = [];
|
|
71
|
+
t && e.push({ layer: t, enabled: !0 }), this.sketch = new G({
|
|
71
72
|
view: this.viewer,
|
|
72
73
|
viewModel: this.sketchViewModel,
|
|
73
74
|
layer: this.graphicsLayer,
|
|
74
|
-
visible: this.options.
|
|
75
|
+
visible: this.options.defaultSketchVisible,
|
|
75
76
|
snappingOptions: {
|
|
76
77
|
// autocasts to SnappingOptions()
|
|
77
78
|
enabled: !0,
|
|
78
79
|
// global snapping is turned on
|
|
79
80
|
// assigns a collection of FeatureSnappingLayerSource() and enables feature snapping on this layer
|
|
80
|
-
featureSources:
|
|
81
|
+
featureSources: e
|
|
81
82
|
}
|
|
82
83
|
}), this.sketch.visibleElements = {
|
|
83
|
-
...this.options.
|
|
84
|
+
...this.options.sketchVisibleElements
|
|
84
85
|
}, this.viewer.ui.add(this.sketch, this.options.sketchPosition);
|
|
86
|
+
const i = M.useAppDataStore;
|
|
87
|
+
this.sketch.on("create", (s) => {
|
|
88
|
+
s.state === "complete" ? i.isSketching = !1 : s.state === "start" && (i.isSketching = !0);
|
|
89
|
+
});
|
|
85
90
|
}
|
|
86
91
|
/**
|
|
87
92
|
* 初始化绘图
|
|
@@ -92,16 +97,16 @@ class C {
|
|
|
92
97
|
* @returns
|
|
93
98
|
* @memberof SketchView
|
|
94
99
|
*/
|
|
95
|
-
initPoint(
|
|
96
|
-
if (!
|
|
100
|
+
initPoint(t, e = "all", i = !1) {
|
|
101
|
+
if (!t)
|
|
97
102
|
return;
|
|
98
|
-
const { crossArea: s, sectionArea: r } =
|
|
99
|
-
if (s && (
|
|
103
|
+
const { crossArea: s, sectionArea: r } = t;
|
|
104
|
+
if (s && (e == "crossArea" || e == "all")) {
|
|
100
105
|
const o = this.initCrossArea(s);
|
|
101
106
|
this.graphicsLayer.add(o);
|
|
102
107
|
}
|
|
103
|
-
if (r && (
|
|
104
|
-
const o = this.
|
|
108
|
+
if (r && (e == "sectionArea" || e == "all")) {
|
|
109
|
+
const o = this.initSectionArea(r, i);
|
|
105
110
|
this.graphicsLayer.addMany(o);
|
|
106
111
|
}
|
|
107
112
|
}
|
|
@@ -111,15 +116,14 @@ class C {
|
|
|
111
116
|
* @param {any[]} data
|
|
112
117
|
* @memberof SketchView
|
|
113
118
|
*/
|
|
114
|
-
initEntranceFusionZone(
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}), this.graphicsLayer.addMany(
|
|
119
|
+
initEntranceFusionZone(t) {
|
|
120
|
+
const e = [];
|
|
121
|
+
t.map((i) => {
|
|
122
|
+
e.push(this.createPolygonGraphic(i, y, {}));
|
|
123
|
+
}), this.graphicsLayer.addMany(e);
|
|
119
124
|
}
|
|
120
|
-
initCrossArea(
|
|
121
|
-
|
|
122
|
-
return this.createPolygonGraphic(e, t, {});
|
|
125
|
+
initCrossArea(t) {
|
|
126
|
+
return this.createPolygonGraphic(t, y, {});
|
|
123
127
|
}
|
|
124
128
|
/**
|
|
125
129
|
* 初始进出口道计算区域
|
|
@@ -129,79 +133,83 @@ class C {
|
|
|
129
133
|
* @returns
|
|
130
134
|
* @memberof SketchView
|
|
131
135
|
*/
|
|
132
|
-
|
|
133
|
-
const i = [], s =
|
|
136
|
+
initSectionArea(t, e = !1) {
|
|
137
|
+
const i = [], s = {
|
|
134
138
|
type: "simple-line",
|
|
135
139
|
color: [0, 0, 255],
|
|
136
140
|
width: 2
|
|
137
141
|
};
|
|
138
|
-
return Object.keys(
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
return Object.keys(t).map((r) => {
|
|
143
|
+
const o = t[r][0], a = t[r][1];
|
|
144
|
+
e && (o.reverse(), a.reverse());
|
|
145
|
+
const n = A(), h = this.createPolylineGraphic(
|
|
146
|
+
o,
|
|
147
|
+
m,
|
|
148
|
+
{
|
|
149
|
+
type: "draw",
|
|
150
|
+
id: n
|
|
151
|
+
}
|
|
152
|
+
), p = this.createPolylineGraphic(a, s, {
|
|
145
153
|
type: "shiftLine",
|
|
146
|
-
id:
|
|
154
|
+
id: n
|
|
147
155
|
});
|
|
148
|
-
i.push(
|
|
156
|
+
i.push(h, p);
|
|
149
157
|
}), i;
|
|
150
158
|
}
|
|
151
|
-
createPolylineGraphic(
|
|
152
|
-
const s = new
|
|
153
|
-
paths:
|
|
154
|
-
}), r =
|
|
159
|
+
createPolylineGraphic(t, e, i) {
|
|
160
|
+
const s = new b({
|
|
161
|
+
paths: t
|
|
162
|
+
}), r = g.geographicToWebMercator(s);
|
|
155
163
|
return new l({
|
|
156
164
|
geometry: r,
|
|
157
165
|
// Add the geometry created in step 3
|
|
158
|
-
symbol:
|
|
166
|
+
symbol: e,
|
|
159
167
|
// Add the symbol created in step 4
|
|
160
168
|
attributes: i
|
|
161
169
|
});
|
|
162
170
|
}
|
|
163
|
-
createPolygonGraphic(
|
|
164
|
-
const s = new
|
|
165
|
-
rings:
|
|
166
|
-
}), r =
|
|
171
|
+
createPolygonGraphic(t, e, i) {
|
|
172
|
+
const s = new S({
|
|
173
|
+
rings: t
|
|
174
|
+
}), r = g.geographicToWebMercator(s);
|
|
167
175
|
return new l({
|
|
168
176
|
geometry: r,
|
|
169
177
|
// Add the geometry created in step 3
|
|
170
|
-
symbol:
|
|
178
|
+
symbol: e,
|
|
171
179
|
// Add the symbol created in step 4
|
|
172
180
|
attributes: i
|
|
173
181
|
});
|
|
174
182
|
}
|
|
175
|
-
on(
|
|
176
|
-
const
|
|
183
|
+
on(t) {
|
|
184
|
+
const e = this;
|
|
177
185
|
this.sketchViewModel.on("create", function(i) {
|
|
178
186
|
var r, o, a;
|
|
179
|
-
const s =
|
|
180
|
-
if ((r =
|
|
181
|
-
|
|
187
|
+
const s = e.graphicsLayer.graphics;
|
|
188
|
+
if ((r = e.options) != null && r.maxAllowedGraphics && s.length > ((o = e.options) == null ? void 0 : o.maxAllowedGraphics)) {
|
|
189
|
+
e.graphicsLayer.remove(i.graphic), console.log("已达到最大图形数量,无法继续绘制!");
|
|
182
190
|
return;
|
|
183
191
|
}
|
|
184
192
|
if (i.state === "complete" && ((a = i.graphic) != null && a.geometry)) {
|
|
185
193
|
console.log(i.graphic);
|
|
186
194
|
const n = i.graphic.geometry;
|
|
187
195
|
i.graphic.setAttribute("type", "draw"), i.graphic.setAttribute("id", new Date().getTime());
|
|
188
|
-
const h =
|
|
189
|
-
|
|
196
|
+
const h = e.getGraphicPoint(n);
|
|
197
|
+
t && t("create", h, i);
|
|
190
198
|
}
|
|
191
199
|
}), this.sketchViewModel.on("update", function(i) {
|
|
192
200
|
if (console.log("update", i), i.aborted) {
|
|
193
201
|
const s = i.graphics[0];
|
|
194
|
-
|
|
202
|
+
e.graphicsLayer.remove(s);
|
|
195
203
|
return;
|
|
196
204
|
}
|
|
197
205
|
if (i.state === "complete" && i.graphics.length > 0) {
|
|
198
|
-
const r = i.graphics[0].geometry, o =
|
|
199
|
-
|
|
206
|
+
const r = i.graphics[0].geometry, o = e.getGraphicPoint(r);
|
|
207
|
+
t && t("update", o, i);
|
|
200
208
|
}
|
|
201
209
|
}), this.sketchViewModel.on("delete", function(i) {
|
|
202
|
-
if (console.log("delete", i,
|
|
203
|
-
const r = i.graphics[0].geometry, o =
|
|
204
|
-
|
|
210
|
+
if (console.log("delete", i, e.graphicsLayer.graphics), i.graphics.length > 0) {
|
|
211
|
+
const r = i.graphics[0].geometry, o = e.getGraphicPoint(r);
|
|
212
|
+
t && t("delete", o, i);
|
|
205
213
|
}
|
|
206
214
|
});
|
|
207
215
|
}
|
|
@@ -210,16 +218,16 @@ class C {
|
|
|
210
218
|
* @returns
|
|
211
219
|
*/
|
|
212
220
|
graphicPoint() {
|
|
213
|
-
const
|
|
214
|
-
return this.graphicsLayer.graphics.map((
|
|
221
|
+
const t = [];
|
|
222
|
+
return this.graphicsLayer.graphics.map((e) => {
|
|
215
223
|
var r;
|
|
216
|
-
const i =
|
|
217
|
-
|
|
224
|
+
const i = e.geometry, s = this.getGraphicPoint(i);
|
|
225
|
+
t.push({
|
|
218
226
|
point: s,
|
|
219
|
-
type: (r =
|
|
220
|
-
attributes:
|
|
227
|
+
type: (r = e.attributes) == null ? void 0 : r.type,
|
|
228
|
+
attributes: e.attributes
|
|
221
229
|
});
|
|
222
|
-
}),
|
|
230
|
+
}), t;
|
|
223
231
|
}
|
|
224
232
|
/**
|
|
225
233
|
* 获取进口道区域
|
|
@@ -227,15 +235,15 @@ class C {
|
|
|
227
235
|
* @memberof SketchView
|
|
228
236
|
*/
|
|
229
237
|
getEntranceRoad() {
|
|
230
|
-
const
|
|
238
|
+
const t = {}, e = this.graphicPoint().filter(
|
|
231
239
|
(n) => n.point.type === "polyline"
|
|
232
240
|
);
|
|
233
241
|
if (console.log(
|
|
234
242
|
"🚀 ~ file: sketchView.ts:378 ~ SketchView ~ getEntranceRoad ~ graphics:",
|
|
235
|
-
|
|
236
|
-
), !
|
|
243
|
+
e
|
|
244
|
+
), !e.length)
|
|
237
245
|
return !1;
|
|
238
|
-
const i =
|
|
246
|
+
const i = e.filter((n) => n.type == "draw"), s = e.filter((n) => n.type == "shiftLine");
|
|
239
247
|
if (s.length == 0)
|
|
240
248
|
throw "未绘制平移!";
|
|
241
249
|
if (i.length != s.length)
|
|
@@ -246,7 +254,7 @@ class C {
|
|
|
246
254
|
...r.slice(0, o).reverse()
|
|
247
255
|
].map((n, h) => {
|
|
248
256
|
const p = s.find(
|
|
249
|
-
(
|
|
257
|
+
(w) => w.attributes.id == n.attributes.id
|
|
250
258
|
);
|
|
251
259
|
if (!p)
|
|
252
260
|
throw "绘制的线和平移的线不匹配!";
|
|
@@ -254,14 +262,14 @@ class C {
|
|
|
254
262
|
"🚀 ~ file: sketchView.ts:393 ~ SketchView ~ getEntranceRoad ~ m:",
|
|
255
263
|
n,
|
|
256
264
|
p
|
|
257
|
-
),
|
|
265
|
+
), t[h + 1] = {
|
|
258
266
|
0: [n.point.paths[0], n.point.paths[n.point.paths.length - 1]],
|
|
259
267
|
1: [
|
|
260
268
|
p.point.paths[0],
|
|
261
269
|
p.point.paths[p.point.paths.length - 1]
|
|
262
270
|
]
|
|
263
271
|
};
|
|
264
|
-
}),
|
|
272
|
+
}), t;
|
|
265
273
|
}
|
|
266
274
|
/**
|
|
267
275
|
* 获进口道融合区
|
|
@@ -271,38 +279,38 @@ class C {
|
|
|
271
279
|
* @returns
|
|
272
280
|
* @memberof SketchView
|
|
273
281
|
*/
|
|
274
|
-
getEntranceFusionZone(
|
|
275
|
-
const
|
|
282
|
+
getEntranceFusionZone(t) {
|
|
283
|
+
const e = [], i = {};
|
|
276
284
|
this.graphicsLayer.graphics.map((r) => {
|
|
277
285
|
var n;
|
|
278
286
|
const o = r.geometry, a = this.getGraphicPoint(o, !1);
|
|
279
|
-
|
|
287
|
+
e.push({
|
|
280
288
|
point: a,
|
|
281
289
|
type: (n = r.attributes) == null ? void 0 : n.type,
|
|
282
290
|
attributes: r.attributes
|
|
283
291
|
});
|
|
284
292
|
});
|
|
285
|
-
const s =
|
|
286
|
-
return
|
|
287
|
-
i[r] =
|
|
288
|
-
}), { graphics: i,
|
|
293
|
+
const s = e;
|
|
294
|
+
return t.map((r, o) => {
|
|
295
|
+
i[r] = e[o];
|
|
296
|
+
}), { graphics: i, rawData: s };
|
|
289
297
|
}
|
|
290
298
|
/**
|
|
291
299
|
* 获取进口道所在的进口道编号
|
|
292
300
|
*
|
|
293
301
|
* @param {armData} armData 进口道编号区域
|
|
294
|
-
* @param {*}
|
|
302
|
+
* @param {*} graphicPolygon 绘制的区域
|
|
295
303
|
* @returns
|
|
296
304
|
* @memberof SketchView
|
|
297
305
|
*/
|
|
298
|
-
getIntersectionArea(
|
|
299
|
-
const i = Object.keys(
|
|
306
|
+
getIntersectionArea(t, e) {
|
|
307
|
+
const i = Object.keys(t);
|
|
300
308
|
let s = !1;
|
|
301
309
|
for (let r = 0; r < i.length; r++) {
|
|
302
|
-
const o = i[r], a =
|
|
303
|
-
if (
|
|
304
|
-
|
|
305
|
-
|
|
310
|
+
const o = i[r], a = t[o];
|
|
311
|
+
if (k(
|
|
312
|
+
d.polygon(e),
|
|
313
|
+
d.polygon(a)
|
|
306
314
|
)) {
|
|
307
315
|
s = o;
|
|
308
316
|
break;
|
|
@@ -310,35 +318,36 @@ class C {
|
|
|
310
318
|
}
|
|
311
319
|
return s;
|
|
312
320
|
}
|
|
313
|
-
filterData(
|
|
314
|
-
const
|
|
315
|
-
return
|
|
321
|
+
filterData(t) {
|
|
322
|
+
const e = u(t);
|
|
323
|
+
return e.length > 0 && e[0][0] === e[e.length - 1][0] && e[0][1] === e[e.length - 1][1] && e.pop(), e;
|
|
316
324
|
}
|
|
317
325
|
/**
|
|
318
326
|
*
|
|
319
327
|
*
|
|
320
328
|
* @private
|
|
321
329
|
* @param {*} geometry
|
|
322
|
-
* @param {boolean} [
|
|
330
|
+
* @param {boolean} [isFilterData=true] 是否过滤首尾相同点数据
|
|
323
331
|
* @returns
|
|
324
332
|
* @memberof SketchView
|
|
325
333
|
*/
|
|
326
|
-
getGraphicPoint(
|
|
327
|
-
|
|
334
|
+
getGraphicPoint(t, e = !0) {
|
|
335
|
+
let i = t;
|
|
336
|
+
this.viewer.spatialReference.isWebMercator && (i = g.webMercatorToGeographic(t));
|
|
328
337
|
let s;
|
|
329
|
-
if (
|
|
338
|
+
if (t.type === "point")
|
|
330
339
|
s = {
|
|
331
|
-
type:
|
|
340
|
+
type: t.type,
|
|
332
341
|
x: i.x,
|
|
333
342
|
y: i.y
|
|
334
343
|
};
|
|
335
|
-
else if (
|
|
344
|
+
else if (t.type === "polyline") {
|
|
336
345
|
s = {
|
|
337
|
-
type:
|
|
346
|
+
type: t.type,
|
|
338
347
|
paths: []
|
|
339
348
|
}, i.paths.forEach((n) => {
|
|
340
349
|
let h = n;
|
|
341
|
-
|
|
350
|
+
e && (h = this.filterData(n)), h.forEach((p) => {
|
|
342
351
|
s.paths.push(p);
|
|
343
352
|
});
|
|
344
353
|
});
|
|
@@ -351,12 +360,12 @@ class C {
|
|
|
351
360
|
}, a = this.getAngle(r, o);
|
|
352
361
|
s.angle = a;
|
|
353
362
|
} else
|
|
354
|
-
|
|
355
|
-
type:
|
|
363
|
+
t.type === "polygon" && (s = {
|
|
364
|
+
type: t.type,
|
|
356
365
|
rings: []
|
|
357
366
|
}, i.rings.forEach((r) => {
|
|
358
367
|
let o = r;
|
|
359
|
-
|
|
368
|
+
e && (o = this.filterData(r)), o.forEach((a) => {
|
|
360
369
|
s.rings.push(a);
|
|
361
370
|
});
|
|
362
371
|
}));
|
|
@@ -379,8 +388,8 @@ class C {
|
|
|
379
388
|
* @returns
|
|
380
389
|
* @memberof SketchView
|
|
381
390
|
*/
|
|
382
|
-
getAngle(
|
|
383
|
-
const i =
|
|
391
|
+
getAngle(t, e) {
|
|
392
|
+
const i = e.x - t.x, s = e.y - t.y;
|
|
384
393
|
return Math.atan2(s, i) * 180 / Math.PI;
|
|
385
394
|
}
|
|
386
395
|
/**
|
|
@@ -392,9 +401,9 @@ class C {
|
|
|
392
401
|
* @returns
|
|
393
402
|
* @memberof SketchView
|
|
394
403
|
*/
|
|
395
|
-
|
|
396
|
-
const s =
|
|
397
|
-
return
|
|
404
|
+
getShiftLine(t, e, i = "meters") {
|
|
405
|
+
const s = t, r = -e;
|
|
406
|
+
return L.offset(
|
|
398
407
|
s,
|
|
399
408
|
r,
|
|
400
409
|
i
|
|
@@ -408,7 +417,7 @@ class C {
|
|
|
408
417
|
* @param {*} symbol 线的样式
|
|
409
418
|
* @memberof SketchView
|
|
410
419
|
*/
|
|
411
|
-
|
|
420
|
+
setShiftLine(t, e = "meters", i) {
|
|
412
421
|
i || (i = {
|
|
413
422
|
type: "simple-line",
|
|
414
423
|
color: [0, 0, 255],
|
|
@@ -416,10 +425,10 @@ class C {
|
|
|
416
425
|
}), this.removeShiftLine(), this.graphicsLayer.graphics.map((s) => {
|
|
417
426
|
const r = s.geometry, o = s.attributes;
|
|
418
427
|
if ((r == null ? void 0 : r.type) === "polyline" && (o == null ? void 0 : o.type) === "draw") {
|
|
419
|
-
const a = o.id, n = this.
|
|
428
|
+
const a = o.id, n = this.getShiftLine(
|
|
420
429
|
r,
|
|
421
|
-
|
|
422
|
-
|
|
430
|
+
t,
|
|
431
|
+
e
|
|
423
432
|
), h = new l({
|
|
424
433
|
geometry: n,
|
|
425
434
|
symbol: i,
|
|
@@ -435,32 +444,32 @@ class C {
|
|
|
435
444
|
* @memberof SketchView
|
|
436
445
|
*/
|
|
437
446
|
removeShiftLine() {
|
|
438
|
-
const
|
|
439
|
-
this.graphicsLayer.graphics.map((
|
|
440
|
-
const i =
|
|
441
|
-
(i == null ? void 0 : i.type) === "shiftLine" &&
|
|
442
|
-
}), this.graphicsLayer.removeMany(
|
|
447
|
+
const t = [];
|
|
448
|
+
this.graphicsLayer.graphics.map((e) => {
|
|
449
|
+
const i = e.attributes;
|
|
450
|
+
(i == null ? void 0 : i.type) === "shiftLine" && t.push(e);
|
|
451
|
+
}), this.graphicsLayer.removeMany(t);
|
|
443
452
|
}
|
|
444
453
|
/**
|
|
445
454
|
* 移除绘制的线
|
|
446
455
|
*
|
|
447
456
|
* @memberof SketchView
|
|
448
457
|
*/
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
this.graphicsLayer.graphics.map((
|
|
452
|
-
const i =
|
|
453
|
-
(i == null ? void 0 : i.type) === "draw" &&
|
|
454
|
-
}), this.graphicsLayer.removeMany(
|
|
455
|
-
}
|
|
456
|
-
addGraphic(
|
|
458
|
+
removeDraw() {
|
|
459
|
+
const t = [];
|
|
460
|
+
this.graphicsLayer.graphics.map((e) => {
|
|
461
|
+
const i = e.attributes;
|
|
462
|
+
(i == null ? void 0 : i.type) === "draw" && t.push(e);
|
|
463
|
+
}), this.graphicsLayer.removeMany(t);
|
|
464
|
+
}
|
|
465
|
+
addGraphic(t, e = {
|
|
457
466
|
type: "simple-line",
|
|
458
467
|
color: [0, 0, 255],
|
|
459
468
|
width: 2
|
|
460
469
|
}, i) {
|
|
461
470
|
const s = new l({
|
|
462
|
-
geometry:
|
|
463
|
-
symbol:
|
|
471
|
+
geometry: t,
|
|
472
|
+
symbol: e,
|
|
464
473
|
attributes: i
|
|
465
474
|
});
|
|
466
475
|
this.graphicsLayer.add(s);
|
|
@@ -473,12 +482,12 @@ class C {
|
|
|
473
482
|
* @returns
|
|
474
483
|
* @memberof SketchView
|
|
475
484
|
*/
|
|
476
|
-
getDirection(
|
|
477
|
-
const i =
|
|
485
|
+
getDirection(t, e) {
|
|
486
|
+
const i = e.x - t.x, s = e.y - t.y, o = Math.atan2(s, i) * 180 / Math.PI;
|
|
478
487
|
return o >= -45 && o <= 45 ? 0 : o > 45 && o <= 135 ? 1 : o > 135 || o <= -135 ? 2 : 3;
|
|
479
488
|
}
|
|
480
|
-
findLayerById(
|
|
481
|
-
return this.viewer.map.findLayerById(
|
|
489
|
+
findLayerById(t) {
|
|
490
|
+
return this.viewer.map.findLayerById(t);
|
|
482
491
|
}
|
|
483
492
|
/**
|
|
484
493
|
* 根据id查找平移线graphic
|
|
@@ -487,30 +496,30 @@ class C {
|
|
|
487
496
|
* @returns
|
|
488
497
|
* @memberof SketchView
|
|
489
498
|
*/
|
|
490
|
-
findShiftLineGraphicsById(
|
|
491
|
-
return this.graphicsLayer.graphics.find((i) => i.attributes.id ===
|
|
499
|
+
findShiftLineGraphicsById(t) {
|
|
500
|
+
return this.graphicsLayer.graphics.find((i) => i.attributes.id === t && i.attributes.type === "shiftLine");
|
|
492
501
|
}
|
|
493
502
|
/**
|
|
494
503
|
* 删除指定的图形
|
|
495
504
|
* @param graphic 删除指定的图形
|
|
496
505
|
*/
|
|
497
|
-
remove(
|
|
498
|
-
this.graphicsLayer.remove(
|
|
506
|
+
remove(t) {
|
|
507
|
+
this.graphicsLayer.remove(t);
|
|
499
508
|
}
|
|
500
509
|
/**
|
|
501
510
|
* 设置最大允许绘制的图形数量
|
|
502
511
|
* @param num 数量
|
|
503
512
|
*/
|
|
504
|
-
|
|
505
|
-
this.options.maxAllowedGraphics =
|
|
513
|
+
setMaxAllowedGraphics(t) {
|
|
514
|
+
this.options.maxAllowedGraphics = t === 0 ? void 0 : t;
|
|
506
515
|
}
|
|
507
|
-
deepClone(
|
|
516
|
+
deepClone(t) {
|
|
508
517
|
}
|
|
509
518
|
destroy() {
|
|
510
|
-
var
|
|
511
|
-
this.viewer.map.remove(this.graphicsLayer), this.viewer.map.remove(this.
|
|
519
|
+
var t, e;
|
|
520
|
+
this.viewer.map.remove(this.graphicsLayer), this.viewer.map.remove(this.TextGraphicsLayer), (t = this.sketch) == null || t.destroy(), (e = this.sketchViewModel) == null || e.destroy();
|
|
512
521
|
}
|
|
513
522
|
}
|
|
514
523
|
export {
|
|
515
|
-
|
|
524
|
+
B as default
|
|
516
525
|
};
|