Skip to content

Commit f23bd71

Browse files
committed
Fix sample name
1 parent b4a3998 commit f23bd71

File tree

1 file changed

+118
-118
lines changed

1 file changed

+118
-118
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,118 @@
1-
/*
2-
* Copyright 2017 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.featurelayers.feature_layer_geodatabase;
18-
19-
import java.io.File;
20-
21-
import javafx.application.Application;
22-
import javafx.scene.Scene;
23-
import javafx.scene.control.Alert;
24-
import javafx.scene.layout.StackPane;
25-
import javafx.stage.Stage;
26-
27-
import com.esri.arcgisruntime.data.Geodatabase;
28-
import com.esri.arcgisruntime.data.GeodatabaseFeatureTable;
29-
import com.esri.arcgisruntime.layers.FeatureLayer;
30-
import com.esri.arcgisruntime.loadable.LoadStatus;
31-
import com.esri.arcgisruntime.mapping.ArcGISMap;
32-
import com.esri.arcgisruntime.mapping.Basemap;
33-
import com.esri.arcgisruntime.mapping.view.MapView;
34-
35-
public class FeatureLayerGeodatabase extends Application {
36-
37-
private MapView mapView;
38-
39-
@Override
40-
public void start(Stage stage) throws Exception {
41-
42-
try {
43-
44-
// create stack pane and JavaFX app scene
45-
StackPane stackPane = new StackPane();
46-
Scene fxScene = new Scene(stackPane);
47-
48-
// set title, size, and add JavaFX scene to stage
49-
stage.setTitle("Feature Layer Geodatabase Sample");
50-
stage.setWidth(800);
51-
stage.setHeight(700);
52-
stage.setScene(fxScene);
53-
stage.show();
54-
55-
// create map and add to view
56-
ArcGISMap map = new ArcGISMap(Basemap.createStreets());
57-
mapView = new MapView();
58-
mapView.setMap(map);
59-
60-
// create geodatabase from local resource
61-
String geodatabaseUrl = new File("samples-data/los_angeles/LA_Trails.geodatabase").getAbsolutePath();
62-
Geodatabase geodatabase = new Geodatabase(geodatabaseUrl);
63-
geodatabase.addDoneLoadingListener(() -> {
64-
if (geodatabase.getLoadStatus() == LoadStatus.LOADED) {
65-
// access the geodatabase's feature table Trailheads
66-
GeodatabaseFeatureTable geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTable("Trailheads");
67-
geodatabaseFeatureTable.loadAsync();
68-
// create a layer from the geodatabase feature table above and add to map
69-
FeatureLayer featureLayer = new FeatureLayer(geodatabaseFeatureTable);
70-
featureLayer.addDoneLoadingListener(() -> {
71-
if (featureLayer.getLoadStatus() == LoadStatus.LOADED) {
72-
// set viewpoint to the location of feature layer's features
73-
mapView.setViewpointCenterAsync(featureLayer.getFullExtent().getCenter(), 1000000);
74-
} else {
75-
Alert alert = new Alert(Alert.AlertType.ERROR, "Feature Layer Failed to Load!");
76-
alert.show();
77-
}
78-
});
79-
// display feature layer to the map view
80-
map.getOperationalLayers().add(featureLayer);
81-
} else {
82-
Alert alert = new Alert(Alert.AlertType.ERROR, "Geodatabase Failed to Load!");
83-
alert.show();
84-
}
85-
});
86-
// load geodatabase
87-
geodatabase.loadAsync();
88-
89-
// add the map view to stack pane
90-
stackPane.getChildren().addAll(mapView);
91-
} catch (Exception e) {
92-
// on any error, display the stack trace.
93-
e.printStackTrace();
94-
}
95-
}
96-
97-
/**
98-
* Stops and releases all resources used in application.
99-
*/
100-
@Override
101-
public void stop() {
102-
103-
if (mapView != null) {
104-
mapView.dispose();
105-
}
106-
}
107-
108-
/**
109-
* Opens and runs application.
110-
*
111-
* @param args arguments passed to this application
112-
*/
113-
public static void main(String[] args) {
114-
115-
Application.launch(args);
116-
}
117-
118-
}
1+
/*
2+
* Copyright 2017 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.featurelayers.feature_layer_geodatabase;
18+
19+
import java.io.File;
20+
21+
import javafx.application.Application;
22+
import javafx.scene.Scene;
23+
import javafx.scene.control.Alert;
24+
import javafx.scene.layout.StackPane;
25+
import javafx.stage.Stage;
26+
27+
import com.esri.arcgisruntime.data.Geodatabase;
28+
import com.esri.arcgisruntime.data.GeodatabaseFeatureTable;
29+
import com.esri.arcgisruntime.layers.FeatureLayer;
30+
import com.esri.arcgisruntime.loadable.LoadStatus;
31+
import com.esri.arcgisruntime.mapping.ArcGISMap;
32+
import com.esri.arcgisruntime.mapping.Basemap;
33+
import com.esri.arcgisruntime.mapping.view.MapView;
34+
35+
public class FeatureLayerGeodatabaseSample extends Application {
36+
37+
private MapView mapView;
38+
39+
@Override
40+
public void start(Stage stage) throws Exception {
41+
42+
try {
43+
44+
// create stack pane and JavaFX app scene
45+
StackPane stackPane = new StackPane();
46+
Scene fxScene = new Scene(stackPane);
47+
48+
// set title, size, and add JavaFX scene to stage
49+
stage.setTitle("Feature Layer Geodatabase Sample");
50+
stage.setWidth(800);
51+
stage.setHeight(700);
52+
stage.setScene(fxScene);
53+
stage.show();
54+
55+
// create map and add to view
56+
ArcGISMap map = new ArcGISMap(Basemap.createStreets());
57+
mapView = new MapView();
58+
mapView.setMap(map);
59+
60+
// create geodatabase from local resource
61+
String geodatabaseUrl = new File("samples-data/los_angeles/LA_Trails.geodatabase").getAbsolutePath();
62+
Geodatabase geodatabase = new Geodatabase(geodatabaseUrl);
63+
geodatabase.addDoneLoadingListener(() -> {
64+
if (geodatabase.getLoadStatus() == LoadStatus.LOADED) {
65+
// access the geodatabase's feature table Trailheads
66+
GeodatabaseFeatureTable geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTable("Trailheads");
67+
geodatabaseFeatureTable.loadAsync();
68+
// create a layer from the geodatabase feature table above and add to map
69+
FeatureLayer featureLayer = new FeatureLayer(geodatabaseFeatureTable);
70+
featureLayer.addDoneLoadingListener(() -> {
71+
if (featureLayer.getLoadStatus() == LoadStatus.LOADED) {
72+
// set viewpoint to the location of feature layer's features
73+
mapView.setViewpointCenterAsync(featureLayer.getFullExtent().getCenter(), 1000000);
74+
} else {
75+
Alert alert = new Alert(Alert.AlertType.ERROR, "Feature Layer Failed to Load!");
76+
alert.show();
77+
}
78+
});
79+
// display feature layer to the map view
80+
map.getOperationalLayers().add(featureLayer);
81+
} else {
82+
Alert alert = new Alert(Alert.AlertType.ERROR, "Geodatabase Failed to Load!");
83+
alert.show();
84+
}
85+
});
86+
// load geodatabase
87+
geodatabase.loadAsync();
88+
89+
// add the map view to stack pane
90+
stackPane.getChildren().addAll(mapView);
91+
} catch (Exception e) {
92+
// on any error, display the stack trace.
93+
e.printStackTrace();
94+
}
95+
}
96+
97+
/**
98+
* Stops and releases all resources used in application.
99+
*/
100+
@Override
101+
public void stop() {
102+
103+
if (mapView != null) {
104+
mapView.dispose();
105+
}
106+
}
107+
108+
/**
109+
* Opens and runs application.
110+
*
111+
* @param args arguments passed to this application
112+
*/
113+
public static void main(String[] args) {
114+
115+
Application.launch(args);
116+
}
117+
118+
}

0 commit comments

Comments
 (0)