Skip to content

Commit aac0960

Browse files
authored
New Basemaps: Utility Network Category (#610)
* Display Utility Associations * Perform valve isolation trace * Trace a utility network * Trace a utility network - update README * update build.gradle - versions * tidy up comment conistencies * trace a utility network - README amend
1 parent 252b942 commit aac0960

File tree

7 files changed

+29
-14
lines changed

7 files changed

+29
-14
lines changed

utility_network/display-utility-associations/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

utility_network/display-utility-associations/src/main/java/com/esri/samples/display_utility_associations/DisplayUtilityAssociationsSample.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
import javafx.scene.paint.Paint;
3434
import javafx.stage.Stage;
3535

36+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3637
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3738
import com.esri.arcgisruntime.geometry.Envelope;
3839
import com.esri.arcgisruntime.layers.FeatureLayer;
3940
import com.esri.arcgisruntime.mapping.ArcGISMap;
40-
import com.esri.arcgisruntime.mapping.Basemap;
41+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4142
import com.esri.arcgisruntime.mapping.Viewpoint;
4243
import com.esri.arcgisruntime.mapping.view.Graphic;
4344
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -69,9 +70,13 @@ public void start(Stage stage) {
6970
stage.setHeight(700);
7071
stage.setScene(scene);
7172
stage.show();
73+
74+
// authentication with an API key or named user is required to access basemaps and other location services
75+
String yourAPIKey = System.getProperty("apiKey");
76+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
7277

73-
// create a map with the topographic vector basemap
74-
ArcGISMap map = new ArcGISMap(Basemap.createTopographicVector());
78+
// create a map with the topographic basemap style
79+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_TOPOGRAPHIC);
7580

7681
// create a viewpoint to focus on the utility networks' extent
7782
Viewpoint viewPoint = new Viewpoint(41.8057655, -88.1489692, 23);

utility_network/perform-valve-isolation-trace/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

utility_network/perform-valve-isolation-trace/src/main/java/com/esri/samples/perform_valve_isolation_trace/PerformValveIsolationTraceController.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.UUID;
3131
import java.util.concurrent.ExecutionException;
3232

33+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3334
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3435
import com.esri.arcgisruntime.data.ArcGISFeature;
3536
import com.esri.arcgisruntime.data.FeatureQueryResult;
@@ -40,7 +41,7 @@
4041
import com.esri.arcgisruntime.layers.FeatureLayer;
4142
import com.esri.arcgisruntime.loadable.LoadStatus;
4243
import com.esri.arcgisruntime.mapping.ArcGISMap;
43-
import com.esri.arcgisruntime.mapping.Basemap;
44+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4445
import com.esri.arcgisruntime.mapping.Viewpoint;
4546
import com.esri.arcgisruntime.mapping.view.Graphic;
4647
import com.esri.arcgisruntime.mapping.view.GraphicsOverlay;
@@ -82,8 +83,12 @@ public class PerformValveIsolationTraceController {
8283
public void initialize() {
8384
try {
8485

85-
// create a basemap and set it to the map view
86-
ArcGISMap map = new ArcGISMap(Basemap.createStreetsNightVector());
86+
// authentication with an API key or named user is required to access basemaps and other location services
87+
String yourAPIKey = System.getProperty("apiKey");
88+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
89+
90+
// create a map with the streets night basemap style and set it to the map view
91+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS_NIGHT);
8792
mapView.setMap(map);
8893

8994
// load the utility network data from the feature service and create feature layers

utility_network/trace-a-utility-network/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Click on one or more features while 'Add starting locations' or 'Add barriers' i
1414

1515
## How it works
1616

17-
1. Create a `Map` and add it to a `MapView`.
17+
1. Create an `ArcGISMap` and set it on a `MapView`.
1818
2. Using the URL to a utility network's feature service, create `FeatureLayer`s that contain the utility network's features, and add them to the operational layers of the map.
1919
3. Create and load a `UtilityNetwork` with the same feature service URL and map.
2020
4. Add a `GraphicsOverlay` with symbology that distinguishes starting points from barriers.

utility_network/trace-a-utility-network/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
group = 'com.esri.samples'
77

88
ext {
9-
arcgisVersion = '100.9.0'
9+
arcgisVersion = '100.10.0-2992'
1010
}
1111

1212
javafx {

utility_network/trace-a-utility-network/src/main/java/com/esri/samples/trace_a_utility_network/TraceAUtilityNetworkController.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
import javafx.scene.layout.GridPane;
3838
import javafx.scene.paint.Color;
3939

40+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
4041
import com.esri.arcgisruntime.concurrent.ListenableFuture;
4142
import com.esri.arcgisruntime.data.ArcGISFeature;
4243
import com.esri.arcgisruntime.data.FeatureQueryResult;
4344
import com.esri.arcgisruntime.data.QueryParameters;
4445
import com.esri.arcgisruntime.data.ServiceFeatureTable;
4546
import com.esri.arcgisruntime.geometry.Envelope;
4647
import com.esri.arcgisruntime.geometry.GeometryEngine;
47-
import com.esri.arcgisruntime.geometry.GeometryType;
4848
import com.esri.arcgisruntime.geometry.Point;
4949
import com.esri.arcgisruntime.geometry.Polyline;
5050
import com.esri.arcgisruntime.geometry.ProximityResult;
@@ -53,7 +53,7 @@
5353
import com.esri.arcgisruntime.layers.LayerContent;
5454
import com.esri.arcgisruntime.loadable.LoadStatus;
5555
import com.esri.arcgisruntime.mapping.ArcGISMap;
56-
import com.esri.arcgisruntime.mapping.Basemap;
56+
import com.esri.arcgisruntime.mapping.BasemapStyle;
5757
import com.esri.arcgisruntime.mapping.GeoElement;
5858
import com.esri.arcgisruntime.mapping.Viewpoint;
5959
import com.esri.arcgisruntime.mapping.view.Graphic;
@@ -104,9 +104,14 @@ public class TraceAUtilityNetworkController {
104104

105105
public void initialize() {
106106
try {
107-
// create a basemap and set it to the map view
108-
ArcGISMap map = new ArcGISMap(Basemap.createStreetsNightVector());
107+
// authentication with an API key or named user is required to access basemaps and other location services
108+
String yourAPIKey = System.getProperty("apiKey");
109+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
110+
111+
// create a map with the streets night basemap style and set it to the map view
112+
ArcGISMap map = new ArcGISMap(BasemapStyle.ARCGIS_STREETS_NIGHT);
109113
mapView.setMap(map);
114+
110115
// set the viewpoint to a subsection of the utility network
111116
mapView.setViewpointAsync(new Viewpoint(
112117
new Envelope(-9813547.35557238, 5129980.36635111, -9813185.0602376, 5130215.41254146,

0 commit comments

Comments
 (0)