Perform valve isolation trace

View inQMLC++
View on GitHub
Sample viewer app

Run a filtered trace to locate operable features that will isolate an area from the flow of network resources.

screenshot

Use case

Determine the set of operable features required to stop a network's resource, effectively isolating an area of the network. For example, you can choose to return only accessible and operable valves: ones that are not paved over or rusted shut.

How to use the sample

Select one or more features to use as filter barriers or create and set the configuration's filter barriers by selecting a category. Check or uncheck 'Include isolated features'. Press 'Trace' to run a subnetwork-based isolation trace. Press 'Reset' to clear filter barriers.

How it works

  1. Create a MapView and connect to its mouseClicked signal.
  2. Create and load a ServiceGeodatabase with a feature service URL and get tables by their layer IDs.
  3. Create a Map that contains FeatureLayer(s) created from the ServiceGeodatabase's tables.
  4. Create and load a UtilityNetwork with the same feature service URL as the Map.
  5. Create UtilityTraceParameters with UtilityTraceType::Isolation and a starting location from a given asset type and global ID.
  6. Get a default UtilityTraceConfiguration from a given tier in a domain network to set UtilityTraceParameters::traceConfiguration property.
  7. Add a GraphicsOverlay with a Graphic that represents this starting location, and another graphics overlay for the filter barriers.
  8. Populate the choice list for the 'Filter barrier: category exists' from UtilityNetworkDefinition::categories.
  9. When the map view is clicked, identify which features are at that location and add a graphic that represents a filter barrier.
  10. Create a UtilityElement for the identified feature and add this utility element to a list of filter barriers.
  11. If the element is a junction with more than one terminal, display a terminal picker. Then set the junction's terminal property with the selected terminal.
  12. If an edge, set its fractionAlongEdge property using GeometryEngine::fractionAlong.
  13. If 'Trace' is clicked without filter barriers:
  14. Create a new UtilityCategoryComparison with the selected category and UtilityCategoryComparisonOperator::Exists.
  15. Create a new UtilityTraceFilter with this condition as Barriers to set Filter and update IncludeIsolatedFeatures properties of the default configuration from step 5.
  16. Run UtilityNetwork::trace. If Trace is clicked with filter barriers:
  17. Update IncludeIsolatedFeatures property of the default configuration from step 5.
  18. Run UtilityNetwork::trace.
  19. For every FeatureLayer in the map, select the features returned by featuresForElements from the elements matching their NetworkSource::name with the layer's FeatureTable::name.

Relevant API

  • GeometryEngine::fractionAlong
  • ServiceGeodatabase
  • UtilityCategory
  • UtilityCategoryComparison
  • UtilityCategoryComparisonOperator
  • UtilityDomainNetwork
  • UtilityElement
  • UtilityElementTraceResult
  • UtilityNetwork
  • UtilityNetworkDefinition
  • UtilityTerminal
  • UtilityTier
  • UtilityTraceFilter
  • UtilityTraceParameters
  • UtilityTraceResult
  • UtilityTraceType

About the data

The Naperville gas network feature service, hosted on ArcGIS Online, contains a utility network used to run the isolation trace shown in this sample.

Additional information

Using utility network on ArcGIS Enterprise 10.8 requires an ArcGIS Enterprise member account licensed with the Utility Network user type extension. Please refer to the utility network services documentation.

Credentials:

  • Username: viewer01
  • Password: I68VGU^nMurF

Tags

category comparison, condition barriers, filter barriers, isolated features, network analysis, subnetwork trace, trace configuration, trace filter, utility network

Sample Code

PerformValveIsolationTrace.qmlPerformValveIsolationTrace.cppPerformValveIsolationTrace.hTerminalPickerView.qml
                                                                                                                                       
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// [WriteFile Name=PerformValveIsolationTrace, Category=UtilityNetwork]
// [Legal]
// Copyright 2020 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.Samples 1.0
import QtQuick.Layouts 1.11
import QtQuick.Dialogs 1.1

Item {
    // add a mapView component
    MapView {
        id: view
        anchors.fill: parent
    }

    ColumnLayout {
        anchors {
            left: parent.left
            top: parent.top
        }

        Rectangle {
            id: backgroundRect
            color: "#FBFBFB"
            height: childrenRect.height
            width: row.width * 1.25

            RowLayout {
                id: titleRow
                anchors {
                    left: row.left
                    top: parent.top
                }
                Rectangle {
                    color: backgroundRect.color
                    width: childrenRect.width
                    height: childrenRect.height
                    Text {
                        text: "Choose category for filter barrier:"
                        font.pixelSize: 14
                    }
                }
            }

            RowLayout {
                id: row
                anchors {
                    horizontalCenter: parent.horizontalCenter
                    top: titleRow.bottom
                }
                ComboBox {
                    id: comboBox
                    enabled: !sampleModel.tasksRunning
                    Layout.minimumWidth: 200
                    model: sampleModel.categoriesList
                    onCurrentIndexChanged: {
                        sampleModel.selectedIndex = currentIndex;
                    }
                }
                Button {
                    text: "Trace"
                    onClicked: {
                        sampleModel.performTrace();
                    }
                    enabled: !sampleModel.tasksRunning
                }
                Button {
                    text: "Reset"
                    onClicked: {
                        sampleModel.performReset();
                    }
                    enabled: !sampleModel.tasksRunning
                }
            }

            RowLayout {
                id: checkBoxRow
                anchors {
                    top: row.bottom
                    left: row.left
                }

                CheckBox {
                    text: "Include isolated features"
                    enabled: !sampleModel.tasksRunning
                    leftPadding: 0
                    onCheckedChanged: {
                        sampleModel.isolateFeatures = checked;
                    }
                }
            }
        }
    }

    TerminalPickerView {
        id: terminalPickerView
        visible: sampleModel.terminals.length > 0
    }

    BusyIndicator {
        id: busyIndicator
        anchors.centerIn: parent
        running: sampleModel.tasksRunning
    }

    MessageDialog {
        id: messageDialog
        title: "Perform valve isolation trace"
        text: "Isolation trace returned no elements."
        visible: sampleModel.noResults
        onRejected: {
            visible = false;
        }
    }

    // Declare the C++ instance which creates the scene etc. and supply the view
    PerformValveIsolationTraceSample {
        id: sampleModel
        mapView: view
    }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.