@arcgis/map-components 5.2.0-next.31 → 5.2.0-next.32
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/dist/cdn/KIQMUMR7.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-utility-network-trace-location/customElement.js +108 -97
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +4 -4
- package/dist/cdn/7ED4UQDB.js +0 -2
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as x, html as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import I from "@arcgis/core/geometry/
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { LitElement as
|
|
13
|
-
import { log as
|
|
14
|
-
import { u as
|
|
15
|
-
import { d as
|
|
16
|
-
const
|
|
17
|
-
class
|
|
2
|
+
import { c as C } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as x, html as b } from "lit";
|
|
4
|
+
import * as G from "@arcgis/core/geometry/operators/cutOperator.js";
|
|
5
|
+
import * as T from "@arcgis/core/geometry/operators/lengthOperator.js";
|
|
6
|
+
import * as L from "@arcgis/core/geometry/operators/projectOperator.js";
|
|
7
|
+
import * as I from "@arcgis/core/geometry/operators/proximityOperator.js";
|
|
8
|
+
import v from "@arcgis/core/geometry/Polyline.js";
|
|
9
|
+
import A from "@arcgis/core/Graphic.js";
|
|
10
|
+
import w from "@arcgis/core/rest/networks/support/TraceLocation.js";
|
|
11
|
+
import S from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
|
|
12
|
+
import { LitElement as F, createEvent as _ } from "@arcgis/lumina";
|
|
13
|
+
import { log as c, composeMissingPropertyMessage as m } from "@arcgis/toolkit/log";
|
|
14
|
+
import { u as N } from "../../chunks/useT9n.js";
|
|
15
|
+
import { d as k, i as R } from "../../chunks/layer-utils.js";
|
|
16
|
+
const P = x`calcite-block{--calcite-block-content-space: 0;--calcite-block-border-color: transparent;margin:0}.add-location-button{--calcite-button-border-color: var(--calcite-color-border-1);--calcite-button-icon-color: var(--calcite-color-text-1);--calcite-button-text-color: var(--calcite-color-text-1)}.button-container{justify-content:center;display:grid}.clear-button{--calcite-button-border-color: transparent}`;
|
|
17
|
+
class E extends F {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(...arguments), this.messages =
|
|
19
|
+
super(...arguments), this.messages = N({ blocking: !0 }), this.isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = _(), this.arcgisTraceLocationSelectEnd = _(), this.arcgisTraceLocationSelectStart = _();
|
|
20
20
|
}
|
|
21
21
|
static {
|
|
22
22
|
this.properties = { isSelectWaiting: 16, beforeTraceLocationSelectStart: 0, afterHitTest: 0, view: 0, traceLocationType: 1, traceLocations: 0, filterLayers: 0, sketchViewModel: 0, spatialTolerance: 9, autoDestroyDisabled: 5, utilityNetwork: 0 };
|
|
23
23
|
}
|
|
24
24
|
static {
|
|
25
|
-
this.styles =
|
|
25
|
+
this.styles = P;
|
|
26
26
|
}
|
|
27
27
|
async destroy() {
|
|
28
28
|
this._resetCursor(), await this.manager.destroy();
|
|
29
29
|
}
|
|
30
30
|
async load() {
|
|
31
|
-
|
|
31
|
+
L.isLoaded() || await L.load();
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
_calculatePercentAlong(e, t) {
|
|
34
|
+
const r = e.clone(), s = r.spatialReference, o = t.spatialReference;
|
|
35
|
+
if (!s || !o)
|
|
36
|
+
return c("warn", this, "Unable to calculate percent along because geometry is missing a spatial reference."), -1;
|
|
37
|
+
let a = t;
|
|
38
|
+
if (!s.equals(o)) {
|
|
39
|
+
const h = L.execute(t, s);
|
|
40
|
+
if (!h)
|
|
41
|
+
return c("warn", this, "Unable to project flag point to source geometry spatial reference."), -1;
|
|
42
|
+
a = h;
|
|
43
|
+
}
|
|
44
|
+
const n = I.getNearestCoordinate(r, a);
|
|
45
|
+
if (n.isEmpty)
|
|
46
|
+
return c("warn", this, "Unable to compute nearest coordinate for polyline flag."), -1;
|
|
47
|
+
const i = n.coordinate, l = i.x - 0.5, u = i.y - 0.5, p = i.x + 0.5, d = i.y + 0.5, g = new v({
|
|
35
48
|
hasZ: !1,
|
|
36
49
|
hasM: !0,
|
|
37
|
-
paths:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return l("error", this, "Unable to project flag geometry to source geometry spatial reference."), -1;
|
|
50
|
-
const d = C.execute(s, p);
|
|
51
|
-
if (d.length > 0) {
|
|
52
|
-
const h = m.execute(s, { unit: "feet" });
|
|
53
|
-
let f;
|
|
54
|
-
return d[0].paths[0][0][0] === s.paths[0][0][0] ? f = m.execute(d[0], { unit: "feet" }) : d.length > 1 ? f = m.execute(d[1], { unit: "feet" }) : f = 0, f / h;
|
|
50
|
+
paths: [
|
|
51
|
+
[
|
|
52
|
+
[l, u],
|
|
53
|
+
[p, d]
|
|
54
|
+
]
|
|
55
|
+
],
|
|
56
|
+
spatialReference: r.spatialReference
|
|
57
|
+
}), f = G.execute(r, g);
|
|
58
|
+
if (f.length > 0) {
|
|
59
|
+
const h = T.execute(r, { unit: "feet" });
|
|
60
|
+
let y;
|
|
61
|
+
return f[0].paths[0][0][0] === r.paths[0][0][0] ? y = T.execute(f[0], { unit: "feet" }) : f.length > 1 ? y = T.execute(f[1], { unit: "feet" }) : y = 0, y / h;
|
|
55
62
|
}
|
|
56
|
-
return
|
|
63
|
+
return c("warn", this, "Unable to cut the source geometry with the flag geometry."), -1;
|
|
57
64
|
}
|
|
58
65
|
get _edgeSourceLayerIds() {
|
|
59
66
|
const e = this.utilityNetwork?.dataElement?.domainNetworks;
|
|
@@ -62,7 +69,7 @@ class R extends v {
|
|
|
62
69
|
async _handleAddButtonClick() {
|
|
63
70
|
const { view: e, sketchViewModel: t } = this;
|
|
64
71
|
if (!(e && t)) {
|
|
65
|
-
|
|
72
|
+
c("error", this, "Cannot add trace location."), t || c("error", this, m("sketchViewModel")), e || c("error", this, m("view"));
|
|
66
73
|
return;
|
|
67
74
|
}
|
|
68
75
|
if (this.beforeTraceLocationSelectStart) {
|
|
@@ -86,39 +93,43 @@ class R extends v {
|
|
|
86
93
|
e.state === "cancel" && (this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit());
|
|
87
94
|
}
|
|
88
95
|
async _performHitTest(e, t, r) {
|
|
89
|
-
const { utilityNetwork: s } = this;
|
|
96
|
+
const { utilityNetwork: s } = this, { graphic: o } = e;
|
|
90
97
|
if (!s) {
|
|
91
|
-
|
|
98
|
+
c("error", this, m("utilityNetwork")), this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (o?.geometry?.type !== "point") {
|
|
102
|
+
c("warn", this, "No screen point available for hit test."), this._startSketch(t, r);
|
|
92
103
|
return;
|
|
93
104
|
}
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
96
|
-
|
|
105
|
+
const a = o.geometry, n = t.toScreen(a);
|
|
106
|
+
if (!n) {
|
|
107
|
+
c("warn", this, "No screen point available for hit test."), this._startSketch(t, r);
|
|
97
108
|
return;
|
|
98
109
|
}
|
|
99
|
-
const
|
|
110
|
+
const l = (await t.hitTest(n, {
|
|
100
111
|
include: this.filterLayers
|
|
101
|
-
})).results.filter((
|
|
102
|
-
if (
|
|
103
|
-
|
|
112
|
+
})).results.filter((p) => p.type === "graphic" && p?.layer && p.graphic);
|
|
113
|
+
if (!l.length) {
|
|
114
|
+
c("info", this, "No usable hit test results found."), this._startSketch(t, r);
|
|
104
115
|
return;
|
|
105
116
|
}
|
|
106
|
-
this._resetCursor(), await this._processHitTestResults(
|
|
117
|
+
this._resetCursor(), await this._processHitTestResults(l, a, t) ? this.arcgisTraceLocationSelectEnd.emit() : this._startSketch(t, r);
|
|
107
118
|
}
|
|
108
119
|
_resetCursor() {
|
|
109
120
|
const { view: e, sketchViewModel: t } = this;
|
|
110
121
|
if (!e) {
|
|
111
|
-
|
|
122
|
+
c("error", this, m("view"));
|
|
112
123
|
return;
|
|
113
124
|
}
|
|
114
125
|
t && (t.snappingOptions.enabled = !1), this._clickHandler?.remove(), this._clickHandler = void 0, "acquireCursor" in e && e.acquireCursor("default");
|
|
115
126
|
}
|
|
116
127
|
async _processHitTestResults(e, t, r) {
|
|
117
|
-
if (e.length
|
|
118
|
-
return
|
|
119
|
-
const s = e[0], o = e.map((
|
|
120
|
-
const
|
|
121
|
-
return p.origin =
|
|
128
|
+
if (!e.length)
|
|
129
|
+
return c("error", this, "There are no hit test results to process."), !1;
|
|
130
|
+
const s = e[0], o = e.map((l) => {
|
|
131
|
+
const u = l, p = u.graphic;
|
|
132
|
+
return p.origin = u.layer, p.sourceLayer = u.layer, p;
|
|
122
133
|
});
|
|
123
134
|
let a = s.graphic;
|
|
124
135
|
if (this.afterHitTest)
|
|
@@ -128,47 +139,47 @@ class R extends v {
|
|
|
128
139
|
a = null;
|
|
129
140
|
}
|
|
130
141
|
if (!a)
|
|
131
|
-
return
|
|
132
|
-
const
|
|
133
|
-
return
|
|
142
|
+
return c("error", this, "No graphic available from hit test results."), this.arcgisTraceLocationSelectEnd.emit(), !0;
|
|
143
|
+
const n = await this._ensureNecessaryAttributes(a);
|
|
144
|
+
return n ? await this._generateTraceLocation(n, t, r) : (c("error", this, "Unable to ensure necessary attributes on the selected graphic."), this.arcgisTraceLocationSelectEnd.emit(), !0);
|
|
134
145
|
}
|
|
135
146
|
async _ensureNecessaryAttributes(e) {
|
|
136
|
-
const t = (
|
|
137
|
-
if (i &&
|
|
147
|
+
const t = (k(e.layer), e.layer), r = t.geometryType === null, s = t.fieldsIndex?.get("assetgroup") ?? !1, o = t.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", a = t.fieldsIndex?.get("assettype") ?? !1, n = t.fieldsIndex?.get("assettype")?.name ?? "assettype", i = e.getGlobalId(), l = e.getObjectId(), u = s ? !!e.getAttribute(o) : !0, p = a ? !!e.getAttribute(n) : !0, d = !!e.geometry;
|
|
148
|
+
if (i && l && u && p && (d || r))
|
|
138
149
|
return e;
|
|
139
|
-
const
|
|
140
|
-
return
|
|
150
|
+
const g = t.createQuery();
|
|
151
|
+
return g.objectIds = [l], (await t.queryFeatures(g))?.features[0] || null;
|
|
141
152
|
}
|
|
142
153
|
async _generateTraceLocation(e, t, r) {
|
|
143
|
-
const { traceLocations: s } = this, o = e.getGlobalId() ?? "", a = e.geometry?.type,
|
|
144
|
-
if (!
|
|
145
|
-
return
|
|
146
|
-
const i = s?.filter((
|
|
154
|
+
const { traceLocations: s } = this, o = e.getGlobalId() ?? "", a = e.geometry?.type, n = await this._generateFlagInfo(e, t);
|
|
155
|
+
if (!n)
|
|
156
|
+
return c("error", this, "Unable to generate flag info for trace location."), !1;
|
|
157
|
+
const i = s?.filter((u) => u.spatialProperties.mapGraphic?.getGlobalId() === o) ?? [];
|
|
147
158
|
if (i.length > 0) {
|
|
148
159
|
if (a !== "polyline")
|
|
149
|
-
return
|
|
150
|
-
if (i.some((
|
|
151
|
-
return
|
|
160
|
+
return c("warn", this, "A flag with the same globalId already exists."), !1;
|
|
161
|
+
if (i.some((u) => Math.abs(u.traceLocation.percentAlong - n.traceLocation.percentAlong) <= this.spatialTolerance))
|
|
162
|
+
return c("warn", this, "A flag with the same globalId already exists within tolerance."), !1;
|
|
152
163
|
}
|
|
153
|
-
const
|
|
154
|
-
return
|
|
164
|
+
const l = this._addFlagGraphic(e, t, r);
|
|
165
|
+
return l ? (n.spatialProperties.flagGraphic = l, s?.add(n), !0) : (c("warn", this, "Unable to add flag graphic."), !1);
|
|
155
166
|
}
|
|
156
167
|
async _generateFlagInfo(e, t) {
|
|
157
|
-
const { traceLocationType: r, utilityNetwork: s } = this, o = e.getGlobalId() ?? "", a = e.geometry?.type,
|
|
168
|
+
const { traceLocationType: r, utilityNetwork: s } = this, o = e.getGlobalId() ?? "", a = e.geometry?.type, n = await this._generateItemTitle(e);
|
|
158
169
|
if (a === "point" || a === "polygon") {
|
|
159
|
-
const i = s?.getTerminalConfiguration(e),
|
|
170
|
+
const i = s?.getTerminalConfiguration(e), l = i ? i.terminals[0].id : 1;
|
|
160
171
|
return {
|
|
161
|
-
traceLocation: new
|
|
172
|
+
traceLocation: new w({
|
|
162
173
|
type: r,
|
|
163
174
|
isFilterBarrier: !1,
|
|
164
175
|
globalId: o,
|
|
165
|
-
terminalId:
|
|
176
|
+
terminalId: l
|
|
166
177
|
}),
|
|
167
178
|
flagProperties: {
|
|
168
|
-
title:
|
|
179
|
+
title: n,
|
|
169
180
|
expanded: !1,
|
|
170
181
|
terminalConfiguration: i ?? void 0,
|
|
171
|
-
selectedTerminals: i ? /* @__PURE__ */ new Set([
|
|
182
|
+
selectedTerminals: i ? /* @__PURE__ */ new Set([l]) : void 0
|
|
172
183
|
},
|
|
173
184
|
spatialProperties: {
|
|
174
185
|
mapPoint: t,
|
|
@@ -177,15 +188,15 @@ class R extends v {
|
|
|
177
188
|
};
|
|
178
189
|
} else if (a === "polyline") {
|
|
179
190
|
const i = this._calculatePercentAlong(e.geometry, t);
|
|
180
|
-
return i < 0 ? (
|
|
181
|
-
traceLocation: new
|
|
191
|
+
return i < 0 ? (c("warn", this, "Unable to calculate percent along for polyline flag."), null) : {
|
|
192
|
+
traceLocation: new w({
|
|
182
193
|
type: r,
|
|
183
194
|
isFilterBarrier: !1,
|
|
184
195
|
globalId: o,
|
|
185
196
|
percentAlong: i
|
|
186
197
|
}),
|
|
187
198
|
flagProperties: {
|
|
188
|
-
title:
|
|
199
|
+
title: n,
|
|
189
200
|
expanded: !1,
|
|
190
201
|
terminalConfiguration: void 0,
|
|
191
202
|
selectedTerminals: void 0
|
|
@@ -196,9 +207,9 @@ class R extends v {
|
|
|
196
207
|
}
|
|
197
208
|
};
|
|
198
209
|
} else if (!a) {
|
|
199
|
-
const i =
|
|
210
|
+
const i = R(e.layer) ? e.layer.parent : e.layer, l = i && this._edgeSourceLayerIds.includes(i.layerId), u = s?.getTerminalConfiguration(e), p = u ? u.terminals[0].id : l ? -1 : 1, d = l ? 0.5 : -1;
|
|
200
211
|
return {
|
|
201
|
-
traceLocation: new
|
|
212
|
+
traceLocation: new w({
|
|
202
213
|
type: r,
|
|
203
214
|
isFilterBarrier: !1,
|
|
204
215
|
globalId: o,
|
|
@@ -206,10 +217,10 @@ class R extends v {
|
|
|
206
217
|
percentAlong: d
|
|
207
218
|
}),
|
|
208
219
|
flagProperties: {
|
|
209
|
-
title:
|
|
220
|
+
title: n,
|
|
210
221
|
expanded: !1,
|
|
211
|
-
terminalConfiguration:
|
|
212
|
-
selectedTerminals:
|
|
222
|
+
terminalConfiguration: u ?? void 0,
|
|
223
|
+
selectedTerminals: u ? /* @__PURE__ */ new Set([p]) : void 0
|
|
213
224
|
},
|
|
214
225
|
spatialProperties: {
|
|
215
226
|
mapPoint: t,
|
|
@@ -220,11 +231,11 @@ class R extends v {
|
|
|
220
231
|
return null;
|
|
221
232
|
}
|
|
222
233
|
async _generateItemTitle(e) {
|
|
223
|
-
const { messages: t } = this, r = (
|
|
234
|
+
const { messages: t } = this, r = (k(e.layer), e.layer);
|
|
224
235
|
return ("getFeatureTitle" in r ? await r.getFeatureTitle(e) : null) || e?.getObjectId()?.toString() || t.labels.unknown;
|
|
225
236
|
}
|
|
226
237
|
_addFlagGraphic(e, t, r) {
|
|
227
|
-
const s = e.geometry ? e.geometry.type === "point" ? e.geometry : t : null, o = this._createFlagSymbol(), a = new
|
|
238
|
+
const s = e.geometry ? e.geometry.type === "point" ? e.geometry : t : null, o = this._createFlagSymbol(), a = new A({
|
|
228
239
|
geometry: s,
|
|
229
240
|
symbol: o,
|
|
230
241
|
attributes: e.attributes
|
|
@@ -233,7 +244,7 @@ class R extends v {
|
|
|
233
244
|
}
|
|
234
245
|
_createFlagSymbol() {
|
|
235
246
|
const { traceLocationType: e } = this, t = [244, 21, 21, 0.6], r = [21, 244, 21, 0.6];
|
|
236
|
-
return e === "stopping-point" ? new
|
|
247
|
+
return e === "stopping-point" ? new S({
|
|
237
248
|
color: t,
|
|
238
249
|
style: "x",
|
|
239
250
|
size: 12,
|
|
@@ -241,7 +252,7 @@ class R extends v {
|
|
|
241
252
|
color: t,
|
|
242
253
|
width: 2
|
|
243
254
|
}
|
|
244
|
-
}) : e === "barrier" ? new
|
|
255
|
+
}) : e === "barrier" ? new S({
|
|
245
256
|
color: t,
|
|
246
257
|
style: "square",
|
|
247
258
|
size: 12,
|
|
@@ -249,7 +260,7 @@ class R extends v {
|
|
|
249
260
|
color: t,
|
|
250
261
|
width: 0
|
|
251
262
|
}
|
|
252
|
-
}) : new
|
|
263
|
+
}) : new S({
|
|
253
264
|
color: r,
|
|
254
265
|
style: "circle",
|
|
255
266
|
size: 12,
|
|
@@ -266,14 +277,14 @@ class R extends v {
|
|
|
266
277
|
}), t?.removeAll();
|
|
267
278
|
}
|
|
268
279
|
renderAddLocationBlock() {
|
|
269
|
-
const { traceLocationType: e, messages: t, traceLocations: r, view: s } = this, o = e === "starting-point" ? t.types.startingPoint : e === "barrier" ? t.types.barrier : t.types.stoppingPoint, a = o.heading,
|
|
270
|
-
return
|
|
280
|
+
const { traceLocationType: e, messages: t, traceLocations: r, view: s } = this, o = e === "starting-point" ? t.types.startingPoint : e === "barrier" ? t.types.barrier : t.types.stoppingPoint, a = o.heading, n = o.description, i = o.buttonText;
|
|
281
|
+
return b`<calcite-block .heading=${a} .label=${a} expanded .description=${n}>${r?.length ? b`<calcite-button class="clear-button" slot=actions-end appearance=transparent .label=${t.buttons.clear} @click=${() => this._handleClearButtonClick()}>${t.buttons.clear}</calcite-button><arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${e} .view=${s}></arcgis-utility-network-trace-location-list>` : null}<div class="button-container"><calcite-button .loading=${this.isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${i} @click=${() => this._handleAddButtonClick()}>${i}</calcite-button></div></calcite-block>`;
|
|
271
282
|
}
|
|
272
283
|
render() {
|
|
273
|
-
return
|
|
284
|
+
return b`<div class="root">${this.renderAddLocationBlock()}</div>`;
|
|
274
285
|
}
|
|
275
286
|
}
|
|
276
|
-
|
|
287
|
+
C("arcgis-utility-network-trace-location", E);
|
|
277
288
|
export {
|
|
278
|
-
|
|
289
|
+
E as ArcgisUtilityNetworkTraceLocation
|
|
279
290
|
};
|