gisviewer-vue3-arcgis 1.0.85

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.
Files changed (138) hide show
  1. package/README.md +103 -0
  2. package/es/index.d.ts +8 -0
  3. package/es/index.mjs +16 -0
  4. package/es/src/components.d.ts +9 -0
  5. package/es/src/gis-map/gis-map.vue.d.ts +91 -0
  6. package/es/src/gis-map/gis-map.vue.mjs +124 -0
  7. package/es/src/gis-map/gis-map.vue2.mjs +4 -0
  8. package/es/src/gis-map/index.d.ts +81 -0
  9. package/es/src/gis-map/index.mjs +7 -0
  10. package/es/src/gis-map/stores/appData.d.ts +3 -0
  11. package/es/src/gis-map/stores/appData.mjs +9 -0
  12. package/es/src/gis-map/stores/index.d.ts +7 -0
  13. package/es/src/gis-map/stores/index.mjs +10 -0
  14. package/es/src/gis-map/style/index.css +13 -0
  15. package/es/src/gis-map/utils/FlyToPoints.d.ts +37 -0
  16. package/es/src/gis-map/utils/FlyToPoints.mjs +67 -0
  17. package/es/src/gis-map/utils/GreenWaveline.mjs +193 -0
  18. package/es/src/gis-map/utils/Layers.d.ts +31 -0
  19. package/es/src/gis-map/utils/Layers.mjs +99 -0
  20. package/es/src/gis-map/utils/common-utils.d.ts +65 -0
  21. package/es/src/gis-map/utils/common-utils.mjs +159 -0
  22. package/es/src/gis-map/utils/holo-flow/index.d.ts +15 -0
  23. package/es/src/gis-map/utils/holo-flow/index.mjs +50 -0
  24. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
  25. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +209 -0
  26. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
  27. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +316 -0
  28. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
  29. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +75 -0
  30. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
  31. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +286 -0
  32. package/es/src/gis-map/utils/index.d.ts +21 -0
  33. package/es/src/gis-map/utils/index.mjs +23 -0
  34. package/es/src/gis-map/utils/map-initializer.d.ts +50 -0
  35. package/es/src/gis-map/utils/map-initializer.mjs +248 -0
  36. package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
  37. package/es/src/gis-map/utils/open-drive-renderer/index.mjs +271 -0
  38. package/es/src/gis-map/utils/overlay.d.ts +83 -0
  39. package/es/src/gis-map/utils/overlay.mjs +149 -0
  40. package/es/src/gis-map/utils/queue-length.d.ts +14 -0
  41. package/es/src/gis-map/utils/queue-length.mjs +83 -0
  42. package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
  43. package/es/src/gis-map/utils/renderer/greenWaveline.mjs +169 -0
  44. package/es/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
  45. package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
  46. package/es/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
  47. package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
  48. package/es/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
  49. package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
  50. package/es/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
  51. package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
  52. package/es/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
  53. package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
  54. package/es/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
  55. package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
  56. package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
  57. package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
  58. package/es/src/gis-map/utils/sketchView.d.ts +209 -0
  59. package/es/src/gis-map/utils/sketchView.mjs +516 -0
  60. package/es/src/gis-map/utils/sketchViewTool.d.ts +259 -0
  61. package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
  62. package/es/src/gis-map/utils/syncMapView.d.ts +43 -0
  63. package/es/src/gis-map/utils/syncMapView.mjs +64 -0
  64. package/es/src/gis-map/utils/traffic-flow.d.ts +66 -0
  65. package/es/src/gis-map/utils/traffic-flow.mjs +308 -0
  66. package/es/src/index.d.ts +1 -0
  67. package/es/src/index.mjs +4 -0
  68. package/es/src/types/index.d.ts +142 -0
  69. package/es/src/types/index.mjs +5 -0
  70. package/lib/index.d.ts +8 -0
  71. package/lib/index.js +1 -0
  72. package/lib/src/components.d.ts +9 -0
  73. package/lib/src/gis-map/gis-map.vue.d.ts +91 -0
  74. package/lib/src/gis-map/gis-map.vue.js +1 -0
  75. package/lib/src/gis-map/gis-map.vue2.js +1 -0
  76. package/lib/src/gis-map/index.d.ts +81 -0
  77. package/lib/src/gis-map/index.js +1 -0
  78. package/lib/src/gis-map/stores/appData.d.ts +3 -0
  79. package/lib/src/gis-map/stores/appData.js +1 -0
  80. package/lib/src/gis-map/stores/index.d.ts +7 -0
  81. package/lib/src/gis-map/stores/index.js +1 -0
  82. package/lib/src/gis-map/style/index.css +13 -0
  83. package/lib/src/gis-map/utils/FlyToPoints.d.ts +37 -0
  84. package/lib/src/gis-map/utils/FlyToPoints.js +1 -0
  85. package/lib/src/gis-map/utils/GreenWaveline.js +1 -0
  86. package/lib/src/gis-map/utils/Layers.d.ts +31 -0
  87. package/lib/src/gis-map/utils/Layers.js +1 -0
  88. package/lib/src/gis-map/utils/common-utils.d.ts +65 -0
  89. package/lib/src/gis-map/utils/common-utils.js +1 -0
  90. package/lib/src/gis-map/utils/holo-flow/index.d.ts +15 -0
  91. package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
  92. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
  93. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
  94. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
  95. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -0
  96. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
  97. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -0
  98. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
  99. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -0
  100. package/lib/src/gis-map/utils/index.d.ts +21 -0
  101. package/lib/src/gis-map/utils/index.js +1 -0
  102. package/lib/src/gis-map/utils/map-initializer.d.ts +50 -0
  103. package/lib/src/gis-map/utils/map-initializer.js +1 -0
  104. package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
  105. package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -0
  106. package/lib/src/gis-map/utils/overlay.d.ts +83 -0
  107. package/lib/src/gis-map/utils/overlay.js +1 -0
  108. package/lib/src/gis-map/utils/queue-length.d.ts +14 -0
  109. package/lib/src/gis-map/utils/queue-length.js +1 -0
  110. package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
  111. package/lib/src/gis-map/utils/renderer/greenWaveline.js +43 -0
  112. package/lib/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
  113. package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
  114. package/lib/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
  115. package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
  116. package/lib/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
  117. package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
  118. package/lib/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
  119. package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
  120. package/lib/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
  121. package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
  122. package/lib/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
  123. package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
  124. package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
  125. package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
  126. package/lib/src/gis-map/utils/sketchView.d.ts +209 -0
  127. package/lib/src/gis-map/utils/sketchView.js +1 -0
  128. package/lib/src/gis-map/utils/sketchViewTool.d.ts +259 -0
  129. package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
  130. package/lib/src/gis-map/utils/syncMapView.d.ts +43 -0
  131. package/lib/src/gis-map/utils/syncMapView.js +1 -0
  132. package/lib/src/gis-map/utils/traffic-flow.d.ts +66 -0
  133. package/lib/src/gis-map/utils/traffic-flow.js +1 -0
  134. package/lib/src/index.d.ts +1 -0
  135. package/lib/src/index.js +1 -0
  136. package/lib/src/types/index.d.ts +142 -0
  137. package/lib/src/types/index.js +1 -0
  138. package/package.json +41 -0
