ESM: import UtilityNetworkTrace from "@arcgis/core/widgets/UtilityNetworkTrace.js";
CDN: const UtilityNetworkTrace = await $arcgis.import("@arcgis/core/widgets/UtilityNetworkTrace.js");
Class: @arcgis/core/widgets/UtilityNetworkTrace
Since: ArcGIS Maps SDK for JavaScript 4.22
The UtilityNetworkTrace widget provides a way to run traces in a Utility Network based on connectivity or traversability from set input flags. Input flags (starting points and barriers) can be set by clicking the view. Alternatively, the widget allows setting input flags programmatically on creation, or at runtime, by setting the flags property. The widget can execute one or multiple traces concurrently by selecting them from the trace types dropdown. Trace types can be preset in the widget programmatically on creation, or at runtime, by setting the selectedTraces property.
The trace results are returned as a selection or as graphics, or both (if aggregated geometry is set as a Result Type).
The resulting selection of features can be visualized in a list organized by asset groups and asset types if the showSelectionAttributes property is true
.
In the image above, the left image displays a list of trace results filtered by asset group. The center image displays a list of asset types for the asset group "Service Point". The right image displays a list of features for the asset type "Single Phase Low Voltage Meter".
Nonspatial data can be included as trace starting points and barriers. Additionally, users can examine nonspatial data within the trace results.
Notes
map
property in the View does not automatically refresh the contents of the UtilityNetworkTrace widget.Example
// Create a new instance of the UtilityNetworkTrace widget and set
// its required parameters.
const unTraceWidget = new UtilityNetworkTrace({
view: view
});
view.ui.add(unTraceWidget, "top-right");
Constructors
new UtilityNetworkTrace(properties)
Parameter
optionalSee the properties for a list of all the properties that may be passed into the constructor.
Show inherited properties Hide inherited properties
Property DetailsThe ID or node representing the DOM element containing the widget. This property can only be set once. The following examples are all valid use case when working with widgets.
Examples
// Create the HTML div element programmatically at runtime and set to the widget's container
const basemapGallery = new BasemapGallery({
view: view,
container: document.createElement("div")
});
// Add the widget to the top-right corner of the view
view.ui.add(basemapGallery, {
position: "top-right"
});
// Specify an already-defined HTML div element in the widget's container
const basemapGallery = new BasemapGallery({
view: view,
container: basemapGalleryDiv
});
// Add the widget to the top-right corner of the view
view.ui.add(basemapGallery, {
position: "top-right"
});
// HTML markup
<body>
<div id="viewDiv"></div>
<div id="basemapGalleryDiv"></div>
</body>
// Specify the widget while adding to the view's UI
const basemapGallery = new BasemapGallery({
view: view
});
// Add the widget to the top-right corner of the view
view.ui.add(basemapGallery, {
position: "top-right"
});
Inherited
Property declaredClass Stringreadonly
The name of the class. The declared class name is formatted as esri.folder.className
.
defaultGraphicColor GraphicColor
Since: ArcGIS Maps SDK for JavaScript 4.23 UtilityNetworkTrace since 4.22, defaultGraphicColor added at 4.23.
The default color to assign the aggregated geometry of a trace result.
Default Value:{ color: [255, 255, 0, 0.6], haloOpacity: 0.9, fillOpacity: 0.2, hex: "#FFFF00" }
When true, the widget is visually withdrawn and cannot be interacted with.
enableResultArea Boolean
Since: ArcGIS Maps SDK for JavaScript 4.27 UtilityNetworkTrace since 4.22, enableResultArea added at 4.27.
When true
, provides the ability to show the convex hull or buffer.
An array of map points to load into the widget to lookup flags.
Example
const unt = new UtilityNetworkTrace({
view: view,
showSelectionAttributes: true,
selectOnComplete: true,
showGraphicsOnComplete: true,
selectedTraces: ["{E8D545B8-596D-4656-BF5E-16C1D7CBEC9B}"],
flags: [
{
type: "starting-point",
mapPoint: {
spatialReference: { latestWkid: 3857, wkid: 102100 },
x: -9814829.166046409,
y: 5127094.1017433
}
},
{
type: "barrier",
mapPoint: {
spatialReference: { latestWkid: 3857, wkid: 102100 },
x: -9814828.449441982,
y: 5127089.085566963
}
}
]
});
gdbVersion String
Deprecated since version 4.31, gdbVersion will be removed and the gdbVersion of the UtilityNetwork will be consumed directly.
The Geodatabase version to pass into the trace.
Default Value:"sde.DEFAULT"
Since: ArcGIS Maps SDK for JavaScript 4.27 UtilityNetworkTrace since 4.22, icon added at 4.27.
Icon displayed in the widget's button.
Inherited
Property id String
The unique ID assigned to the widget when the widget is created. If not set by the developer, it will default to the container ID, or if that is not present then it will be automatically generated.
Since: ArcGIS Maps SDK for JavaScript 4.23 UtilityNetworkTrace since 4.22, inputSettings added at 4.23.
Custom labels, descriptions, and symbol for the input flags.
The widget's default label.
Since: ArcGIS Maps SDK for JavaScript 4.27 UtilityNetworkTrace since 4.22, resultAreaProperties added at 4.27.
The properties to determine the size and color of the result area convex hull or buffer, and determines if it displays on the map when the trace completes.
Default Value:{ type: "convexhull", distance: 10, unit: "meters", areaUnit: "square-meters", color: { color: [255, 165, 0, 0.5], haloOpacity: 0.9, fillOpacity: 0.2, hex: "#ffa500" }, show: false }
Example
const unt = new UtilityNetworkTrace({
un: un,
view: view,
enableResultArea: true,
resultAreaProperties: {
type: "buffer",
distance: 10,
unit: "feet",
areaUnit: "square-feet",
color: {
color: [255, 165, 0, 0.5],
haloOpacity: 0.9,
fillOpacity: 0.2,
hex: "#ffa500"
},
show: true
}
});
selectOnComplete Boolean
When true, the utility network elements are selected in the view when traces are completed.
selectedTraces String[]
A list of global Ids of traces to select on load
Example
const unt = new UtilityNetworkTrace({
view: view,
selectedTraces: ["{E8D545B8-596D-4656-BF5E-16C1D7CBEC9B}"]
});
showGraphicsOnComplete Boolean
When true, a graphic layer is added to the view to highlight the utility network elements when traces are completed.
showSelectionAttributes Boolean
Determines whether to show list of selection attributes
Since: ArcGIS Maps SDK for JavaScript 4.27 UtilityNetworkTrace since 4.22, utilityNetwork added at 4.27.
Determines the utility network to use.
The view from which the widget will operate.
The view model for this widget. This is a class that contains all the logic (properties and methods) that controls this widget's behavior. See the UtilityNetworkTraceViewModel class to access all properties and methods on the widget.
Inherited
Property visible Boolean
Indicates whether the widget is visible.
If false
, the widget will no longer be rendered in the web document. This may affect the layout of other elements or widgets in the document. For example, if this widget is the first of three widgets associated to the upper right hand corner of the view UI, then the other widgets will reposition when this widget is made invisible. For more information, refer to the css display value of "none"
.
Example
// Hides the widget in the view
widget.visible = false;
Show inherited methods Hide inherited methods
Method DetailsInherited
Method addHandles(handleOrHandles, groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles
const handle = reactiveUtils.when(
() => !view.updating,
() => {
wkidSelect.disabled = false;
},
{ once: true }
);
this.addHandles(handle);
// Destroy the object
this.destroy();
Parameters
Handles marked for removal once the object is destroyed.
groupKey *
optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
checkCanTrace(){Promise<void>}
Checks if the requirements to execute a trace are met. Returns an error if any of the requirements are not met.
Returns
Type Description Promise<void> When resolved, an error is returned if requirements are not met to execute a trace.Inherited
Method classes(classNames){String}
A utility method used for building the value for a widget's class
property. This aids in simplifying css class setup.
Returns
Type Description String The computed class name.Example
// .tsx syntax showing how to set css classes while rendering the widget
render() {
const dynamicClasses = {
[css.flip]: this.flip,
[css.primary]: this.primary
};
return (
<div class={classes(css.root, css.mixin, dynamicClasses)} />
);
}
confirmReset()
Prompts to clear all input flags, selected trace types, and the trace results.
Inherited
Method destroy()
Destroys the widget instance.
Inherited
Method emit(type, event){Boolean}
Emits an event on the instance. This method should only be used when creating subclasses of this class.
Parameters
The name of the event.
optionalThe event payload.
Returns
Type Description Booleantrue
if a listener was notified
Inherited
Method hasEventListener(type){Boolean}
Indicates whether there is an event listener on the instance that matches the provided event name.
Returns
Type Description Boolean Returns true if the class supports the input event.Inherited
Method hasHandles(groupKey){Boolean}
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.
Returns true if a named group of handles exist.
Parameter
groupKey *
optionalA group key.
Returns
Type Description Boolean Returnstrue
if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
obj.removeHandles("watch-view-updates");
}
Inherited
Method isFulfilled(){Boolean}
isFulfilled()
may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected). If it is fulfilled, true
will be returned.
Returns
Type Description Boolean Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).Inherited
Method isRejected(){Boolean}
isRejected()
may be used to verify if creating an instance of the class is rejected. If it is rejected, true
will be returned.
Returns
Type Description Boolean Indicates whether creating an instance of the class has been rejected.Inherited
Method isResolved(){Boolean}
isResolved()
may be used to verify if creating an instance of the class is resolved. If it is resolved, true
will be returned.
Returns
Type Description Boolean Indicates whether creating an instance of the class has been resolved.Inherited
Method on(type, listener){Object}
Registers an event handler on the instance. Call this method to hook an event with a listener.
Returns
Type Description Object Returns an event handler with aremove()
method that should be called to stop listening for the event(s). Property Type Description remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){
// event is the event handle returned after the event fires.
console.log(event.mapPoint);
});
Inherited
Method postInitialize()
Executes after widget is ready for rendering.
Inherited
Method removeHandles(groupKey)
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.
Removes a group of handles owned by the object.
Parameter
groupKey *
optionalA group key or an array or collection of group keys to remove.
Example
obj.removeHandles(); // removes handles from default group
obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");
Inherited
Method render(){Object}
This method is implemented by subclasses for rendering.
Returns
Type Description Object The rendered virtual node.Inherited
Method renderNow()
Renders widget to the DOM immediately.
Inherited
Method scheduleRender()
Schedules widget rendering. This method is useful for changes affecting the UI.
Inherited
Method when(callback, errback){Promise}
when()
may be leveraged once an instance of the class is created. This method takes two input parameters: a callback
function and an errback
function. The callback
executes when the instance of the class loads. The errback
executes if the instance of the class fails to load.
Parameters
optionalThe function to call when the promise resolves.
optionalThe function to execute when the promise fails.
Returns
Type Description Promise Returns a new Promise for the result ofcallback
.
Example
// Although this example uses the BasemapGallery widget, any class instance that is a promise may use when() in the same way
let bmGallery = new BasemapGallery();
bmGallery.when(function(){
// This function will execute once the promise is resolved
}, function(error){
// This function will execute if the promise is rejected due to an error
});
InputSetting Object
InputSetting represents the labels, descriptions, and symbols that can be overridden for the flags user interface (UI) in the UtilityNetworkTrace widget.
The flag type indicates which section will have its settings overridden.
The label that replaces either the default "Starting points" or "Barriers" headings depending on what flag type is passed.
The description that replaces the default sub-headings for either the starting points or barriers.
optionalThe symbol displayed next to either the "Starting points" or "Barriers" headings.
Example
// Set inputSettings with a SimpleMarkerSymbol
utilityNetworkTrace.inputSettings = [
{
type: "starting-point",
label: "Start locations",
description: "Add starting locations before running a trace!",
symbol: {
type: "simple-marker",
style: "cross",
color: "blue",
size: "8px",
outline: {
color: [ 255, 255, 0 ],
width: 3
}
}
}
]
Since: ArcGIS Maps SDK for JavaScript 4.23 UtilityNetworkTrace since 4.22, add-flag added at 4.23.
Fires when the button to add either a starting point or barrier is clicked.
The type of flag added.
Possible Values:"starting-point"|"barrier"
add-flag-complete
Since: ArcGIS Maps SDK for JavaScript 4.23 UtilityNetworkTrace since 4.22, add-flag-complete added at 4.23.
Fires when a flag point graphic is added to the map.
add-flag-error
Since: ArcGIS Maps SDK for JavaScript 4.23 UtilityNetworkTrace since 4.22, add-flag-error added at 4.23.
Fires when adding a flag point graphic to the map fails.
add-result-area
Since: ArcGIS Maps SDK for JavaScript 4.28 UtilityNetworkTrace since 4.22, add-result-area added at 4.28.
Fires when adding a result area graphic to the map.
The graphic of the result area generated from the trace.
create-result-area
Since: ArcGIS Maps SDK for JavaScript 4.29 UtilityNetworkTrace since 4.22, create-result-area added at 4.29.
Fires after a trace when enableResultArea is true.
remove-result-area
Since: ArcGIS Maps SDK for JavaScript 4.28 UtilityNetworkTrace since 4.22, remove-result-area added at 4.28.
Fires when removing a result area graphic from the map.
The removed graphic of the result area generated from the trace.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4