Skip to content

Commit 1c5fa6c

Browse files
authored
100.5.0 (#326)
* update api version * change api version to 100.5.0 * change version to 100.5.0 * start updates for java 11 * update java 11 parts * add dependencies for all platforms * Delete module-info.java * Update README Update README to alert Java 11 users to potential exceptions which may occur when running the project. Providing a suggested workaround from the OpenJavaFX docs. * Update README.md * add an integrated mesh layer sample * update arcgis version * use javafx plugin * remove jar task config * update arcgis version * move stage show * add point cloud data to sample data downloads * view point cloud data offline sample * Update build.gradle * change camera viewpoint * remove unused imports * update image * update api version * edit about the data and additional info sections * fix comment * Removed errant full stop * Open Mobile Scene Package (#318) * Gradle script includes path to download mspk file (further work required here) and implementation of sample in Java * Create README.md * Create OpenMobileScenePackage.png * Update typo in README * Updated gradle to point to correct data on AGOL * Update to sample code following review * Updates to ReadMe following review * Additional update to read me to include isDirectReadSupported.get * Updated from markdown to HTML * Remove id tags from HTML * Map reference scale (#319) * Create MapReferenceScaleSample.java * Set up MVC structure for sample * Set up basic map with MVC structure * Added label which updates scale of map as it changes * Set up means to change the map view to the selected reference scale * Set up check boxes for map layers * Update MapReferenceScaleController.java * Update MapReferenceScaleController.java * Allow string in combobox, split to return double to feed into map reference scale * Link checkbox with map layer to set reference scale * Method descriptions and remove unused imports * Fix indents * Create MapReferenceScale.png * Create README.md * Convert markdown to HTML * Addressed comments from review. ComboBox now double, vBoxes will load after map has loaded * Add a method to handle setting the reference scale when interacting with the combobox and the scale sync button. * Code updates following review removed unneeded label, added if loaded statement, and refactored map reference scale. Also updated Readme to account for behavior change. * move checkbox logic in with instanceof check * Update MapReferenceScaleController.java * Corrected title for sample * Merge master into dev (#322) * Camera controller US english update (#320) * Replace "aeroplane" with "plane" in README and code * Update image to show corrected spelling * Fix grammar * Updates to Tiled Layer to show support for .tkpx files (#321) * Updates to tiled layer, including .tpkx support * Update tile cache readme to include support .tpkx * Allow downloading of non zip sample data (#324) * Allow downloading of non zip sample data * point scene layer sample (#323) * point scene layer sample * Merge master into Dev (#329) * Camera controller US english update (#320) * Replace "aeroplane" with "plane" in README and code * Update image to show corrected spelling * Fix grammar * Updates to Tiled Layer to show support for .tkpx files (#321) * Updates to tiled layer, including .tpkx support * Update tile cache readme to include support .tpkx * Update slider to show values from 1-5 rather than 0-5 (#328) * remove online elevation data source (#327) * remove online elevation data source * remove unneeded ArcGISScene object * View content beneath terrain surface (#325) * Initiating sample with Scene URL * add done loading listener for changes * portal item entry for data * Add readme and image * Update ViewContentBeneathTerrainSurfaceSample.java * update build and refactor float code * Update ViewContentBeneathTerrainSurfaceSample.java * Add layer view state changed listener * Update ViewContentBeneathTerrainSurface.png * Address comments following review * update comment for add done loading listener on to scene * Update README.md * remove unused imports * group layers sample (#331) group layers sample * update version, delete extra copy of samples data * Play kml tours (#332) * play a kml tour sample * Generate offline map with local basemap (#330) * added dialog box for choosing which basemap to use * Update GenerateOfflineMapWithLocalBasemap.java * Update GenerateOfflineMapWithLocalBasemap.java * Update build.gradle * refactoring and neatening up the code * Update GenerateOfflineMapWithLocalBasemap.java * Ensure that the file exists before prompting user to find local file * Move standard code into private methods to draw attention to new API functionality * Add image and README * Update GenerateOfflineMapWithLocalBasemap.java * Update build.gradle * code restructuring (#333) * code restructuring * comment edits * Update image and readme * update description of generateOfflineMapDialog class * convert fields to local variables * convert readme from md to html * change api version to 100.5.0
1 parent c7a0b30 commit 1c5fa6c

38 files changed

+2074
-69
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ArcGIS Runtime Java SDK Samples
2-
### 100.4.0
2+
### 100.5.0
33
This project includes a set of samples demonstrating how to accomplish various mapping and GIS tasks with the ArcGIS Runtime SDK for Java.
44

55
Be sure to also check out our [toolkit on GitHub](https://github.com/Esri/arcgis-runtime-toolkit-java).
@@ -32,6 +32,12 @@ The plugin provides the project with everything an ArcGIS runtime project needs
3232
arcgis api as a dependency and downloads the native libraries into `$USER_HOME/.arcgis`. This download occurs
3333
automatically the first time you build the project and is only performed once.
3434

35+
## Java 11
36+
Java 11 users may find exceptions when running the project if their library path is still set for Oracle JDK 1.8 (see the [OpenJavaFX docs](https://openjfx.io/openjfx-docs/) for more information). A workaround for this is to add the following argument in the `run` task of the Gradle buildscript:
37+
```
38+
systemProperty "java.library.path", "C:\tmp"
39+
```
40+
3541
## Offline sample data
3642
Some samples require offline data. A `samples-data` directory will automatically download to the project root the
3743
first time you call the `run` task.

build.gradle

Lines changed: 83 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
1-
apply plugin: 'application'
2-
apply plugin: 'idea'
3-
apply plugin: 'eclipse'
4-
apply plugin: 'com.esri.arcgisruntime.java'
5-
61
buildscript {
72
repositories {
83
maven {
9-
url = 'https://esri.bintray.com/arcgis'
4+
url 'https://esri.bintray.com/arcgis'
105
}
116
}
127
dependencies {
138
classpath 'com.esri.arcgisruntime:gradle-arcgis-java-plugin:1.0.0'
149
}
1510
}
1611

17-
arcgis.version = '100.4.0'
12+
plugins {
13+
id 'application'
14+
id 'org.openjfx.javafxplugin' version '0.0.5'
15+
}
16+
17+
apply plugin: 'com.esri.arcgisruntime.java'
18+
19+
group = 'com.esri.samples'
1820

19-
idea.module.downloadJavadoc = true
20-
eclipse.classpath.downloadJavadoc = true
21+
arcgis.version = '100.5.0'
22+
23+
javafx {
24+
version = "11.0.1"
25+
modules = [ 'javafx.controls', 'javafx.web', 'javafx.fxml', 'javafx.swing' ]
26+
}
2127

2228
compileJava.options.encoding = 'UTF-8'
23-
compileJava.sourceCompatibility = '1.8'
29+
30+
repositories {
31+
jcenter()
32+
maven {
33+
url 'https://esri.bintray.com/arcgis'
34+
}
35+
}
2436

2537
dependencies {
2638
compile 'com.esri.arcgisruntime:arcgis-java-toolkit:100.2.1'
@@ -30,55 +42,44 @@ dependencies {
3042

3143
task downloadData {
3244
description = "Downloads data from AGOL for samples with offline data"
33-
45+
3446
def samplesData = './samples-data'
3547
if (!file(samplesData).exists()) {
3648
mkdir(samplesData)
3749
}
38-
39-
downloadSampleData(["9d2987a825c646468b3ce7512fb76e2d"], 'enc')
40-
41-
downloadSampleData(['cd61610c030446689991cc159d354e25',
42-
'98092369c4ae4d549bbbd45dba993ebc'], 'monterey_elevation')
43-
44-
downloadSampleData(['296269901180442a88a3351640ff2262'], 'bristol')
45-
46-
downloadSampleData(['3af5cfec0fd24dac8d88aea679027cb9'], 'dolmus_3ds')
47-
48-
downloadSampleData(['78847654fbe042e6af617ebbfbf985c7'], 'bradley_low_3ds')
49-
50-
downloadSampleData(['9ebd467801244ad79920be3c27f774da',
51-
'3b279365273043ae90f09cb0b112d40d'], 'mmpk')
52-
53-
downloadSampleData(['793a4620fbba443a931ac1fa52ad7f45',
54-
'1455c3dbfc43497983572117c7d6064c'], 'sanfrancisco')
55-
56-
downloadSampleData(['f3fd11e862694698bccec206bde3c934',
57-
'fef6001edc7a44f9932310d14682f1bc',
58-
'f31ea54e460e4439848557ab722baa0b'], 'shapefiles')
59-
60-
downloadSampleData(['80b43ba48f524a8eb0cb54f0f1ee9a5f',
61-
'00113a41bea0401290635f8503bb4acf',
62-
'df6f7fb0bf714e128cc3f919c126dd22'], 'raster')
63-
64-
downloadSampleData(['d98b3e5293834c5f852f13c569930caa',
65-
'68ec42517cdd439e81b036210483e8e7'], 'auroraCO')
66-
67-
downloadSampleData(['cdb15cd7cb624c2e9acb4af6c83d1fdd',
68-
'7a6c8309562149348d0e72b724c9eb4e'], 'kml')
69-
70-
downloadSampleData(['40e0d95e515745ee93b9d06cb75697bc',
71-
'b6f669b3b5b941fc8a3f7ac03efbd1a9',
72-
'9053a46b205142f0864682d5152642b5',
73-
'a9788a0e8ef241ec89182f87f6967ec9',
74-
'91087f8d3e6e46b7a0c5987eac379452',
75-
'5c10e6c0b8974d16b74d557568105b96'], 'local_server')
76-
77-
downloadSampleData(['cb1b20748a9f4d128dad8a87244e3e37'], 'los_angeles')
78-
79-
downloadSampleData(['567e14f3420d40c5a206e5c0284cf8fc'], 'san_diego')
80-
81-
downloadSampleData(['5491f01d92554751902ecad85cc5d6ca'], 'dictionary')
50+
downloadSampleData([new Download(id: "9d2987a825c646468b3ce7512fb76e2d")], 'enc')
51+
downloadSampleData([new Download(id: 'cd61610c030446689991cc159d354e25'),
52+
new Download(id: '98092369c4ae4d549bbbd45dba993ebc')], 'monterey_elevation')
53+
downloadSampleData([new Download(id: '296269901180442a88a3351640ff2262')], 'bristol')
54+
downloadSampleData([new Download(id: '3af5cfec0fd24dac8d88aea679027cb9')], 'dolmus_3ds')
55+
downloadSampleData([new Download(id: '78847654fbe042e6af617ebbfbf985c7')], 'bradley_low_3ds')
56+
downloadSampleData([new Download(id: '9ebd467801244ad79920be3c27f774da'),
57+
new Download(id: '3b279365273043ae90f09cb0b112d40d')], 'mmpk')
58+
downloadSampleData([new Download(id: '793a4620fbba443a931ac1fa52ad7f45'),
59+
new Download(id: '1455c3dbfc43497983572117c7d6064c')], 'sanfrancisco')
60+
downloadSampleData([new Download(id: 'f3fd11e862694698bccec206bde3c934'),
61+
new Download(id: 'fef6001edc7a44f9932310d14682f1bc'),
62+
new Download(id: 'f31ea54e460e4439848557ab722baa0b')], 'shapefiles')
63+
downloadSampleData([new Download(id: '80b43ba48f524a8eb0cb54f0f1ee9a5f'),
64+
new Download(id: '00113a41bea0401290635f8503bb4acf'),
65+
new Download(id: 'df6f7fb0bf714e128cc3f919c126dd22')], 'raster')
66+
downloadSampleData([new Download(id: 'd98b3e5293834c5f852f13c569930caa'),
67+
new Download(id: '68ec42517cdd439e81b036210483e8e7')], 'auroraCO')
68+
downloadSampleData([new Download(id: 'cdb15cd7cb624c2e9acb4af6c83d1fdd'),
69+
new Download(id: '7a6c8309562149348d0e72b724c9eb4e'),
70+
new Download(id: 'f10b1d37fdd645c9bc9b189fb546307c', name: 'Esri_tour', ext: 'kmz')], 'kml')
71+
downloadSampleData([new Download(id: '40e0d95e515745ee93b9d06cb75697bc'),
72+
new Download(id: 'b6f669b3b5b941fc8a3f7ac03efbd1a9'),
73+
new Download(id: '9053a46b205142f0864682d5152642b5'),
74+
new Download(id: 'a9788a0e8ef241ec89182f87f6967ec9'),
75+
new Download(id: '91087f8d3e6e46b7a0c5987eac379452'),
76+
new Download(id: '5c10e6c0b8974d16b74d557568105b96')], 'local_server')
77+
downloadSampleData([new Download(id: 'cb1b20748a9f4d128dad8a87244e3e37')], 'los_angeles')
78+
downloadSampleData([new Download(id: '567e14f3420d40c5a206e5c0284cf8fc')], 'san_diego')
79+
downloadSampleData([new Download(id: '5491f01d92554751902ecad85cc5d6ca')], 'dictionary')
80+
downloadSampleData([new Download(id: '943285c21a8e4e1582f0af1101f87bdf')], 'slpks')
81+
downloadSampleData([new Download(id: 'c0f7b0466b9c492dbab408620af6d28f')], 'mspk')
82+
downloadSampleData([new Download(id: '628e8e3521cf45e9a28a12fe10c02c4d', name: 'naperville_imagery', ext: 'tpk')], 'naperville')
8283
}
8384

8485
run {
@@ -89,18 +90,33 @@ task wrapper(type: Wrapper) {
8990
gradleVersion = '4.10.2'
9091
}
9192

92-
// downloads a list of portal item zips to a folder in samples-data
93-
void downloadSampleData(List<String> remotePaths, String copyPath) {
94-
def zipFile = './data.zip'
95-
if (!file('./samples-data/' + copyPath).exists()) {
96-
remotePaths.forEach { path ->
97-
ant.get(src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/${path}/data",
98-
dest: zipFile)
99-
copy {
100-
from zipTree(zipFile)
101-
into('./samples-data/' + copyPath)
93+
// downloads a portal item's contents to a folder in samples-data
94+
void downloadSampleData(List<Download> downloads, folderName) {
95+
def downloadFolder = "./samples-data/$folderName"
96+
if (!file(downloadFolder).exists()) {
97+
downloads.each { download ->
98+
def downloadFileName = "${download.name}.${download.ext}"
99+
ant.get(src: "https://arcgisruntime.maps.arcgis" +
100+
".com/sharing/rest/content/items/${download.id}/data",
101+
dest: downloadFileName)
102+
if (download.ext == "zip") {
103+
copy {
104+
from zipTree(downloadFileName)
105+
into(downloadFolder)
106+
}
107+
} else {
108+
copy {
109+
from downloadFileName
110+
into downloadFolder
111+
}
102112
}
103-
delete(zipFile)
113+
delete(downloadFileName)
104114
}
105115
}
106-
}
116+
}
117+
118+
class Download {
119+
String id
120+
String name = "data"
121+
String ext = "zip"
122+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
428 KB
Loading
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
* Copyright 2019 Esri.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.esri.samples.grouplayers.group_layers;
18+
19+
import java.util.Arrays;
20+
import java.util.List;
21+
22+
import javafx.application.Application;
23+
import javafx.geometry.Insets;
24+
import javafx.geometry.Pos;
25+
import javafx.scene.Scene;
26+
import javafx.scene.control.TreeItem;
27+
import javafx.scene.control.TreeView;
28+
import javafx.scene.layout.StackPane;
29+
import javafx.stage.Stage;
30+
31+
import com.esri.arcgisruntime.data.ServiceFeatureTable;
32+
import com.esri.arcgisruntime.layers.ArcGISSceneLayer;
33+
import com.esri.arcgisruntime.layers.FeatureLayer;
34+
import com.esri.arcgisruntime.layers.GroupLayer;
35+
import com.esri.arcgisruntime.layers.Layer;
36+
import com.esri.arcgisruntime.loadable.LoadStatus;
37+
import com.esri.arcgisruntime.mapping.ArcGISScene;
38+
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
39+
import com.esri.arcgisruntime.mapping.Basemap;
40+
import com.esri.arcgisruntime.mapping.Surface;
41+
import com.esri.arcgisruntime.mapping.view.Camera;
42+
import com.esri.arcgisruntime.mapping.view.SceneView;
43+
44+
public class GroupLayersSample extends Application {
45+
46+
private SceneView sceneView;
47+
48+
@Override
49+
public void start(Stage stage) {
50+
51+
try {
52+
53+
// set the title and size of the stage and show it
54+
StackPane stackPane = new StackPane();
55+
Scene fxScene = new Scene(stackPane);
56+
stage.setTitle("Group Layers Sample");
57+
stage.setWidth(800);
58+
stage.setHeight(700);
59+
60+
// create a JavaFX scene with a stackpane and set it to the stage
61+
stage.setScene(fxScene);
62+
stage.show();
63+
64+
// create a scene view and add it to the stack pane
65+
sceneView = new SceneView();
66+
stackPane.getChildren().add(sceneView);
67+
68+
// create a scene with a basemap and add it to the scene view
69+
ArcGISScene scene = new ArcGISScene();
70+
scene.setBasemap(Basemap.createImagery());
71+
sceneView.setArcGISScene(scene);
72+
73+
// set the base surface with world elevation
74+
Surface surface = new Surface();
75+
surface.getElevationSources().add(new ArcGISTiledElevationSource("http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"));
76+
scene.setBaseSurface(surface);
77+
78+
// create different types of layers
79+
ArcGISSceneLayer devOne = new ArcGISSceneLayer("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Trees/SceneServer/layers/0");
80+
ArcGISSceneLayer devTwo = new ArcGISSceneLayer("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_Pathways/SceneServer/layers/0");
81+
ArcGISSceneLayer devThree = new ArcGISSceneLayer("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/DevA_BuildingShell_Textured/SceneServer/layers/0");
82+
ArcGISSceneLayer nonDevOne = new ArcGISSceneLayer("https://scenesampleserverdev.arcgis.com/arcgis/rest/services/Hosted/PlannedDemo_BuildingShell/SceneServer/layers/0");
83+
FeatureLayer nonDevTwo = new FeatureLayer(new ServiceFeatureTable("https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/DevelopmentProjectArea/FeatureServer/0"));
84+
85+
// create a group layer from scratch by adding the layers as children
86+
GroupLayer groupLayer = new GroupLayer();
87+
groupLayer.setName("Group: Dev A");
88+
groupLayer.getLayers().addAll(Arrays.asList(devOne, devTwo, devThree));
89+
90+
// add the group layer and other layers to the scene as operational layers
91+
scene.getOperationalLayers().addAll(Arrays.asList(groupLayer, nonDevOne, nonDevTwo));
92+
93+
// zoom to the extent of the group layer when the child layers are loaded
94+
groupLayer.getLayers().forEach(childLayer ->
95+
childLayer.addDoneLoadingListener(() -> {
96+
if (childLayer.getLoadStatus() == LoadStatus.LOADED) {
97+
sceneView.setViewpointCamera(new Camera(groupLayer.getFullExtent().getCenter(), 700, 0, 60, 0));
98+
}
99+
})
100+
);
101+
102+
// create a JavaFX tree view to show the layers in the scene
103+
TreeView<Layer> layerTreeView = new TreeView<>();
104+
layerTreeView.setMaxSize(250, 200);
105+
TreeItem<Layer> rootTreeItem = new TreeItem<>();
106+
layerTreeView.setRoot(rootTreeItem);
107+
layerTreeView.setShowRoot(false);
108+
StackPane.setAlignment(layerTreeView, Pos.TOP_RIGHT);
109+
StackPane.setMargin(layerTreeView, new Insets(10));
110+
stackPane.getChildren().add(layerTreeView);
111+
112+
// display each layer with a custom tree cell
113+
layerTreeView.setCellFactory(p -> new LayerTreeCell());
114+
115+
// recursively build the table of contents from the scene's operational layers
116+
buildLayersView(rootTreeItem, scene.getOperationalLayers());
117+
118+
} catch (Exception e) {
119+
// on any error, display the stack trace.
120+
e.printStackTrace();
121+
}
122+
}
123+
124+
/**
125+
* Recursively builds a tree from a parent tree item using a list of operational layers (including group layers).
126+
*
127+
* @param parentItem tree item to build tree from
128+
* @param operationalLayers a list of operational layers
129+
*/
130+
private void buildLayersView(TreeItem<Layer> parentItem, List<Layer> operationalLayers) {
131+
for (Layer layer : operationalLayers) {
132+
// load each layer before adding to ensure all metadata is ready for display
133+
layer.loadAsync();
134+
layer.addDoneLoadingListener(() -> {
135+
// add a tree item for the layer to the parent tree item
136+
if (layer.canShowInLegend()) {
137+
TreeItem<Layer> layerItem = new TreeItem<>(layer);
138+
layerItem.setExpanded(true);
139+
parentItem.getChildren().add(layerItem);
140+
// if the layer is a group layer, continue building with its children
141+
if (layer instanceof GroupLayer && ((GroupLayer) layer).isShowChildrenInLegend()) {
142+
buildLayersView(layerItem, ((GroupLayer) layer).getLayers());
143+
}
144+
}
145+
});
146+
}
147+
}
148+
149+
/**
150+
* Stops and releases all resources used in application.
151+
*/
152+
@Override
153+
public void stop() {
154+
155+
if (sceneView != null) {
156+
sceneView.dispose();
157+
}
158+
}
159+
160+
/**
161+
* Opens and runs application.
162+
*
163+
* @param args arguments passed to this application
164+
*/
165+
public static void main(String[] args) {
166+
167+
Application.launch(args);
168+
}
169+
170+
}

0 commit comments

Comments
 (0)