@@ -0,0 +1,503 @@
1
+ import g from "@arcgis/core/layers/GraphicsLayer";
2
+ import x from "@arcgis/core/widgets/Sketch/SketchViewModel";
3
+ import P from "@arcgis/core/widgets/Sketch";
4
+ import * as p from "@arcgis/core/geometry/support/webMercatorUtils.js";
5
+ import * as y from "@arcgis/core/geometry/geometryEngine.js";
6
+ import m from "@arcgis/core/Graphic.js";
7
+ import u from "@arcgis/core/geometry/Polyline.js";
8
+ import * as c from "@turf/turf";
9
+ const G = {
10
+ maxAllowedGraphics: 0,
11
+ GraphicsLayer: {},
12
+ sketchvisibleElements: {},
13
+ sketchPosition: "top-left",
14
+ defaultsketchVisible: !0,
15
+ sketchViewModelItemSymbol: {}
16
+ }, f = {
17
+ type: "simple-line",
18
+ color: "#556DEA",
19
+ width: 2
20
+ }, b = {
21
+ type: "simple-fill",
22
+ // autocasts as new SimpleFillSymbol()
23
+ color: [227, 139, 79, 0.4],
24
+ outline: {
25
+ // autocasts as new SimpleLineSymbol()
26
+ color: [255, 255, 255],
27
+ width: 1
28
+ }
29
+ };
30
+ class $ {
31
+ constructor(t, e) {
32
+ this.isDraw = !1, this.drawStartGraphicId = null, this.drawPointGraphic = /* @__PURE__ */ new Map(), this.dimensionType = null, this.viewer = t, this.options = {
33
+ ...G,
34
+ ...e
35
+ }, this.graphicsLayer = new g({ ...this.options.GraphicsLayer }), this.TextgraphicsLayer = new g(), this.viewer.map.layers.add(this.graphicsLayer), this.viewer.map.layers.add(this.TextgraphicsLayer), this.init();
36
+ }
37
+ init() {
38
+ this.sketchViewModel = new x({
39
+ layer: this.graphicsLayer,
40
+ view: this.viewer,
41
+ updateOnGraphicClick: !0,
42
+ polylineSymbol: f,
43
+ polygonSymbol: b,
44
+ ...this.options.sketchViewModelItemSymbol
45
+ });
46
+ const t = this.findLayerById("TrafficToolMarkings"), e = [];
47
+ t && e.push({ layer: t, enabled: !0 }), this.sketch = new P({
48
+ view: this.viewer,
49
+ viewModel: this.sketchViewModel,
50
+ layer: this.graphicsLayer,
51
+ visible: this.options.defaultsketchVisible,
52
+ snappingOptions: {
53
+ // autocasts to SnappingOptions()
54
+ enabled: !0,
55
+ // global snapping is turned on
56
+ // assigns a collection of FeatureSnappingLayerSource() and enables feature snapping on this layer
57
+ featureSources: e
58
+ }
59
+ }), this.sketch.visibleElements = {
60
+ ...this.options.sketchvisibleElements
61
+ }, this.viewer.ui.add(this.sketch, this.options.sketchPosition);
62
+ const i = this;
63
+ this.viewer.on("pointer-move", function(s) {
64
+ const r = {
65
+ x: s.x,
66
+ y: s.y
67
+ };
68
+ if (i.isDraw && i.dimensionType == "distance") {
69
+ i.tipsDom || (i.tipsDom = i.createDom());
70
+ const o = i.getDrawgraphicLength();
71
+ i.tipsDom.innerText = `${o}米`, i.tipsDom.style.left = `${r.x}px`, i.tipsDom.style.top = `${r.y + 3}px`, i.tipsDom.style.pointerEvents = "none";
72
+ }
73
+ });
74
+ }
75
+ on(t) {
76
+ const e = this;
77
+ this.sketch.on("create", function(i) {
78
+ e.onCreate(i, t);
79
+ }), this.sketch.on("update", function(i) {
80
+ e.onUpdate(i, t);
81
+ }), this.sketch.on("delete", function(i) {
82
+ e.onDelete(i, t);
83
+ }), this.sketch.on("redo", function(i) {
84
+ console.log("redo", i), t && t("redo", "complete", i);
85
+ }), this.sketch.on("undo", function(i) {
86
+ console.log("undo", i), t && t("undo", "complete", i);
87
+ });
88
+ }
89
+ onCreate(t, e) {
90
+ if (console.log("create", t), this.drawStartGraphicId || (this.drawStartGraphicId = new Date().getTime().toString()), t.graphic.getAttribute("id") || (t.graphic.setAttribute("type", "draw"), t.graphic.setAttribute("id", this.drawStartGraphicId)), t.state === "start" && t.graphic.geometry.type === "polyline" && (this.isDraw = !0, this.drawStartGraphic = p.webMercatorToGeographic(
91
+ t.graphic.geometry
92
+ ), this.dimensionType == "distance")) {
93
+ const i = this.getGeometryXY(this.drawStartGraphic, 0), s = `${this.drawStartGraphicId}-start`;
94
+ this.addOrUpdateMarkPoint("起点", i, s);
95
+ }
96
+ if (t.state === "active" && t.graphic.geometry.type === "polyline") {
97
+ const i = p.webMercatorToGeographic(
98
+ t.graphic.geometry
99
+ ), s = this.drawStartGraphicId;
100
+ this.dimensionType == "distance" && (this.drawPolylinePoint(i, s), this.drawStartGraphic = i);
101
+ }
102
+ if (t.state === "complete" && t.graphic.geometry.type === "polyline" && this.dimensionType == "distance") {
103
+ const i = this.getDrawgraphicLength(), s = `${this.drawStartGraphicId}-end`, r = p.webMercatorToGeographic(
104
+ t.graphic.geometry
105
+ ), o = r.paths[0], n = this.getGeometryXY(r, o.length - 1);
106
+ this.addOrUpdateMarkPoint(`总长度:${i}米`, n, s), this.drawStartGraphic = null, this.removeDom(), this.isDraw = !1, this.drawStartGraphicId = null;
107
+ }
108
+ t.state === "cancel" && t.graphic.geometry.type === "polyline" && this.onCreateToCancel(), e && e("create", t.state, t.graphic);
109
+ }
110
+ onCreateToCancel() {
111
+ this.removeDom(), this.isDraw = !1, this.drawStartGraphic = null;
112
+ const t = this.drawStartGraphicId;
113
+ this.drawPointGraphic.forEach((e, i) => {
114
+ new RegExp(`^${t}-`).test(i) && (this.TextgraphicsLayer.remove(e), this.drawPointGraphic.delete(i));
115
+ }), this.drawStartGraphicId = null;
116
+ }
117
+ onUpdate(t, e) {
118
+ console.log("update", t), this.updatePpolylinePoint(
119
+ t.graphics.filter((i) => i.geometry.type === "polyline")
120
+ ), e && e("update", t.state, t.graphics);
121
+ }
122
+ onDelete(t, e) {
123
+ console.log("delete", t), this.delPpolylinePoint(
124
+ t.graphics.filter((i) => i.geometry.type === "polyline")
125
+ ), e && e("delete", "complete", t.graphics);
126
+ }
127
+ addpolyline(t) {
128
+ const e = [], i = f, s = {
129
+ type: "draw",
130
+ id: new Date().getTime().toString()
131
+ };
132
+ t.map((r) => {
133
+ e.push(
134
+ this.createPolylineGraphic(r, i, {
135
+ ...s
136
+ })
137
+ );
138
+ }), this.graphicsLayer.addMany(e);
139
+ }
140
+ createPolylineGraphic(t, e, i) {
141
+ const s = new u({
142
+ paths: [t]
143
+ }), r = p.geographicToWebMercator(s);
144
+ return new m({
145
+ geometry: r,
146
+ symbol: e,
147
+ attributes: i
148
+ });
149
+ }
150
+ createDom() {
151
+ const t = document.createElement("div");
152
+ t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.width = "100px", t.style.height = "80px", t.style.zIndex = "999", t.style.display = "flex", t.style.justifyContent = "center", t.style.alignItems = "center", t.style.color = "#fff", t.style.fontSize = "20px", t.style.fontWeight = "bold", t.innerText = "";
153
+ const e = document.getElementsByClassName("esri-view-root");
154
+ if (e.length > 0)
155
+ return e[0].appendChild(t), t;
156
+ }
157
+ removeDom() {
158
+ this.tipsDom && (this.tipsDom.remove(), this.tipsDom = null);
159
+ }
160
+ /**
161
+ * 开始绘制
162
+ * @param tool 'point' | 'polyline' | 'polygon' | 'rectangle' | 'circle'
163
+ * @param createOptions
164
+ */
165
+ sketchCreate(t, e) {
166
+ this.sketchViewModel.create(t, e);
167
+ }
168
+ /**
169
+ * 退出绘制
170
+ *
171
+ * @memberof sketchViewTool
172
+ */
173
+ sketchCancel() {
174
+ this.sketchViewModel.cancel();
175
+ }
176
+ /**
177
+ * 获取所有的图形得长度
178
+ * @param offsetUnit 距离单位
179
+ * @returns
180
+ */
181
+ getCalculateDistance(t = "meters") {
182
+ const e = [];
183
+ return this.graphicsLayer.graphics.map((i) => {
184
+ i.geometry.type === "polyline" && e.push(this.calculateDistance(i.geometry, t));
185
+ }), e;
186
+ }
187
+ /**
188
+ * 获取所有的图形得航向角
189
+ *
190
+ * @returns
191
+ * @memberof sketchViewTool
192
+ */
193
+ getCalculateHeading(t = "north") {
194
+ const e = [];
195
+ return this.graphicsLayer.graphics.map((i) => {
196
+ i.geometry.type === "polyline" && e.push(this.calculateHeading(i.geometry, t));
197
+ }), e;
198
+ }
199
+ /**
200
+ * 获取所有的线段的路径和长度
201
+ *
202
+ * @returns
203
+ * @memberof sketchViewTool
204
+ */
205
+ getAllPolylineGraphicPath(t = "meters") {
206
+ const e = [];
207
+ return this.graphicsLayer.graphics.map((i) => {
208
+ i.geometry.type === "polyline" && e.push({
209
+ paths: p.webMercatorToGeographic(i.geometry).paths[0],
210
+ distance: this.calculateDistance(i.geometry, t)
211
+ });
212
+ }), e;
213
+ }
214
+ close() {
215
+ this.sketch.visible = !1;
216
+ }
217
+ show() {
218
+ this.sketch.visible = !0;
219
+ }
220
+ removeAll() {
221
+ this.graphicsLayer.removeAll(), this.TextgraphicsLayer.removeAll(), this.drawPointGraphic.clear();
222
+ }
223
+ calculateDistance(t, e = "meters") {
224
+ return y.geodesicLength(
225
+ t,
226
+ e
227
+ );
228
+ }
229
+ /**
230
+ * 计算geometry的航向角
231
+ *
232
+ * @param {__esri.Geometry} geometry
233
+ * @param {string} [direction='north']
234
+ * @returns
235
+ * @memberof sketchViewTool
236
+ */
237
+ calculateHeading(t, e = "north") {
238
+ const s = p.webMercatorToGeographic(t).paths[0];
239
+ return this.calculatePointHeading(s, e);
240
+ }
241
+ /**
242
+ * 计算路径的航向角
243
+ *
244
+ * @param {number[][]} path 路径
245
+ * @param {string} [direction='north'] 方向
246
+ * @returns
247
+ * @memberof sketchViewTool
248
+ */
249
+ calculatePointHeading(t, e = "north") {
250
+ const i = {
251
+ longitude: t[0][0],
252
+ latitude: t[0][1]
253
+ }, s = {
254
+ longitude: t[t.length - 1][0],
255
+ latitude: t[t.length - 1][1]
256
+ }, r = i.longitude, o = i.latitude, n = s.longitude, a = s.latitude, h = n - r, d = Math.sin(h) * Math.cos(a), w = Math.cos(o) * Math.sin(a) - Math.sin(o) * Math.cos(a) * Math.cos(h);
257
+ let l = (Math.atan2(d, w) * (180 / Math.PI) + 360) % 360;
258
+ return e === "east" ? l = (l + 90) % 360 : e === "south" ? l = (l + 180) % 360 : e === "west" && (l = (l + 270) % 360), l;
259
+ }
260
+ drawPolylinePoint(t, e, i = "add") {
261
+ const s = t == null ? void 0 : t.paths[0], r = [];
262
+ for (let o = 0; o < s.length - 1; o++) {
263
+ const n = s[o];
264
+ r.push([...n]);
265
+ const a = {
266
+ x: n[0],
267
+ y: n[1]
268
+ };
269
+ if (o == 0) {
270
+ i == "update" && this.addOrUpdateMarkPoint("起点", a, `${e}-start`);
271
+ continue;
272
+ }
273
+ const h = `${e}-${o + 1}`, d = this.getPointLength(r, "meters");
274
+ this.addOrUpdateMarkPoint(`${d.toFixed(2)}米`, a, h);
275
+ }
276
+ if (i == "update" && s.length > 1) {
277
+ const o = this.getGeometryXY(
278
+ t,
279
+ s.length - 1
280
+ );
281
+ r.push([o.x, o.y]);
282
+ const n = this.getPointLength(r, "meters");
283
+ this.addOrUpdateMarkPoint(
284
+ `总长度:${n.toFixed(2)}米`,
285
+ o,
286
+ `${e}-end`
287
+ );
288
+ }
289
+ }
290
+ updatePpolylinePoint(t) {
291
+ for (let e = 0; e < t.length; e++) {
292
+ console.log(t[e]);
293
+ const i = t[e].getAttribute("id"), s = p.webMercatorToGeographic(
294
+ t[e].geometry
295
+ );
296
+ this.drawPolylinePoint(s, i, "update");
297
+ }
298
+ }
299
+ delPpolylinePoint(t) {
300
+ var e;
301
+ for (let i = 0; i < t.length; i++) {
302
+ const s = t[i].getAttribute("id"), r = `${s}-start`, o = `${s}-end`, n = [r, o];
303
+ (e = t[i].geometry) == null || e.paths[0].map(
304
+ (a, h) => {
305
+ n.push(`${s}-${h + 1}`);
306
+ }
307
+ ), n.map((a) => {
308
+ const h = this.drawPointGraphic.get(a);
309
+ h && (this.TextgraphicsLayer.remove(h), this.drawPointGraphic.delete(a));
310
+ });
311
+ }
312
+ }
313
+ /**
314
+ * 添加或者更新标记点
315
+ *
316
+ * @param {string} text 标记点的文本
317
+ * @param {ITPoint} point 标记点的坐标
318
+ * @param {string} id 标记点的id
319
+ * @param {*} [attributes={}] 标记点的属性
320
+ * @returns
321
+ * @memberof sketchViewTool
322
+ */
323
+ addOrUpdateMarkPoint(t, e, i, s = {}) {
324
+ if (this.drawPointGraphic.has(i)) {
325
+ const o = this.drawPointGraphic.get(i);
326
+ this.TextgraphicsLayer.remove(o);
327
+ const n = this.createTextGraphic(t, e, {
328
+ ...s,
329
+ id: i
330
+ });
331
+ this.drawPointGraphic.set(i, n), this.TextgraphicsLayer.add(n);
332
+ return;
333
+ }
334
+ const r = this.createTextGraphic(t, e, {
335
+ ...s,
336
+ id: i
337
+ });
338
+ this.drawPointGraphic.set(i, r), this.TextgraphicsLayer.add(r);
339
+ }
340
+ /**
341
+ * 获取图形的点位
342
+ *
343
+ * @param {__esri.Geometry} geometry
344
+ * @returns
345
+ * @memberof sketchViewTool
346
+ */
347
+ getGeometryXY(t, e = 0) {
348
+ const i = t == null ? void 0 : t.paths[0];
349
+ return {
350
+ x: i[e][0],
351
+ y: i[e][1]
352
+ };
353
+ }
354
+ /**
355
+ * 创建文本图形
356
+ *
357
+ * @param {string} text 文本
358
+ * @param {{ x: number; y: number }} point 坐标
359
+ * @param {*} [attributes={}] 属性
360
+ * @returns
361
+ * @memberof sketchViewTool
362
+ */
363
+ createTextGraphic(t, e, i = {}) {
364
+ return new m({
365
+ geometry: {
366
+ //@ts-ignore
367
+ type: "point",
368
+ x: e.x,
369
+ y: e.y
370
+ },
371
+ symbol: {
372
+ //@ts-ignore
373
+ type: "text",
374
+ text: t,
375
+ color: "white",
376
+ haloColor: "black",
377
+ haloSize: "1px",
378
+ xoffset: 3,
379
+ yoffset: 3
380
+ },
381
+ attributes: {
382
+ ...i
383
+ }
384
+ });
385
+ }
386
+ /**
387
+ * 获取当前绘制的图形的长度
388
+ * @returns
389
+ */
390
+ getDrawgraphicLength() {
391
+ return this.drawStartGraphic ? this.calculateDistance(this.drawStartGraphic, "meters").toFixed(2) : 0;
392
+ }
393
+ /**
394
+ * 获取两点的角度
395
+ *
396
+ * @param {ITPoint} startPoint
397
+ * @param {ITPoint} endPoint
398
+ * @returns
399
+ * @memberof SketchView
400
+ */
401
+ getAngle(t, e) {
402
+ const i = e.x - t.x, s = e.y - t.y;
403
+ return Math.atan2(s, i) * 180 / Math.PI;
404
+ }
405
+ /**
406
+ * 获取两点的方位角
407
+ *
408
+ * @param {ITPoint} startPoint
409
+ * @param {ITPoint} endPoint
410
+ * @returns
411
+ * @memberof sketchViewTool
412
+ */
413
+ getbearing(t, e) {
414
+ return c.bearing(
415
+ c.point([t.x, t.y]),
416
+ c.point([e.x, e.y])
417
+ );
418
+ }
419
+ /**
420
+ * 获取两点的距离
421
+ * @param startPoint
422
+ * @param endPoint
423
+ * @param units
424
+ * @returns
425
+ */
426
+ getPointLength(t, e = "meters") {
427
+ const i = new u({
428
+ paths: [t]
429
+ });
430
+ return y.geodesicLength(i, e);
431
+ }
432
+ /**
433
+ * 获取多个点的中心点
434
+ *
435
+ * @param {ITPoint[]} points
436
+ * @returns
437
+ * @memberof sketchViewTool
438
+ */
439
+ featureCollection(t) {
440
+ const e = c.featureCollection(
441
+ t.map((s) => c.point([s.x, s.y]))
442
+ );
443
+ return c.center(e);
444
+ }
445
+ /**
446
+ * 获取两点的中心点
447
+ *
448
+ * @param {ITPoint} startPoint
449
+ * @param {ITPoint} endPoint
450
+ * @returns
451
+ * @memberof sketchViewTool
452
+ */
453
+ midpoint(t, e) {
454
+ return c.midpoint(
455
+ c.point([t.x, t.y]),
456
+ c.point([e.x, e.y])
457
+ );
458
+ }
459
+ /**
460
+ * 获取方向
461
+ *
462
+ * @param {ITPoint} startPoint 起点
463
+ * @param {ITPoint} endPoint 终点
464
+ * @returns
465
+ * @memberof SketchView
466
+ */
467
+ getDirection(t, e) {
468
+ const i = e.x - t.x, s = e.y - t.y, o = Math.atan2(s, i) * 180 / Math.PI;
469
+ return o >= -45 && o <= 45 ? 0 : o > 45 && o <= 135 ? 1 : o > 135 || o <= -135 ? 2 : 3;
470
+ }
471
+ findLayerById(t) {
472
+ return this.viewer.map.findLayerById(t);
473
+ }
474
+ /**
475
+ * 开启图层捕捉
476
+ */
477
+ turnonlayerSnap() {
478
+ this.sketchViewModel.snappingOptions.enabled = !0;
479
+ }
480
+ /**
481
+ * 关闭图层捕捉
482
+ */
483
+ turnofflayerSnap() {
484
+ this.sketchViewModel.snappingOptions.enabled = !1;
485
+ }
486
+ setDimensionType(t) {
487
+ this.dimensionType = t;
488
+ }
489
+ /**
490
+ * 删除指定的图形
491
+ * @param graphic 删除指定的图形
492
+ */
493
+ remove(t) {
494
+ this.graphicsLayer.remove(t);
495
+ }
496
+ destroy() {
497
+ var t, e;
498
+ this.viewer.map.remove(this.graphicsLayer), this.viewer.map.remove(this.TextgraphicsLayer), (t = this.sketch) == null || t.destroy(), (e = this.sketchViewModel) == null || e.destroy();
499
+ }
500
+ }
501
+ export {
502
+ $ as default
503
+ };
@@ -0,0 +1,43 @@
1
+ import MapView from '@arcgis/core/views/MapView';
2
+ import SceneView from '@arcgis/core/views/SceneView';
3
+ export default class syncMapView {
4
+ private mainMapView;
5
+ private targetMapViews;
6
+ private syncHandles;
7
+ private isSync;
8
+ constructor(targetMapViews: MapView[] | SceneView[]);
9
+ /**
10
+ * 设置是否同步
11
+ *
12
+ * @param {boolean} isSync
13
+ * @memberof syncMapView
14
+ */
15
+ setSync(isSync: boolean): void;
16
+ /**
17
+ *设置主视图
18
+ *
19
+ * @private
20
+ * @param {(MapView | SceneView)} mainMapView
21
+ * @memberof syncMapView
22
+ */
23
+ private setMainMapView;
24
+ /**
25
+ *开始同步视角
26
+ *
27
+ * @private
28
+ * @memberof syncMapView
29
+ */
30
+ private startSync;
31
+ /**
32
+ * 暂停同步视角
33
+ *
34
+ * @memberof syncMapView
35
+ */
36
+ pauseSync(): void;
37
+ /**
38
+ *销毁同步
39
+ *
40
+ * @memberof syncMapView
41
+ */
42
+ destroy(): void;
43
+ }
@@ -0,0 +1,64 @@
1
+ class a {
2
+ constructor(s) {
3
+ if (this.syncHandles = [], this.isSync = !1, s.length < 2)
4
+ throw new Error("At least two viewers are required for synchronization.");
5
+ this.mainMapView = null, this.targetMapViews = s, s.forEach((i) => {
6
+ i.on("drag", () => {
7
+ this.setMainMapView(i);
8
+ });
9
+ });
10
+ }
11
+ /**
12
+ * 设置是否同步
13
+ *
14
+ * @param {boolean} isSync
15
+ * @memberof syncMapView
16
+ */
17
+ setSync(s) {
18
+ this.isSync = s;
19
+ }
20
+ /**
21
+ *设置主视图
22
+ *
23
+ * @private
24
+ * @param {(MapView | SceneView)} mainMapView
25
+ * @memberof syncMapView
26
+ */
27
+ setMainMapView(s) {
28
+ this.mainMapView !== s && (this.pauseSync(), this.mainMapView = s, this.startSync());
29
+ }
30
+ /**
31
+ *开始同步视角
32
+ *
33
+ * @private
34
+ * @memberof syncMapView
35
+ */
36
+ startSync() {
37
+ this.syncHandles = this.targetMapViews.map((s) => s.watch("viewpoint", (i) => {
38
+ this.mainMapView === s && this.isSync && this.targetMapViews.forEach((t) => {
39
+ t !== s && (t.viewpoint = i.clone());
40
+ });
41
+ }));
42
+ }
43
+ /**
44
+ * 暂停同步视角
45
+ *
46
+ * @memberof syncMapView
47
+ */
48
+ pauseSync() {
49
+ this.syncHandles.forEach((s) => {
50
+ s.remove();
51
+ }), this.syncHandles = [];
52
+ }
53
+ /**
54
+ *销毁同步
55
+ *
56
+ * @memberof syncMapView
57
+ */
58
+ destroy() {
59
+ this.pauseSync(), this.mainMapView = null, this.targetMapViews = [];
60
+ }
61
+ }
62
+ export {
63
+ a as default
64
+ };
@@ -0,0 +1,66 @@
1
+ import View from '@arcgis/core/views/View';
2
+ export default class TrafficFlow {
3
+ private view;
4
+ private mapConfig;
5
+ private objectsLayer;
6
+ private webSocket;
7
+ /** 交通对象最大坚持帧数(连续多少个数据包没有数据就删除) */
8
+ private readonly maxMissCount;
9
+ /** 记录每个交通对象连续多少个数据包没收到数据 */
10
+ private objectMissCount;
11
+ /** 是否显示车牌号码 */
12
+ private showVehiclePlate;
13
+ private showLog;
14
+ constructor(view: View);
15
+ /**
16
+ * 开始显示交通流数据
17
+ * @param url
18
+ * @param options
19
+ */
20
+ connectTrafficFlow(url: string, options?: any): void;
21
+ /**
22
+ * 停止显示交通流数据
23
+ */
24
+ disconnectTrafficFlow(): void;
25
+ /**
26
+ * 控制车辆号牌是否显示
27
+ * @param visible
28
+ */
29
+ toggleVehiclePlate(visible: boolean): void;
30
+ private focusVehNo;
31
+ private handleTrafficFlowData;
32
+ /**
33
+ * 新增交通对象
34
+ * @param objects
35
+ */
36
+ private addTrafficObjects;
37
+ /**
38
+ * 更新交通对象
39
+ * @param objects
40
+ */
41
+ private updateTrafficObjects;
42
+ /**
43
+ * 基于轨迹数据创建cim符号,显示车辆图标和车牌号码
44
+ * @param vehTrack
45
+ * @returns
46
+ */
47
+ private createCIMSymbol;
48
+ /**
49
+ * 删除交通对象
50
+ * @param ids
51
+ */
52
+ private deleteTrafficObjects;
53
+ private buildVehicleTrackData;
54
+ /**
55
+ * 根据车身颜色属性返回对应的车辆图标
56
+ * @param carColor
57
+ * @returns
58
+ */
59
+ private getCarPic;
60
+ /**
61
+ * 根据号牌颜色属性获取填充色和背景色
62
+ * @param plateColor
63
+ * @returns
64
+ */
65
+ private getPlateFontColor;
66
+ }