Provides the logic for the UtilityNetworkTrace widget.
- See also
Constructors
-
new UtilityNetworkTraceViewModel(properties)
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
String | The name of the class. more details | Accessor | |
GraphicColor | The default color to assign the aggregated geometry of a trace result. more details | UtilityNetworkTraceViewModel | |
FlagProperty[] | An array of map points to load into the widget to lookup flags. more details | UtilityNetworkTraceViewModel | |
String | The Geodatabase version to pass into the trace. more details | UtilityNetworkTraceViewModel | |
GoToOverride | This function provides the ability to override either the MapView goTo() or SceneView goTo() methods. more details | UtilityNetworkTraceViewModel | |
String[] | An array of global Ids of traces to select on initial load. more details | UtilityNetworkTraceViewModel | |
Boolean | When true, the utility network elements are selected in the view when traces are completed. more details | UtilityNetworkTraceViewModel | |
Boolean | When true, a graphic layer is added to the view to highlight the utility network elements when traces are completed. more details | UtilityNetworkTraceViewModel | |
Boolean | Determines whether to show the list of selected features from completed traces. more details | UtilityNetworkTraceViewModel | |
String | The view model's state. more details | UtilityNetworkTraceViewModel | |
MapView | The view from which the widget will operate. more details | UtilityNetworkTraceViewModel |
Property Details
-
The name of the class. The declared class name is formatted as
esri.folder.className
.
-
defaultGraphicColor GraphicColorSince: ArcGIS Maps SDK for JavaScript 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" }
-
flags FlagProperty[]
-
An array of map points to load into the widget to lookup flags.
- Default Value:[]
Exampleconst 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
-
The Geodatabase version to pass into the trace.
- Default Value:"sde.DEFAULT"
-
goToOverride GoToOverride
-
This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.
Example// The following snippet uses the Search widget but can be applied to any // widgets that support the goToOverride property. search.goToOverride = function(view, goToParams) { goToParams.options.duration = updatedDuration; return view.goTo(goToParams.target, goToParams.options); };
-
An array of global Ids of traces to select on initial load.
- Default Value:[]
-
selectOnComplete Boolean
-
When true, the utility network elements are selected in the view when traces are completed.
- Default Value:true
-
showGraphicsOnComplete Boolean
-
When true, a graphic layer is added to the view to highlight the utility network elements when traces are completed.
- Default Value:true
-
showSelectionAttributes Boolean
-
Determines whether to show the list of selected features from completed traces.
- Default Value:true
-
state Stringreadonly
-
The view model's state.
Possible Values:"loading"|"ready"
- Default Value:ready
-
view MapView
-
The view from which the widget will operate.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Promise<boolean> | Adds a flag point graphic for the click event on the view if there is a feature to query. more details | UtilityNetworkTraceViewModel | |
Adds one or more handles which are to be tied to the lifecycle of the object. more details | Accessor | ||
Promise | Create a graphic on the view’s graphics for the aggregated results of all the features returned by the trace. more details | UtilityNetworkTraceViewModel | |
Adds the selected terminal to a flag point. more details | UtilityNetworkTraceViewModel | ||
Promise<boolean> | Get all parameters for the trace type selected to be run before executing the trace. more details | UtilityNetworkTraceViewModel | |
Change the graphic color for the aggregated results of a trace. more details | UtilityNetworkTraceViewModel | ||
ValidSetup | May be used to verify if all requirements are met to execute a trace (at least 1 starting point and at least 1 trace type selected). more details | UtilityNetworkTraceViewModel | |
Boolean | Indicates if any selection exists on the view. more details | UtilityNetworkTraceViewModel | |
Removes a specific trace from the results. more details | UtilityNetworkTraceViewModel | ||
Promise<TraceResultExtend> | Executes the trace and returns all trace results as graphics and/or feature selections and functions. more details | UtilityNetworkTraceViewModel | |
Array<(EdgeSourceJSON|JunctionSourceJSON)> | Gets the valid edge and junction layers within the view that are part of the Utility Network and can be used for placing flags in the view. more details | UtilityNetworkTraceViewModel | |
Boolean | Returns true if a named group of handles exist. more details | Accessor | |
Promise<UtilityNetwork> | Reads the web map and loads the UtilityNetwork if it exists. more details | UtilityNetworkTraceViewModel | |
Enables or disables the filter barrier setting on barrier flags. more details | UtilityNetworkTraceViewModel | ||
Is used to merge the feature selections in the layer views when multiple traces are run. more details | UtilityNetworkTraceViewModel | ||
Promise<FeatureSetInfo[]> | Query the layers by ObjectID for more attributes not present on the trace result elements. more details | UtilityNetworkTraceViewModel | |
Promise<boolean> | Takes the result of a hit test to lookup the asset to create a flag for the trace. more details | UtilityNetworkTraceViewModel | |
Removes the selected flag from the view. more details | UtilityNetworkTraceViewModel | ||
Removes a group of handles owned by the object. more details | Accessor | ||
Removes a specific trace result graphic from the view’s graphics. more details | UtilityNetworkTraceViewModel | ||
Removes the selection from the layer view. more details | UtilityNetworkTraceViewModel | ||
Removes the selected terminal from the flag. more details | UtilityNetworkTraceViewModel | ||
Clears all inputs (flags, trace types) and all results (selections, graphics) in the view. more details | UtilityNetworkTraceViewModel | ||
Performs a selection on a layer view based on a list of ObjectIDs. more details | UtilityNetworkTraceViewModel | ||
Loops through the trace result elements to group them by network source id and selects them on the layer view. more details | UtilityNetworkTraceViewModel | ||
Set the trace type to be run from the available trace configurations in the WebMap. more details | UtilityNetworkTraceViewModel | ||
Preset a trace type to be run from the available trace configurations in the WebMap when the widget loads. more details | UtilityNetworkTraceViewModel | ||
Zoom to a flag's feature or a result feature in the view. more details | UtilityNetworkTraceViewModel |
Method Details
-
Adds a flag point graphic for the click event on the view if there is a feature to query.
Parametertype StringThe type of flag can be a
"starting point"
or a"barrier"
.ReturnsType Description Promise<boolean> When resolved, response is true
if there is a feature to query in the view.
-
addHandles(handleOrHandles, groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 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();
ParametershandleOrHandles WatchHandle|WatchHandle[]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.
-
addResultGraphicToView(trace, color){Promise}
-
Create a graphic on the view’s graphics for the aggregated results of all the features returned by the trace.
Parameterstrace TraceResultExtendThe aggregate of the trace configuration settings and the results for that trace.
color GraphicColorThe color for the graphic of the trace results in the view’s graphics.
ReturnsType Description Promise Resolves when the graphics are added to the view.
-
addTerminal(selectedTerminal, feature)
-
Adds the selected terminal to a flag point.
ParametersselectedTerminal StringThe terminal id of the selected terminal.
feature FlagPropertyThe flag to assign the terminal.
-
Get all parameters for the trace type selected to be run before executing the trace.
ReturnsType Description Promise<boolean> When resolved, response is true
when the parameters from the trace type have loaded.
-
changeResultGraphicColor(color, trace)
-
Change the graphic color for the aggregated results of a trace.
Parameterscolor GraphicColorThe color for the graphic of the trace results in the view’s graphics.
trace TraceResultExtendThe aggregate of the trace configuration settings and the results for that trace.
-
checkCanTrace(){ValidSetup}
-
May be used to verify if all requirements are met to execute a trace (at least 1 starting point and at least 1 trace type selected).
ReturnsType Description ValidSetup Represents whether a trace is setup correctly.
-
checkSelectionExist(){Boolean}
-
Indicates if any selection exists on the view.
ReturnsType Description Boolean Returns true
if selection exists on the view.
-
clearResult(trace)
-
Removes a specific trace from the results. This will also clear any graphics or selection in the view for that trace.
Parametertrace TraceItemThe trace that will be cleared.
-
executeTrace(traceItem, url, params){Promise<TraceResultExtend>}
-
Executes the trace and returns all trace results as graphics and/or feature selections and functions.
ParameterstraceItem TraceItemThe trace item input for the trace.
url StringThe URL of the service being traced.
params TraceParametersThe trace input parameters.
ReturnsType Description Promise<TraceResultExtend> Represents the trace results and its properties.
-
getValidSources(){Array<(EdgeSourceJSON|JunctionSourceJSON)>}
-
Gets the valid edge and junction layers within the view that are part of the Utility Network and can be used for placing flags in the view.
ReturnsType Description Array<(EdgeSourceJSON|JunctionSourceJSON)> The edge or junction layer info.
-
Since: ArcGIS Maps SDK for JavaScript 4.25
-
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
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"); }
-
loadUtilityNetwork(){Promise<UtilityNetwork>}
-
Reads the web map and loads the UtilityNetwork if it exists.
ReturnsType Description Promise<UtilityNetwork> Resolves when the UtilityNetwork has been loaded.
-
manageFilterBarrier(status, feature)
-
Enables or disables the filter barrier setting on barrier flags.
Parametersstatus BooleanWhether the filter barrier is enabled or disabled.
feature FlagPropertyThe barrier flag for which the filter barrier is enabled or disabled.
-
mergeSelection(status, trace)
-
Is used to merge the feature selections in the layer views when multiple traces are run.
Parametersstatus BooleanIf true, the trace selection results are part of the merged selection set.
trace TraceItemThe trace for which the status is defined.
-
queryFeaturesById(dataItems){Promise<FeatureSetInfo[]>}
-
Query the layers by ObjectID for more attributes not present on the trace result elements.
ParameterdataItems NetworkElement[]An array of NetworkElements.
ReturnsType Description Promise<FeatureSetInfo[]> When resolved, an array of FeatureSetInfo is returned.
-
Takes the result of a hit test to lookup the asset to create a flag for the trace.
Parameterse ClickEventThe click event.
flagType StringThe type of flag. It must be either
"starting point"
or"barrier"
.ReturnsType Description Promise<boolean> When resolved, returns true
for a successful hitTest.
-
removeFlag(flag)
-
Removes the selected flag from the view.
Parameterflag FlagPropertyThe FlagProperty to identify the flag to be removed.
-
removeHandles(groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
removeResultGraphicFromView(trace)
-
Removes a specific trace result graphic from the view’s graphics.
Parametertrace TraceResultExtendThe trace for which the graphic will be removed.
-
removeSelection()
-
Removes the selection from the layer view.
-
removeTerminal(selectedTerminal, feature)
-
Removes the selected terminal from the flag.
ParametersselectedTerminal StringThe terminal id of the selected terminal.
feature FlagPropertyThe flag to remove the terminal.
-
reset()
-
Clears all inputs (flags, trace types) and all results (selections, graphics) in the view.
-
selectFeaturesById(resultSet)
-
Performs a selection on a layer view based on a list of ObjectIDs.
ParameterresultSet NetworkElement[]An array of NetworkElements.
-
selectResults(resultSet)
-
Loops through the trace result elements to group them by network source id and selects them on the layer view.
ParameterresultSet NetworkElement[]An array of NetworkElements.
-
selectTraces(state, traceId)
-
Set the trace type to be run from the available trace configurations in the WebMap.
Parametersstate BooleanThis is
true
if the trace is selected.traceId StringThe globalid of the trace configuration.
-
selectTracesOnLoad()
-
Preset a trace type to be run from the available trace configurations in the WebMap when the widget loads.
-
zoomToAsset(geometry)
-
Zoom to a flag's feature or a result feature in the view.
Parametergeometry GoToTarget2D|GoToTarget3DThe geometry to zoom to.
Type Definitions
-
AssetGroupJSON Object
-
AssetGroupJSON represents the asset group. The asset group is the subtype field and represents the major classification of utility network classes.
- Properties
-
assetGroupCode Number
The asset group code.
assetGroupName StringThe asset group name.
assetTypes AssetTypeJSON[]The asset type.
-
AssetTypeJSON Object
-
AssetTypeJSON represents asset type. Attribute domains are assigned on the asset type field at the subtype level for each network class. It represents the minor classification of the utility network classes.
-
DisplayField Object
-
DisplayField represents the attribute field used as a display label for flags and selected features.
-
EdgeSourceJSON Object
-
EdgeSourceJSON represents the line layers that participate in the utility network service.
- Properties
-
layerId Number
The layer id of the line layer.
assetGroups AssetGroupJSON[]The asset group attribute values for the line layer.
sourceId NumberThe network source id of the line layer.
-
FeatureSetInfo Object
-
FeatureSetInfo represents the information for the results in the featureset.
- Properties
-
layer FeatureLayer
The FeatureLayer of the dataset.
featureSet FeatureSetThe FeatureSet.
-
FlagProperty Object
-
FlagProperty represents the properties to define each flag point (starting points and barriers).
- Properties
-
allTerminals TerminalConfiguration
The available terminals to define the permissible paths based on the terminal configurations. The default terminal is always set.
details anyAll the information returned by the hitTest.
displayField DisplayFieldThe display field of the flag.
id NumberThe id of the flag.
mapGraphic GraphicThe flag graphic.
mapPoint PointThe geometry point of the flag.
The terminals that are selected for the flag (this can be the default terminal or terminals selected by the end-user).
type StringThe flag type being set. Must be either
"starting point"
or"barrier"
.Possible Values
Value Description starting-point The flag set will be the starting location of the trace. barrier The flag set will mark the location to stop the trace.
-
GraphicColor Object
-
GraphicColor represents the color for the trace result graphic in the graphics layer.
-
JunctionSourceJSON Object
-
JunctionSourceJSON represents the point layers that participate in the utility network service.
- Properties
-
layerId Number
The layer id of the point layer.
assetGroups AssetGroupJSON[]The asset group attribute values for the point layer.
sourceId NumberThe network source id of the point layer.
-
TraceItem Object
-
TraceItem extends the named trace configuration and adds a property to manage the selection on the view.
- Property
-
selected Boolean
Returns
true
if there is a selection on the view for a trace.
-
TraceResultExtend Object
-
TraceResultExtend organizes the results based on the trace configuration and the trace results.
- Properties
-
TraceItem TraceItem
TraceItem extends the named trace configuration and adds a property to manage the selection on the view.
TraceResult TraceResultThe collection of results returned from the trace.
selectionEnabled BooleanReturns true if selection is enabled.
graphicEnabled BooleanReturns true if graphic is enabled.
graphicColor GraphicColorThe color for the graphic of the trace results in the graphics layer.
status StringThe current status of the trace to return errors from the server.