Skip to content

Commit 5f13686

Browse files
authored
Merge pull request #280 from Esri/100.4.0
100.4.0
2 parents dd2ffab + 9a26e83 commit 5f13686

File tree

20 files changed

+730
-16
lines changed

20 files changed

+730
-16
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
}
1515
}
1616

17-
arcgis.version = '100.3.0'
17+
arcgis.version = '100.4.0'
1818

1919
idea.module.downloadJavadoc = true
2020
eclipse.classpath.downloadJavadoc = true

src/main/java/com/esri/samples/editing/edit_feature_attachments/EditFeatureAttachmentsSample.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ public void start(Stage stage) {
130130
// create a feature layer from service feature table
131131
featureLayer = new FeatureLayer(featureTable);
132132

133-
// selection options
134-
featureLayer.setSelectionColor(0xff0000ff);
135-
featureLayer.setSelectionWidth(10);
136-
137133
// add the feature layer to the ArcGISMap
138134
map.getOperationalLayers().add(featureLayer);
139135

@@ -143,6 +139,9 @@ public void start(Stage stage) {
143139
// set ArcGISMap to be displayed in the view
144140
mapView.setMap(map);
145141

142+
// set selection color
143+
mapView.getSelectionProperties().setColor(0xff0000ff);
144+
146145
mapView.setOnMouseClicked(event -> {
147146
if (event.isStillSincePress() && event.getButton() == MouseButton.PRIMARY) {
148147
// create a map point from a point

src/main/java/com/esri/samples/featurelayers/feature_layer_selection/FeatureLayerSelectionSample.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ public void start(Stage stage) {
7474
String damageAssessmentFeatureService = "https://services1.arcgis.com/4yjifSiIG17X0gW4/arcgis/rest/services/GDP_per_capita_1960_2016/FeatureServer/0";
7575
final ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(damageAssessmentFeatureService);
7676

77-
// create the feature layer and set its selection color
77+
// create the feature layer
7878
final FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
79-
featureLayer.setSelectionColor(0xFF00FFFF); // cyan color
80-
featureLayer.setSelectionWidth(3);
8179

8280
// add the layer to the ArcGISMap
8381
map.getOperationalLayers().add(featureLayer);

src/main/java/com/esri/samples/featurelayers/generate_geodatabase/GenerateGeodatabaseSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void start(Stage stage) {
124124
tempFile.deleteOnExit();
125125

126126
// create and start the job
127-
GenerateGeodatabaseJob job = syncTask.generateGeodatabaseAsync(parameters, tempFile.getAbsolutePath());
127+
GenerateGeodatabaseJob job = syncTask.generateGeodatabase(parameters, tempFile.getAbsolutePath());
128128
job.start();
129129

130130
// show progress

src/main/java/com/esri/samples/featurelayers/list_releated_features/ListRelatedFeaturesSample.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public void start(Stage stage) {
8282
mapView = new MapView();
8383
mapView.setMap(map);
8484

85+
// make selection outline yellow (0xFFFFFF00)
86+
mapView.getSelectionProperties().setColor(0xFFFFFF00);
87+
8588
// hide the progress indicator when the layer is done drawing
8689
mapView.addDrawStatusChangedListener(drawStatusChangedEvent -> {
8790
if (drawStatusChangedEvent.getDrawStatus() == DrawStatus.COMPLETED) {
@@ -94,10 +97,6 @@ public void start(Stage stage) {
9497
// get the first feature layer for querying
9598
FeatureLayer featureLayer = (FeatureLayer) map.getOperationalLayers().get(0);
9699

97-
// make selection outline yellow (0xFFFFFF00) and thick
98-
featureLayer.setSelectionColor(0xFFFFFF00);
99-
featureLayer.setSelectionWidth(5);
100-
101100
mapView.setOnMouseClicked(event -> {
102101
// check for primary or secondary mouse click
103102
if (event.isStillSincePress() && event.getButton() == MouseButton.PRIMARY) {

src/main/java/com/esri/samples/geometry/spatial_relationships/SpatialRelationshipsSample.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ public void start(Stage stage) {
8282
// create a graphics overlay
8383
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
8484
mapView.getGraphicsOverlays().add(graphicsOverlay);
85-
graphicsOverlay.setSelectionColor(0xFFFFFF00);
85+
86+
// make selection outline yellow (0xFFFFFF00)
87+
mapView.getSelectionProperties().setColor(0xFFFFFF00);
8688

8789
// create a polygon graphic
8890
PointCollection polygonPoints = new PointCollection(SpatialReferences.getWebMercator());
93.6 KB
Loading
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/*
2+
* Copyright 2018 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.kml.display_kml;
18+
19+
import java.io.File;
20+
21+
import javafx.application.Application;
22+
import javafx.geometry.Insets;
23+
import javafx.geometry.Pos;
24+
import javafx.scene.Scene;
25+
import javafx.scene.control.Alert;
26+
import javafx.scene.control.ComboBox;
27+
import javafx.scene.layout.StackPane;
28+
import javafx.stage.Stage;
29+
30+
import com.esri.arcgisruntime.geometry.Envelope;
31+
import com.esri.arcgisruntime.geometry.SpatialReferences;
32+
import com.esri.arcgisruntime.layers.KmlLayer;
33+
import com.esri.arcgisruntime.loadable.LoadStatus;
34+
import com.esri.arcgisruntime.mapping.ArcGISMap;
35+
import com.esri.arcgisruntime.mapping.Basemap;
36+
import com.esri.arcgisruntime.mapping.view.MapView;
37+
import com.esri.arcgisruntime.ogc.kml.KmlDataset;
38+
import com.esri.arcgisruntime.portal.Portal;
39+
import com.esri.arcgisruntime.portal.PortalItem;
40+
41+
public class DisplayKMLSample extends Application {
42+
43+
private MapView mapView;
44+
45+
@Override
46+
public void start(Stage stage) {
47+
48+
try {
49+
// create stack pane and application scene
50+
StackPane stackPane = new StackPane();
51+
Scene scene = new Scene(stackPane);
52+
53+
// set title, size, and add scene to stage
54+
stage.setTitle("Display KML Sample");
55+
stage.setWidth(800);
56+
stage.setHeight(700);
57+
stage.setScene(scene);
58+
stage.show();
59+
60+
// create a map and add it to the map view
61+
ArcGISMap map = new ArcGISMap(Basemap.createDarkGrayCanvasVector());
62+
mapView = new MapView();
63+
mapView.setMap(map);
64+
65+
// start zoomed in over the US
66+
mapView.setViewpointGeometryAsync(new Envelope(-19195297.778679, 512343.939994, -3620418.579987, 8658913.035426, 0.0, 0.0, SpatialReferences.getWebMercator()));
67+
68+
// show a combo box with the different KML data source options
69+
ComboBox<KmlDatasourceType> kmlSourceComboBox = new ComboBox<>();
70+
kmlSourceComboBox.getItems().addAll(KmlDatasourceType.values());
71+
72+
// show the KML layer when the data source option is shown
73+
kmlSourceComboBox.getSelectionModel().selectedItemProperty().addListener(o -> {
74+
// clear previous layer
75+
map.getOperationalLayers().clear();
76+
// create a KML layer based on the source type
77+
KmlDatasourceType kmlSourceType = kmlSourceComboBox.getSelectionModel().getSelectedItem();
78+
try {
79+
KmlLayer kmlLayer = null;
80+
switch (kmlSourceType) {
81+
case URL:
82+
KmlDataset urlKmlDataset = new KmlDataset("https://www.wpc.ncep.noaa.gov/kml/noaa_chart/WPC_Day1_SigWx.kml");
83+
kmlLayer = new KmlLayer(urlKmlDataset);
84+
break;
85+
case PORTAL_ITEM:
86+
Portal portal = new Portal("https://arcgisruntime.maps.arcgis.com");
87+
PortalItem portalItem = new PortalItem(portal, "9fe0b1bfdcd64c83bd77ea0452c76253");
88+
kmlLayer = new KmlLayer(portalItem);
89+
break;
90+
case LOCAL_FILE:
91+
File kmlFile = new File("./samples-data/kml/US_State_Capitals.kml");
92+
KmlDataset fileKmlDataset = new KmlDataset(kmlFile.getAbsolutePath());
93+
kmlLayer = new KmlLayer(fileKmlDataset);
94+
break;
95+
}
96+
// add the KML layer as an operational layer
97+
map.getOperationalLayers().add(kmlLayer);
98+
99+
KmlLayer finalKmlLayer = kmlLayer;
100+
kmlLayer.addDoneLoadingListener(() -> {
101+
if (finalKmlLayer.getLoadStatus() != LoadStatus.LOADED) {
102+
new Alert(Alert.AlertType.ERROR, "Error loading KML layer").show();
103+
}
104+
});
105+
} catch (Exception e) {
106+
new Alert(Alert.AlertType.ERROR, "Error creating KML layer").show();
107+
}
108+
});
109+
110+
// start with the URL data source chosen
111+
kmlSourceComboBox.getSelectionModel().select(0);
112+
113+
// add the map view to stack pane
114+
stackPane.getChildren().addAll(mapView, kmlSourceComboBox);
115+
StackPane.setAlignment(kmlSourceComboBox, Pos.TOP_LEFT);
116+
StackPane.setMargin(kmlSourceComboBox, new Insets(10));
117+
} catch (Exception e) {
118+
// on any error, display the stack trace.
119+
e.printStackTrace();
120+
}
121+
}
122+
123+
private enum KmlDatasourceType {
124+
URL, PORTAL_ITEM, LOCAL_FILE
125+
}
126+
127+
/**
128+
* Stops and releases all resources used in application.
129+
*/
130+
@Override
131+
public void stop() {
132+
133+
if (mapView != null) {
134+
mapView.dispose();
135+
}
136+
}
137+
138+
/**
139+
* Opens and runs application.
140+
*
141+
* @param args arguments passed to this application
142+
*/
143+
public static void main(String[] args) {
144+
145+
Application.launch(args);
146+
}
147+
148+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<h1>Display KML</h1>
2+
3+
<p>Display a KML layer from a URL, portal item, or local KML file.</p>
4+
5+
<p><img src="DisplayKML.png"/></p>
6+
7+
<h2>How it works</h2>
8+
9+
<p>To display a <code>KMLLayer</code>:</p>
10+
11+
<ol>
12+
<li>To create a KML layer from a URL, create a <code>KMLDataset</code> using the URL to the KML file. Then pass the dataset to the <code>KmlLayer</code> constructor.</li>
13+
<li>To create a KML layer from a portal item, construct a <code>PortalItem</code> with a portal and the KML portal item. Pass the portal item to the <code>KmlLayer</code> constructor.</li>
14+
<li>To create a KML layer from a local file, create a <code>KMLDataset</code> using the absolute file path to the local KML file. Then pass the dataset to the <code>KmlLayer</code> constructor.</li>
15+
<li>Add the layer as an operational layer to the map with <code>map.getOperationalLayers().add(kmlLayer)</code>.</li>
16+
</ol>
17+
18+
<h2>Relevant API</h2>
19+
20+
<ul>
21+
<li>KmlDataset</li>
22+
<li>KmlLayer</li>
23+
<li>Portal</li>
24+
<li>PortalItem</li>
25+
</ul>
545 KB
Loading

0 commit comments

Comments
 (0)