@arcgis/map-components 5.1.0-next.47 → 5.1.0-next.49
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/{JFNCIZRD.js → 2CHYBLOC.js} +1 -1
- package/dist/cdn/{UMPYIYP6.js → 2G3HODZY.js} +1 -1
- package/dist/cdn/{ERCTSHRH.js → 3KOWS73L.js} +1 -1
- package/dist/cdn/3KZ42JDF.js +2 -0
- package/dist/cdn/4BF7JJHX.js +2 -0
- package/dist/cdn/{T5MRUYOH.js → 53A4TVFJ.js} +1 -1
- package/dist/cdn/{5FJIKNID.js → 63VDVNOO.js} +1 -1
- package/dist/cdn/{CYSDIJ4L.js → 73W64JNK.js} +1 -1
- package/dist/cdn/DE5AA22M.js +2 -0
- package/dist/cdn/{YET5HTLQ.js → DEUTYZQD.js} +1 -1
- package/dist/cdn/{BDA4BCEB.js → DQJMLG55.js} +1 -1
- package/dist/cdn/DYI5GSBP.js +2 -0
- package/dist/cdn/{KWZTLNUH.js → FL3CDOKT.js} +1 -1
- package/dist/cdn/{CC77IOI3.js → G2QS2EES.js} +1 -1
- package/dist/cdn/{FF5VMKLK.js → GV445FXS.js} +1 -1
- package/dist/cdn/{I6PZUSTS.js → HBJXWV7A.js} +1 -1
- package/dist/cdn/I7NY2VAH.js +2 -0
- package/dist/cdn/IUL5Z7VB.js +2 -0
- package/dist/cdn/{XOARVKET.js → MN6VPZBF.js} +1 -1
- package/dist/cdn/{ET2U2ZGP.js → P4KEOVAP.js} +1 -1
- package/dist/cdn/{LY77GAJT.js → RBTA7SDX.js} +1 -1
- package/dist/cdn/{6E7H5LPA.js → SUCLDKGU.js} +1 -1
- package/dist/cdn/{F2SNWNAZ.js → TPLNBIOY.js} +1 -1
- package/dist/cdn/{PNGKWZJQ.js → TVLLHHUA.js} +1 -1
- package/dist/cdn/{R42WEZRB.js → UDSVK25W.js} +1 -1
- package/dist/cdn/WDAYQZKY.js +2 -0
- package/dist/cdn/WH7FEIAX.js +2 -0
- package/dist/cdn/{REQFNQZY.js → WR3AVKYZ.js} +1 -1
- package/dist/cdn/{W27U4A3P.js → WUWAJE6E.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/layer-utils.js +15 -14
- package/dist/components/arcgis-bookmarks/customElement.js +1 -1
- package/dist/components/arcgis-building-explorer/customElement.js +14 -9
- package/dist/components/arcgis-coordinate-conversion/customElement.js +23 -22
- package/dist/components/arcgis-daylight/customElement.js +148 -144
- package/dist/components/arcgis-editor/customElement.js +1 -1
- package/dist/components/arcgis-sketch/customElement.js +13 -13
- package/dist/components/arcgis-snapping-controls/customElement.js +3 -3
- package/dist/components/arcgis-swipe/customElement.d.ts +5 -6
- package/dist/components/arcgis-swipe/customElement.js +55 -43
- package/dist/components/arcgis-utility-network-trace-inputs/customElement.js +68 -62
- package/dist/components/arcgis-utility-network-trace-location/customElement.d.ts +7 -2
- package/dist/components/arcgis-utility-network-trace-location/customElement.js +210 -216
- package/dist/components/arcgis-utility-network-trace-location-list/customElement.d.ts +3 -0
- package/dist/components/arcgis-utility-network-trace-location-list/customElement.js +12 -12
- package/dist/components/arcgis-volume-measurement/customElement.js +4 -4
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/package.json +4 -4
- package/dist/cdn/23JXEUKK.js +0 -2
- package/dist/cdn/76RS6RKB.js +0 -2
- package/dist/cdn/EHPHVZAX.js +0 -2
- package/dist/cdn/MYWUNBD6.js +0 -2
- package/dist/cdn/ORFDJKWO.js +0 -2
- package/dist/cdn/QRZPQOL3.js +0 -2
- package/dist/cdn/RUESKUUR.js +0 -2
- package/dist/cdn/WFCOTNQQ.js +0 -2
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type Collection from "@arcgis/core/core/Collection.js";
|
|
3
3
|
import type Point from "@arcgis/core/geometry/Point.js";
|
|
4
4
|
import type Graphic from "@arcgis/core/Graphic.js";
|
|
5
|
-
import type GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
|
|
6
5
|
import type Layer from "@arcgis/core/layers/Layer.js";
|
|
7
6
|
import type TerminalConfiguration from "@arcgis/core/networks/support/TerminalConfiguration.js";
|
|
8
7
|
import type UtilityNetwork from "@arcgis/core/networks/UtilityNetwork.js";
|
|
@@ -22,6 +21,13 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
|
22
21
|
* @internal
|
|
23
22
|
*/
|
|
24
23
|
export abstract class ArcgisUtilityNetworkTraceLocation extends LitElement {
|
|
24
|
+
/**
|
|
25
|
+
* A function to run after a hit test is performed to select a trace location. If left empty, the first graphic from the hit test results will be used as the trace location.
|
|
26
|
+
* This function allows for modification of the selected graphic before it is added as a trace location, such as changing its attributes or geometry.
|
|
27
|
+
* If the promise is rejected, the selection process will be cancelled.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
25
31
|
accessor afterHitTest: ((graphics: Graphic[]) => Promise<Graphic>) | undefined;
|
|
26
32
|
/** @default false */
|
|
27
33
|
accessor autoDestroyDisabled: boolean;
|
|
@@ -32,7 +38,6 @@ export abstract class ArcgisUtilityNetworkTraceLocation extends LitElement {
|
|
|
32
38
|
*/
|
|
33
39
|
accessor beforeTraceLocationSelectStart: (() => Promise<void>) | undefined;
|
|
34
40
|
accessor filterLayers: Collection<Layer> | undefined;
|
|
35
|
-
accessor flagLayer: GraphicsLayer | undefined;
|
|
36
41
|
/** @internal */
|
|
37
42
|
protected messages: {
|
|
38
43
|
buttons: { clear: string; };
|
|
@@ -1,296 +1,290 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { LitElement as
|
|
13
|
-
import { log as
|
|
14
|
-
import { u as
|
|
15
|
-
import { i as
|
|
16
|
-
const
|
|
17
|
-
class
|
|
2
|
+
import { c as k } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as _, html as f } from "lit";
|
|
4
|
+
import * as x from "@arcgis/core/geometry/operators/cutOperator.js";
|
|
5
|
+
import * as y from "@arcgis/core/geometry/operators/lengthOperator.js";
|
|
6
|
+
import * as m from "@arcgis/core/geometry/operators/projectOperator.js";
|
|
7
|
+
import C from "@arcgis/core/geometry/Polyline.js";
|
|
8
|
+
import I from "@arcgis/core/geometry/SpatialReference.js";
|
|
9
|
+
import F from "@arcgis/core/Graphic.js";
|
|
10
|
+
import b from "@arcgis/core/rest/networks/support/TraceLocation.js";
|
|
11
|
+
import w from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
|
|
12
|
+
import { LitElement as A, createEvent as T } from "@arcgis/lumina";
|
|
13
|
+
import { log as u, composeMissingPropertyMessage as g } from "@arcgis/toolkit/log";
|
|
14
|
+
import { u as G } from "../../chunks/useT9n.js";
|
|
15
|
+
import { d as S, i as v } from "../../chunks/layer-utils.js";
|
|
16
|
+
const P = _`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 N extends A {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(...arguments), this.messages =
|
|
19
|
+
super(...arguments), this.messages = G({ blocking: !0 }), this.isSelectWaiting = !1, this.traceLocationType = "starting-point", this.spatialTolerance = 0.05, this.autoDestroyDisabled = !1, this.arcgisTraceLocationChange = T(), this.arcgisTraceLocationSelectEnd = T(), this.arcgisTraceLocationSelectStart = T();
|
|
20
20
|
}
|
|
21
21
|
static {
|
|
22
|
-
this.properties = { isSelectWaiting: 16, beforeTraceLocationSelectStart: 0, afterHitTest: 0, view: 0, traceLocationType: 1, traceLocations: 0, filterLayers: 0, sketchViewModel: 0,
|
|
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
|
-
this.
|
|
28
|
+
this._resetCursor(), await this.manager.destroy();
|
|
29
29
|
}
|
|
30
30
|
async load() {
|
|
31
|
-
|
|
31
|
+
m.isLoaded() || await m.load();
|
|
32
32
|
}
|
|
33
|
-
_createPolyline(
|
|
34
|
-
return new
|
|
33
|
+
_createPolyline(t, e) {
|
|
34
|
+
return new C({
|
|
35
35
|
hasZ: !1,
|
|
36
36
|
hasM: !0,
|
|
37
|
-
paths:
|
|
38
|
-
spatialReference: new
|
|
37
|
+
paths: t,
|
|
38
|
+
spatialReference: new I({ wkid: e })
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
_calculatePercentAlong(
|
|
42
|
-
const r =
|
|
41
|
+
_calculatePercentAlong(t, e) {
|
|
42
|
+
const r = t.spatialReference, s = this._createPolyline(t.paths, r.wkid), o = e.x - 0.5, i = e.x + 0.5, c = e.y - 0.5, a = e.y + 0.5, n = [
|
|
43
43
|
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
44
|
+
[o, c],
|
|
45
|
+
[i, a]
|
|
46
46
|
]
|
|
47
|
-
],
|
|
48
|
-
if (!
|
|
49
|
-
return
|
|
50
|
-
const d =
|
|
47
|
+
], l = this._createPolyline(n, e.spatialReference.wkid), p = m.execute(l, r);
|
|
48
|
+
if (!p)
|
|
49
|
+
return u("error", this, "Unable to project flag geometry to source geometry spatial reference."), 0.5;
|
|
50
|
+
const d = x.execute(s, p);
|
|
51
51
|
if (d.length > 0) {
|
|
52
|
-
const
|
|
53
|
-
let
|
|
54
|
-
return d[0].paths[0][0][0] ===
|
|
52
|
+
const L = y.execute(s, { unit: "feet" });
|
|
53
|
+
let h;
|
|
54
|
+
return d[0].paths[0][0][0] === s.paths[0][0][0] ? h = y.execute(d[0], { unit: "feet" }) : d.length > 1 ? h = y.execute(d[1], { unit: "feet" }) : h = 0, h / L;
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return u("warn", this, "Unable to cut the source geometry with the flag geometry."), 0.5;
|
|
57
57
|
}
|
|
58
58
|
get _edgeSourceLayerIds() {
|
|
59
|
-
const
|
|
60
|
-
return
|
|
59
|
+
const t = this.utilityNetwork?.dataElement?.domainNetworks;
|
|
60
|
+
return t ? t.flatMap((e) => e.edgeSources).map((e) => e.layerId).filter(Boolean) : [];
|
|
61
61
|
}
|
|
62
|
-
async
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
async _handleAddButtonClick() {
|
|
63
|
+
const { view: t, sketchViewModel: e } = this;
|
|
64
|
+
if (!(t && e)) {
|
|
65
|
+
u("error", this, "Cannot add trace location."), e || u("error", this, g("sketchViewModel")), t || u("error", this, g("view"));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (this.beforeTraceLocationSelectStart) {
|
|
69
|
+
this.isSelectWaiting = !0;
|
|
70
|
+
try {
|
|
71
|
+
await this.beforeTraceLocationSelectStart();
|
|
72
|
+
} finally {
|
|
73
|
+
this.isSelectWaiting = !1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.arcgisTraceLocationSelectStart.emit({ cancelSelect: () => e.cancel() }).defaultPrevented || await this._startSketch(t, e);
|
|
77
|
+
}
|
|
78
|
+
async _startSketch(t, e) {
|
|
79
|
+
this._clickHandler?.remove(), this._clickHandler = e.on("create", (r) => this._handleSketchComplete(r, t, e)), "acquireCursor" in t && t.acquireCursor("crosshair"), this.sketchViewModel?.create("point");
|
|
68
80
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
l("error", this, "`view` is unavailable or there are no results to process.");
|
|
81
|
+
_handleSketchComplete(t, e, r) {
|
|
82
|
+
if (t.state === "complete" && t.graphic) {
|
|
83
|
+
r.layer.remove(t.graphic), this._performHitTest(t, e, r);
|
|
73
84
|
return;
|
|
74
85
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (!
|
|
80
|
-
|
|
86
|
+
t.state === "cancel" && (this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit());
|
|
87
|
+
}
|
|
88
|
+
async _performHitTest(t, e, r) {
|
|
89
|
+
const { utilityNetwork: s } = this;
|
|
90
|
+
if (!s) {
|
|
91
|
+
u("error", this, g("utilityNetwork")), this._resetCursor(), this.arcgisTraceLocationSelectEnd.emit();
|
|
81
92
|
return;
|
|
82
93
|
}
|
|
83
|
-
const o =
|
|
84
|
-
if (!
|
|
85
|
-
|
|
94
|
+
const o = t.graphic?.geometry, i = e.toScreen(o);
|
|
95
|
+
if (!i) {
|
|
96
|
+
u("warn", this, "No screen point available for hit test."), this._startSketch(e, r);
|
|
86
97
|
return;
|
|
87
98
|
}
|
|
88
|
-
await
|
|
99
|
+
const a = (await e.hitTest(i, {
|
|
100
|
+
include: this.filterLayers
|
|
101
|
+
})).results.filter((n) => n.type === "graphic" && n?.layer && n.graphic);
|
|
102
|
+
if (a.length === 0) {
|
|
103
|
+
u("info", this, "No usable hit test results found."), this._startSketch(e, r);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this._resetCursor(), await this._processHitTestResults(a, o, e), this.arcgisTraceLocationSelectEnd.emit();
|
|
89
107
|
}
|
|
90
|
-
|
|
91
|
-
const {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
color: t,
|
|
98
|
-
width: 2
|
|
99
|
-
}
|
|
100
|
-
}) : e === "barrier" ? new b({
|
|
101
|
-
color: t,
|
|
102
|
-
style: "square",
|
|
103
|
-
size: 12,
|
|
104
|
-
outline: {
|
|
105
|
-
color: t,
|
|
106
|
-
width: 0
|
|
107
|
-
}
|
|
108
|
-
}) : new b({
|
|
109
|
-
color: r,
|
|
110
|
-
style: "circle",
|
|
111
|
-
size: 12,
|
|
112
|
-
outline: {
|
|
113
|
-
color: r,
|
|
114
|
-
width: 0
|
|
115
|
-
}
|
|
116
|
-
});
|
|
108
|
+
_resetCursor() {
|
|
109
|
+
const { view: t } = this;
|
|
110
|
+
if (!t) {
|
|
111
|
+
u("error", this, g("view"));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this._clickHandler?.remove(), this._clickHandler = void 0, "acquireCursor" in t && t.acquireCursor("default");
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
async _processHitTestResults(t, e, r) {
|
|
117
|
+
if (t.length === 0) {
|
|
118
|
+
u("error", this, "There are no hit test results to process.");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const s = t[0], o = t.map((a) => {
|
|
122
|
+
const n = a, l = n.graphic;
|
|
123
|
+
return l.origin = n.layer, l.sourceLayer = n.layer, l;
|
|
124
|
+
}), i = this.afterHitTest ? await this.afterHitTest(o).catch(() => (
|
|
125
|
+
// if the callback is rejected treat it as a cancellation of the selection process, and do not add a trace location
|
|
126
|
+
null
|
|
127
|
+
)) : s.graphic;
|
|
128
|
+
if (!i) {
|
|
129
|
+
u("error", this, "No graphic available from hit test results."), this.arcgisTraceLocationSelectEnd.emit();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const c = await this._ensureNecessaryAttributes(i);
|
|
133
|
+
if (!c) {
|
|
134
|
+
u("error", this, "Unable to ensure necessary attributes on the selected graphic."), this.arcgisTraceLocationSelectEnd.emit();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
await this._generateTraceLocation(c, e, r);
|
|
131
138
|
}
|
|
132
|
-
async
|
|
133
|
-
const
|
|
134
|
-
|
|
139
|
+
async _ensureNecessaryAttributes(t) {
|
|
140
|
+
const e = (S(t.layer), t.layer), r = e.fieldsIndex?.get("assetgroup") ?? !1, s = e.fieldsIndex?.get("assetgroup")?.name ?? "assetgroup", o = e.fieldsIndex?.get("assettype") ?? !1, i = e.fieldsIndex?.get("assettype")?.name ?? "assettype", c = t.getGlobalId(), a = t.getObjectId(), n = r ? !!t.getAttribute(s) : !0, l = o ? !!t.getAttribute(i) : !0;
|
|
141
|
+
if (c && a && n && l)
|
|
142
|
+
return t;
|
|
143
|
+
const p = e.createQuery();
|
|
144
|
+
return p.objectIds = [a], (await e.queryFeatures(p))?.features[0] || null;
|
|
135
145
|
}
|
|
136
|
-
async
|
|
137
|
-
const {
|
|
138
|
-
if (
|
|
139
|
-
|
|
146
|
+
async _generateTraceLocation(t, e, r) {
|
|
147
|
+
const { traceLocations: s } = this, o = t.getGlobalId() ?? "", i = t.geometry?.type, c = await this._generateFlagInfo(t, e);
|
|
148
|
+
if (!c) {
|
|
149
|
+
u("error", this, "Unable to generate flag info for trace location.");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const a = s?.filter((l) => l.spatialProperties.mapGraphic?.getGlobalId() === o) ?? [];
|
|
153
|
+
if (a.length > 0) {
|
|
154
|
+
if (i !== "polyline") {
|
|
155
|
+
u("warn", this, "A flag with the same globalId already exists.");
|
|
156
|
+
return;
|
|
157
|
+
} else if (a.some((l) => Math.abs(l.traceLocation.percentAlong - c.traceLocation.percentAlong) <= this.spatialTolerance)) {
|
|
158
|
+
u("warn", this, "A flag with the same globalId already exists within tolerance.");
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const n = this._addFlagGraphic(t, e, r);
|
|
163
|
+
if (!n) {
|
|
164
|
+
u("warn", this, "Unable to add flag graphic.");
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
c.spatialProperties.flagGraphic = n, s?.add(c);
|
|
168
|
+
}
|
|
169
|
+
async _generateFlagInfo(t, e) {
|
|
170
|
+
const { traceLocationType: r, utilityNetwork: s } = this, o = t.getGlobalId() ?? "", i = t.geometry?.type, c = await this._generateItemTitle(t);
|
|
171
|
+
if (i === "point" || i === "polygon") {
|
|
172
|
+
const a = s?.getTerminalConfiguration(t), n = a ? a.terminals[0].id : 1;
|
|
140
173
|
return {
|
|
141
|
-
traceLocation: new
|
|
174
|
+
traceLocation: new b({
|
|
142
175
|
type: r,
|
|
143
176
|
isFilterBarrier: !1,
|
|
144
|
-
globalId:
|
|
145
|
-
terminalId:
|
|
177
|
+
globalId: o,
|
|
178
|
+
terminalId: n
|
|
146
179
|
}),
|
|
147
180
|
flagProperties: {
|
|
148
|
-
title:
|
|
181
|
+
title: c,
|
|
149
182
|
expanded: !1,
|
|
150
|
-
terminalConfiguration:
|
|
151
|
-
selectedTerminals:
|
|
183
|
+
terminalConfiguration: a ?? void 0,
|
|
184
|
+
selectedTerminals: a ? /* @__PURE__ */ new Set([n]) : void 0
|
|
152
185
|
},
|
|
153
186
|
spatialProperties: {
|
|
154
|
-
mapPoint:
|
|
155
|
-
mapGraphic:
|
|
187
|
+
mapPoint: e,
|
|
188
|
+
mapGraphic: t
|
|
156
189
|
}
|
|
157
190
|
};
|
|
158
|
-
} else if (
|
|
159
|
-
const
|
|
191
|
+
} else if (i === "polyline") {
|
|
192
|
+
const a = this._calculatePercentAlong(t.geometry, e);
|
|
160
193
|
return {
|
|
161
|
-
traceLocation: new
|
|
194
|
+
traceLocation: new b({
|
|
162
195
|
type: r,
|
|
163
196
|
isFilterBarrier: !1,
|
|
164
|
-
globalId:
|
|
165
|
-
percentAlong:
|
|
197
|
+
globalId: o,
|
|
198
|
+
percentAlong: a
|
|
166
199
|
}),
|
|
167
200
|
flagProperties: {
|
|
168
|
-
title:
|
|
201
|
+
title: c,
|
|
169
202
|
expanded: !1
|
|
170
203
|
},
|
|
171
204
|
spatialProperties: {
|
|
172
|
-
mapPoint:
|
|
173
|
-
mapGraphic:
|
|
205
|
+
mapPoint: e,
|
|
206
|
+
mapGraphic: t
|
|
174
207
|
}
|
|
175
208
|
};
|
|
176
|
-
} else if (!
|
|
177
|
-
const
|
|
209
|
+
} else if (!i) {
|
|
210
|
+
const a = v(t.layer) ? t.layer.parent : t.layer, n = a && this._edgeSourceLayerIds.includes(a.layerId), l = s?.getTerminalConfiguration(t), p = l ? l.terminals[0].id : n ? -1 : 1, d = n ? 0.5 : -1;
|
|
178
211
|
return {
|
|
179
|
-
traceLocation: new
|
|
212
|
+
traceLocation: new b({
|
|
180
213
|
type: r,
|
|
181
214
|
isFilterBarrier: !1,
|
|
182
|
-
globalId:
|
|
183
|
-
terminalId:
|
|
215
|
+
globalId: o,
|
|
216
|
+
terminalId: p,
|
|
184
217
|
percentAlong: d
|
|
185
218
|
}),
|
|
186
219
|
flagProperties: {
|
|
187
|
-
title:
|
|
220
|
+
title: c,
|
|
188
221
|
expanded: !1,
|
|
189
|
-
terminalConfiguration:
|
|
190
|
-
selectedTerminals:
|
|
222
|
+
terminalConfiguration: l ?? void 0,
|
|
223
|
+
selectedTerminals: l ? /* @__PURE__ */ new Set([p]) : void 0
|
|
191
224
|
},
|
|
192
225
|
spatialProperties: {
|
|
193
|
-
mapPoint:
|
|
226
|
+
mapPoint: e,
|
|
227
|
+
mapGraphic: t
|
|
194
228
|
}
|
|
195
229
|
};
|
|
196
230
|
}
|
|
197
231
|
return null;
|
|
198
232
|
}
|
|
199
|
-
async
|
|
200
|
-
const {
|
|
201
|
-
|
|
202
|
-
l("error", this, "Unable to generate flag info for trace location.");
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
const o = r?.filter((i) => i.spatialProperties.mapGraphic?.getGlobalId() === a) ?? [];
|
|
206
|
-
if (o.length === 0 || s === "polyline") {
|
|
207
|
-
if (s === "polyline" && o.length > 0 && o.some((c) => Math.abs(c.traceLocation.percentAlong - n.traceLocation.percentAlong) <= this.spatialTolerance)) {
|
|
208
|
-
l("warn", this, "A flag with the same globalId already exists within tolerance.");
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const i = this._addFlagGraphic(a, e, t);
|
|
212
|
-
if (!i) {
|
|
213
|
-
l("warn", this, "Unable to add flag graphic.");
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
n.spatialProperties.flagGraphic = i, r?.add(n);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
l("warn", this, "A flag with the same globalId already exists.");
|
|
220
|
-
}
|
|
221
|
-
async _hitTest(e) {
|
|
222
|
-
const { view: t, utilityNetwork: r } = this;
|
|
223
|
-
if (!t || !r)
|
|
224
|
-
return l("error", this, "Either `utilityNetwork` or `view` is unavailable for hit test."), !0;
|
|
225
|
-
const a = e.graphic?.geometry, s = this.view?.toScreen(a);
|
|
226
|
-
if (!s)
|
|
227
|
-
return l("warn", this, "No screen point available for hit test."), !1;
|
|
228
|
-
const o = (await t.hitTest(s, {
|
|
229
|
-
include: this.filterLayers
|
|
230
|
-
})).results.filter((i) => i.type === "graphic" && i?.layer && i.graphic);
|
|
231
|
-
return o.length === 0 ? (l("info", this, "No usable hit test results found."), !1) : (this._resetAfterSketch(!1), await this._ensureNecessaryAttributesAndGenerateTraceLocation(o, a), this._resetAfterSketch(!0), !0);
|
|
232
|
-
}
|
|
233
|
-
_resetAfterSketch(e = !1) {
|
|
234
|
-
const { view: t } = this;
|
|
235
|
-
if (!t) {
|
|
236
|
-
l("error", this, "View is not available to reset after sketch.");
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
this._clickHandler?.remove(), this._clickHandler = void 0, "acquireCursor" in t && t.acquireCursor("default"), e && this.arcgisTraceLocationSelectEnd.emit();
|
|
240
|
-
}
|
|
241
|
-
_handleSketchComplete(e) {
|
|
242
|
-
const { sketchViewModel: t, view: r } = this;
|
|
243
|
-
if (!t || !r) {
|
|
244
|
-
l("error", this, "Either `sketchViewModel` or `view` is not available in sketch complete handler.");
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (e.state === "complete" && e.graphic) {
|
|
248
|
-
t.layer.remove(e.graphic), this._hitTest(e).then((s) => {
|
|
249
|
-
s ? this._resetAfterSketch() : this._initiateHitTest();
|
|
250
|
-
});
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
e.state === "cancel" && this._resetAfterSketch(!0);
|
|
233
|
+
async _generateItemTitle(t) {
|
|
234
|
+
const { messages: e } = this, r = (S(t.layer), t.layer);
|
|
235
|
+
return ("getFeatureTitle" in r ? await r.getFeatureTitle(t) : null) || t?.getObjectId()?.toString() || e.labels.unknown;
|
|
254
236
|
}
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
237
|
+
_addFlagGraphic(t, e, r) {
|
|
238
|
+
const s = t.geometry?.type === "point" ? t.geometry : e, o = this._createFlagSymbol(), i = new F({
|
|
239
|
+
geometry: s,
|
|
240
|
+
symbol: o,
|
|
241
|
+
attributes: t.attributes
|
|
242
|
+
});
|
|
243
|
+
return r.graphics.add(i), i;
|
|
262
244
|
}
|
|
263
|
-
|
|
264
|
-
const {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
await this.beforeTraceLocationSelectStart();
|
|
273
|
-
} finally {
|
|
274
|
-
this.isSelectWaiting = !1;
|
|
245
|
+
_createFlagSymbol() {
|
|
246
|
+
const { traceLocationType: t } = this, e = [244, 21, 21, 0.6], r = [21, 244, 21, 0.6];
|
|
247
|
+
return t === "stopping-point" ? new w({
|
|
248
|
+
color: e,
|
|
249
|
+
style: "x",
|
|
250
|
+
size: 12,
|
|
251
|
+
outline: {
|
|
252
|
+
color: e,
|
|
253
|
+
width: 2
|
|
275
254
|
}
|
|
276
|
-
}
|
|
277
|
-
|
|
255
|
+
}) : t === "barrier" ? new w({
|
|
256
|
+
color: e,
|
|
257
|
+
style: "square",
|
|
258
|
+
size: 12,
|
|
259
|
+
outline: {
|
|
260
|
+
color: e,
|
|
261
|
+
width: 0
|
|
262
|
+
}
|
|
263
|
+
}) : new w({
|
|
264
|
+
color: r,
|
|
265
|
+
style: "circle",
|
|
266
|
+
size: 12,
|
|
267
|
+
outline: {
|
|
268
|
+
color: r,
|
|
269
|
+
width: 0
|
|
270
|
+
}
|
|
271
|
+
});
|
|
278
272
|
}
|
|
279
273
|
_handleClearButtonClick() {
|
|
280
|
-
const {
|
|
281
|
-
|
|
282
|
-
r.spatialProperties.flagGraphic &&
|
|
283
|
-
}),
|
|
274
|
+
const { view: t, traceLocations: e } = this;
|
|
275
|
+
e?.forEach((r) => {
|
|
276
|
+
r.spatialProperties.flagGraphic && t && t.graphics.remove(r.spatialProperties.flagGraphic);
|
|
277
|
+
}), e?.removeAll();
|
|
284
278
|
}
|
|
285
279
|
renderAddLocationBlock() {
|
|
286
|
-
const { traceLocationType:
|
|
287
|
-
return
|
|
280
|
+
const { traceLocationType: t, messages: e, traceLocations: r, view: s } = this, o = t === "starting-point" ? e.types.startingPoint : t === "barrier" ? e.types.barrier : e.types.stoppingPoint, i = o.heading, c = o.description, a = o.buttonText;
|
|
281
|
+
return f`<calcite-block .heading=${i} .label=${i} expanded .description=${c}>${r?.length ? f`<calcite-button class="clear-button" slot=actions-end appearance=transparent .label=${e.buttons.clear} @click=${() => this._handleClearButtonClick()}>${e.buttons.clear}</calcite-button>` : null}<arcgis-utility-network-trace-location-list .traceLocations=${r} .traceLocationType=${t} .view=${s}></arcgis-utility-network-trace-location-list><div class="button-container"><calcite-button .loading=${this.isSelectWaiting} class="add-location-button" icon-start=select appearance=outline .label=${a} @click=${() => this._handleAddButtonClick()}>${a}</calcite-button></div></calcite-block>`;
|
|
288
282
|
}
|
|
289
283
|
render() {
|
|
290
|
-
return
|
|
284
|
+
return f`<div class="root">${this.renderAddLocationBlock()}</div>`;
|
|
291
285
|
}
|
|
292
286
|
}
|
|
293
|
-
|
|
287
|
+
k("arcgis-utility-network-trace-location", N);
|
|
294
288
|
export {
|
|
295
|
-
|
|
289
|
+
N as ArcgisUtilityNetworkTraceLocation
|
|
296
290
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type Collection from "@arcgis/core/core/Collection.js";
|
|
3
|
+
import type MapView from "@arcgis/core/views/MapView.js";
|
|
3
4
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
5
|
import type { FlagInfo, TraceLocationType } from "../arcgis-utility-network-trace-location/customElement.js";
|
|
5
6
|
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
@@ -35,4 +36,6 @@ export abstract class ArcgisUtilityNetworkTraceLocationList extends LitElement {
|
|
|
35
36
|
accessor traceLocations: Collection<FlagInfo>;
|
|
36
37
|
/** @default "starting-point" */
|
|
37
38
|
accessor traceLocationType: TraceLocationType;
|
|
39
|
+
/** @required */
|
|
40
|
+
accessor view: MapView | undefined;
|
|
38
41
|
}
|
|
@@ -4,22 +4,22 @@ import { css as h, html as n } from "lit";
|
|
|
4
4
|
import u from "@arcgis/core/core/Collection.js";
|
|
5
5
|
import { substitute as g } from "@arcgis/core/intl.js";
|
|
6
6
|
import { LitElement as b } from "@arcgis/lumina";
|
|
7
|
-
import { u as
|
|
8
|
-
import { log as s, composeEmptyPropertyMessage as
|
|
9
|
-
const
|
|
10
|
-
class
|
|
7
|
+
import { u as v } from "../../chunks/useT9n.js";
|
|
8
|
+
import { log as s, composeEmptyPropertyMessage as f } from "@arcgis/toolkit/log";
|
|
9
|
+
const w = h`:host{margin-block-start:0;padding:0 var(--calcite-spacing-sm) var(--calcite-spacing-sm) var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}calcite-list{border:solid 1px var(--calcite-color-border-3);border-radius:var(--calcite-corner-radius-sm);overflow:hidden}calcite-list-item [slot=content-bottom]{background-color:transparent;display:none}calcite-list-item[expanded] [slot=content-bottom]{display:unset}.warning{color:var(--calcite-color-status-danger)}.terminals{padding-block:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-xl);padding-inline-end:var(--calcite-spacing-sm);display:flex;flex-direction:column}.filter-barrier-container{display:flex;width:100%;calcite-label{width:100%}}.filter-barrier{display:flex;justify-content:space-between;align-items:center;width:100%}`;
|
|
10
|
+
class y extends b {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this._messages =
|
|
12
|
+
super(...arguments), this._messages = v({ blocking: !0 }), this.traceLocations = new u(), this.traceLocationType = "starting-point";
|
|
13
13
|
}
|
|
14
14
|
static {
|
|
15
|
-
this.properties = { traceLocations: 0, traceLocationType: 1 };
|
|
15
|
+
this.properties = { traceLocations: 0, traceLocationType: 1, view: 0 };
|
|
16
16
|
}
|
|
17
17
|
static {
|
|
18
|
-
this.styles =
|
|
18
|
+
this.styles = w;
|
|
19
19
|
}
|
|
20
20
|
_handleTraceLocationItemRemoved(e) {
|
|
21
|
-
const
|
|
22
|
-
e.spatialProperties.flagGraphic &&
|
|
21
|
+
const { traceLocations: i, view: t } = this;
|
|
22
|
+
e.spatialProperties.flagGraphic && t && t.graphics.remove(e.spatialProperties.flagGraphic), i?.remove(e);
|
|
23
23
|
}
|
|
24
24
|
_renderTerminal(e, i) {
|
|
25
25
|
const { flagProperties: t } = e, { selectedTerminals: r } = t;
|
|
@@ -59,10 +59,10 @@ class $ extends b {
|
|
|
59
59
|
}
|
|
60
60
|
render() {
|
|
61
61
|
const { _messages: e, traceLocationType: i } = this, t = g(e.labels.list, { traceLocationType: i }), r = this.traceLocations?.map((c) => this._renderListItem(c)).toArray() ?? [];
|
|
62
|
-
return r.length === 0 ? (s("warn", this,
|
|
62
|
+
return r.length === 0 ? (s("warn", this, f("traceLocations")), null) : n`<div><calcite-list interaction-mode=static selection-mode=none .label=${t}>${r}</calcite-list></div>`;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
p("arcgis-utility-network-trace-location-list",
|
|
65
|
+
p("arcgis-utility-network-trace-location-list", y);
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
y as ArcgisUtilityNetworkTraceLocationList
|
|
68
68
|
};
|