Skip to content

Commit 731db36

Browse files
author
Rachael Ellen
committed
Merge branch 'v.next' into 100.14.0
2 parents 28f3887 + 1bcd023 commit 731db36

File tree

140 files changed

+2338
-713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2338
-713
lines changed

analysis/distance-measurement-analysis/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ dependencies {
3838
runtimeOnly 'org.slf4j:slf4j-nop:1.7.32'
3939
}
4040

41+
task createGradlePropertiesAndWriteApiKey {
42+
description = "Creates a new gradle.properties file with an empty API key variable in the user home ./gradle folder, if the file doesn't already exist."
43+
group = "build"
44+
def propertiesFile = new File("${System.properties.getProperty("user.home")}/.gradle/gradle.properties")
45+
if (!propertiesFile.exists()) {
46+
print("Go to " + new URL("https://developers.arcgis.com/dashboard") + " to get an API key.")
47+
print(" Add your API key to ${System.properties.getProperty("user.home")}\\.gradle\\gradle.properties.")
48+
propertiesFile.write("apiKey = ")
49+
}
50+
}
51+
4152
task copyNatives(type: Copy) {
4253
description = "Copies the arcgis native libraries into the project build directory for development."
4354
group = "build"
@@ -49,6 +60,10 @@ task copyNatives(type: Copy) {
4960
}
5061

5162
run {
63+
doFirst {
64+
// sets the API key from the gradle.properties file as a Java system property
65+
systemProperty 'apiKey', apiKey
66+
}
5267
dependsOn copyNatives
5368
mainClassName = 'com.esri.samples.distance_measurement_analysis.DistanceMeasurementAnalysisLauncher'
5469
}

analysis/distance-measurement-analysis/src/main/java/com/esri/samples/distance_measurement_analysis/DistanceMeasurementAnalysisController.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,24 @@
2222
import javafx.event.EventHandler;
2323
import javafx.fxml.FXML;
2424
import javafx.geometry.Point2D;
25+
import javafx.scene.control.Alert;
2526
import javafx.scene.control.ComboBox;
2627
import javafx.scene.control.Label;
2728
import javafx.scene.input.MouseButton;
2829
import javafx.scene.input.MouseEvent;
2930

31+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3032
import com.esri.arcgisruntime.UnitSystem;
3133
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3234
import com.esri.arcgisruntime.geoanalysis.LocationDistanceMeasurement;
3335
import com.esri.arcgisruntime.geometry.Distance;
3436
import com.esri.arcgisruntime.geometry.Point;
3537
import com.esri.arcgisruntime.geometry.SpatialReferences;
3638
import com.esri.arcgisruntime.layers.ArcGISSceneLayer;
39+
import com.esri.arcgisruntime.loadable.LoadStatus;
3740
import com.esri.arcgisruntime.mapping.ArcGISScene;
3841
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
39-
import com.esri.arcgisruntime.mapping.Basemap;
42+
import com.esri.arcgisruntime.mapping.BasemapStyle;
4043
import com.esri.arcgisruntime.mapping.Surface;
4144
import com.esri.arcgisruntime.mapping.view.AnalysisOverlay;
4245
import com.esri.arcgisruntime.mapping.view.Camera;
@@ -54,9 +57,12 @@ public class DistanceMeasurementAnalysisController {
5457

5558
public void initialize() {
5659

57-
// create a scene and set it to the scene view
58-
ArcGISScene scene = new ArcGISScene();
59-
scene.setBasemap(Basemap.createTopographic());
60+
// authentication with an API key or named user is required to access basemaps and other location services
61+
String yourAPIKey = System.getProperty("apiKey");
62+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
63+
64+
// create a scene with a basemap style and set it to the scene view
65+
ArcGISScene scene = new ArcGISScene(BasemapStyle.ARCGIS_TOPOGRAPHIC);
6066
sceneView.setArcGISScene(scene);
6167

6268
// add base surface for elevation data
@@ -80,7 +86,13 @@ public void initialize() {
8086
analysisOverlay.getAnalyses().add(distanceMeasurement);
8187

8288
// zoom to the initial measurement
83-
sceneView.setViewpointCamera(new Camera(start, 200.0, 0.0, 45.0, 0.0));
89+
scene.addDoneLoadingListener(() -> {
90+
if (scene.getLoadStatus() == LoadStatus.LOADED) {
91+
sceneView.setViewpointCamera(new Camera(start, 200.0, 0.0, 45.0, 0.0));
92+
} else {
93+
new Alert(Alert.AlertType.ERROR, "Scene failed to load").show();
94+
}
95+
});
8496

8597
// show the distances in the UI when the measurement changes
8698
DecimalFormat decimalFormat = new DecimalFormat("#.##");

analysis/line-of-sight-geoelement/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ dependencies {
3838
runtimeOnly 'org.slf4j:slf4j-nop:1.7.32'
3939
}
4040

41+
task createGradlePropertiesAndWriteApiKey {
42+
description = "Creates a new gradle.properties file with an empty API key variable in the user home ./gradle folder, if the file doesn't already exist."
43+
group = "build"
44+
def propertiesFile = new File("${System.properties.getProperty("user.home")}/.gradle/gradle.properties")
45+
if (!propertiesFile.exists()) {
46+
print("Go to " + new URL("https://developers.arcgis.com/dashboard") + " to get an API key.")
47+
print(" Add your API key to ${System.properties.getProperty("user.home")}\\.gradle\\gradle.properties.")
48+
propertiesFile.write("apiKey = ")
49+
}
50+
}
51+
4152
task copyNatives(type: Copy) {
4253
description = "Copies the arcgis native libraries into the project build directory for development."
4354
group = "build"
@@ -49,6 +60,10 @@ task copyNatives(type: Copy) {
4960
}
5061

5162
run {
63+
doFirst {
64+
// sets the API key from the gradle.properties file as a Java system property
65+
systemProperty 'apiKey', apiKey
66+
}
5267
dependsOn copyNatives
5368
mainClassName = 'com.esri.samples.line_of_sight_geoelement.LineOfSightGeoElementLauncher'
5469
}

analysis/line-of-sight-geoelement/src/main/java/com/esri/samples/line_of_sight_geoelement/LineOfSightGeoElementSample.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import javafx.stage.Stage;
3838
import javafx.util.Duration;
3939

40+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
4041
import com.esri.arcgisruntime.geoanalysis.GeoElementLineOfSight;
4142
import com.esri.arcgisruntime.geoanalysis.LineOfSight;
4243
import com.esri.arcgisruntime.geometry.AngularUnit;
@@ -52,7 +53,7 @@
5253
import com.esri.arcgisruntime.layers.ArcGISSceneLayer;
5354
import com.esri.arcgisruntime.mapping.ArcGISScene;
5455
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
55-
import com.esri.arcgisruntime.mapping.Basemap;
56+
import com.esri.arcgisruntime.mapping.BasemapStyle;
5657
import com.esri.arcgisruntime.mapping.Surface;
5758
import com.esri.arcgisruntime.mapping.view.AnalysisOverlay;
5859
import com.esri.arcgisruntime.mapping.view.Camera;
@@ -94,9 +95,12 @@ public void start(Stage stage) {
9495
stage.setScene(fxScene);
9596
stage.show();
9697

97-
// create a scene and add a basemap to it
98-
ArcGISScene scene = new ArcGISScene();
99-
scene.setBasemap(Basemap.createTopographic());
98+
// authentication with an API key or named user is required to access basemaps and other location services
99+
String yourAPIKey = System.getProperty("apiKey");
100+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
101+
102+
// create a scene with a basemap style
103+
ArcGISScene scene = new ArcGISScene(BasemapStyle.ARCGIS_TOPOGRAPHIC);
100104

101105
// add the SceneView to the stack pane
102106
sceneView = new SceneView();
540 KB
Loading
-1.97 MB
Loading

analysis/line-of-sight-location/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ dependencies {
3838
runtimeOnly 'org.slf4j:slf4j-nop:1.7.32'
3939
}
4040

41+
task createGradlePropertiesAndWriteApiKey {
42+
description = "Creates a new gradle.properties file with an empty API key variable in the user home ./gradle folder, if the file doesn't already exist."
43+
group = "build"
44+
def propertiesFile = new File("${System.properties.getProperty("user.home")}/.gradle/gradle.properties")
45+
if (!propertiesFile.exists()) {
46+
print("Go to " + new URL("https://developers.arcgis.com/dashboard") + " to get an API key.")
47+
print(" Add your API key to ${System.properties.getProperty("user.home")}\\.gradle\\gradle.properties.")
48+
propertiesFile.write("apiKey = ")
49+
}
50+
}
51+
4152
task copyNatives(type: Copy) {
4253
description = "Copies the arcgis native libraries into the project build directory for development."
4354
group = "build"
@@ -49,6 +60,10 @@ task copyNatives(type: Copy) {
4960
}
5061

5162
run {
63+
doFirst {
64+
// sets the API key from the gradle.properties file as a Java system property
65+
systemProperty 'apiKey', apiKey
66+
}
5267
dependsOn copyNatives
5368
mainClassName = 'com.esri.samples.line_of_sight_location.LineOfSightLocationLauncher'
5469
}

analysis/line-of-sight-location/src/main/java/com/esri/samples/line_of_sight_location/LineOfSightLocationSample.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@
2727
import javafx.scene.layout.StackPane;
2828
import javafx.stage.Stage;
2929

30+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
3031
import com.esri.arcgisruntime.concurrent.ListenableFuture;
3132
import com.esri.arcgisruntime.geoanalysis.LocationLineOfSight;
3233
import com.esri.arcgisruntime.geometry.Point;
3334
import com.esri.arcgisruntime.geometry.SpatialReferences;
3435
import com.esri.arcgisruntime.mapping.ArcGISScene;
3536
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
36-
import com.esri.arcgisruntime.mapping.Basemap;
37+
import com.esri.arcgisruntime.mapping.BasemapStyle;
3738
import com.esri.arcgisruntime.mapping.Surface;
3839
import com.esri.arcgisruntime.mapping.view.AnalysisOverlay;
3940
import com.esri.arcgisruntime.mapping.view.Camera;
@@ -59,9 +60,12 @@ public void start(Stage stage) {
5960
stage.setScene(fxScene);
6061
stage.show();
6162

62-
// create a scene and add a basemap to it
63-
ArcGISScene scene = new ArcGISScene();
64-
scene.setBasemap(Basemap.createTopographic());
63+
// authentication with an API key or named user is required to access basemaps and other location services
64+
String yourAPIKey = System.getProperty("apiKey");
65+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
66+
67+
// create a scene with a basemap style
68+
ArcGISScene scene = new ArcGISScene(BasemapStyle.ARCGIS_TOPOGRAPHIC);
6569

6670
// add the SceneView to the stack pane
6771
sceneView = new SceneView();

analysis/viewshed-camera/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ dependencies {
3838
runtimeOnly 'org.slf4j:slf4j-nop:1.7.32'
3939
}
4040

41+
task createGradlePropertiesAndWriteApiKey {
42+
description = "Creates a new gradle.properties file with an empty API key variable in the user home ./gradle folder, if the file doesn't already exist."
43+
group = "build"
44+
def propertiesFile = new File("${System.properties.getProperty("user.home")}/.gradle/gradle.properties")
45+
if (!propertiesFile.exists()) {
46+
print("Go to " + new URL("https://developers.arcgis.com/dashboard") + " to get an API key.")
47+
print(" Add your API key to ${System.properties.getProperty("user.home")}\\.gradle\\gradle.properties.")
48+
propertiesFile.write("apiKey = ")
49+
}
50+
}
51+
4152
task copyNatives(type: Copy) {
4253
description = "Copies the arcgis native libraries into the project build directory for development."
4354
group = "build"
@@ -49,6 +60,10 @@ task copyNatives(type: Copy) {
4960
}
5061

5162
run {
63+
doFirst {
64+
// sets the API key from the gradle.properties file as a Java system property
65+
systemProperty 'apiKey', apiKey
66+
}
5267
dependsOn copyNatives
5368
mainClassName = 'com.esri.samples.viewshed_camera.ViewshedCameraLauncher'
5469
}

analysis/viewshed-camera/src/main/java/com/esri/samples/viewshed_camera/ViewshedCameraSample.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
import javafx.scene.layout.StackPane;
2525
import javafx.stage.Stage;
2626

27+
import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
2728
import com.esri.arcgisruntime.geoanalysis.LocationViewshed;
2829
import com.esri.arcgisruntime.layers.IntegratedMeshLayer;
2930
import com.esri.arcgisruntime.mapping.ArcGISScene;
3031
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
31-
import com.esri.arcgisruntime.mapping.Basemap;
32+
import com.esri.arcgisruntime.mapping.BasemapStyle;
3233
import com.esri.arcgisruntime.mapping.Surface;
3334
import com.esri.arcgisruntime.mapping.view.AnalysisOverlay;
3435
import com.esri.arcgisruntime.mapping.view.Camera;
@@ -54,9 +55,12 @@ public void start(Stage stage) {
5455
stage.setScene(fxScene);
5556
stage.show();
5657

57-
// create a scene and add a basemap to it
58-
ArcGISScene scene = new ArcGISScene();
59-
scene.setBasemap(Basemap.createImagery());
58+
// authentication with an API key or named user is required to access basemaps and other location services
59+
String yourAPIKey = System.getProperty("apiKey");
60+
ArcGISRuntimeEnvironment.setApiKey(yourAPIKey);
61+
62+
// create a scene with a basemap style
63+
ArcGISScene scene = new ArcGISScene(BasemapStyle.ARCGIS_IMAGERY);
6064

6165
// add the SceneView to the stack pane
6266
sceneView = new SceneView();

0 commit comments

Comments
 (0)