Skip to content

Commit d8a6d49

Browse files
author
john0005
committed
Minor fixes
1 parent 357997b commit d8a6d49

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/main/java/com/esri/samples/geometry/list_transformations_by_suitability/ListTransformationsBySuitabilitySample.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public void start(Stage stage) throws Exception {
6464
stage.show();
6565

6666
// create a map with light gray canvas basemap and add it to the map view
67-
mapView = new MapView();
6867
ArcGISMap map = new ArcGISMap(Basemap.createLightGrayCanvas());
68+
mapView = new MapView();
6969
mapView.setMap(map);
7070

7171
// create a graphics overlay to show the original graphic and the the transformed graphic
@@ -74,25 +74,25 @@ public void start(Stage stage) throws Exception {
7474

7575
// create a blue square graphic located in the Greenwich observatory courtyard in London, UK, the location of the
7676
// Greenwich prime meridian. This will be projected using the selected transformation.
77-
Point point = new Point(538985.355, 177329.516, SpatialReference.create(27700));
78-
Graphic pointGraphic = new Graphic(point, new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.SQUARE, 0xFF0000FF,
79-
10));
80-
graphicsOverlay.getGraphics().add(pointGraphic);
77+
Point originalPoint = new Point(538985.355, 177329.516, SpatialReference.create(27700));
78+
Graphic originalGraphic = new Graphic(originalPoint, new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.SQUARE, 0xFF0000FF,
79+
10));
80+
graphicsOverlay.getGraphics().add(originalGraphic);
8181

8282
// create red cross graphic for transformed point
83-
Graphic transformedPointGraphic = new Graphic(point, new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CROSS,
84-
0xFFFF0000, 10));
85-
transformedPointGraphic.setVisible(false);
86-
graphicsOverlay.getGraphics().add(transformedPointGraphic);
83+
Graphic transformedGraphic = new Graphic();
84+
transformedGraphic.setSymbol(new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CROSS, 0xFFFF0000, 10));
85+
transformedGraphic.setVisible(false);
86+
graphicsOverlay.getGraphics().add(transformedGraphic);
8787

88-
// zoom to the initial point
89-
mapView.setViewpointCenterAsync(point, 5000);
88+
// zoom to the location of the original graphic
89+
mapView.setViewpointCenterAsync(originalPoint, 5000);
9090

9191
// create a list of transformations
9292
ListView<DatumTransformation> transformationsListView = new ListView<>();
9393

9494
// show the transformation name in the list
95-
transformationsListView.setCellFactory(list -> new ListCell<>() {
95+
transformationsListView.setCellFactory(list -> new ListCell<DatumTransformation>() {
9696

9797
@Override
9898
protected void updateItem(DatumTransformation transformation, boolean bln) {
@@ -112,11 +112,11 @@ protected void updateItem(DatumTransformation transformation, boolean bln) {
112112
transformationsListView.getItems().clear();
113113
List<DatumTransformation> transformations;
114114
if (suitabilityCheckBox.isSelected()) {
115-
transformations = TransformationCatalog.getTransformationsBySuitability(pointGraphic.getGeometry()
116-
.getSpatialReference(), map.getSpatialReference(), mapView.getVisibleArea().getExtent());
115+
transformations = TransformationCatalog.getTransformationsBySuitability(
116+
originalGraphic.getGeometry().getSpatialReference(), map.getSpatialReference(), mapView.getVisibleArea().getExtent());
117117
} else {
118-
transformations = TransformationCatalog.getTransformationsBySuitability(pointGraphic.getGeometry()
119-
.getSpatialReference(), map.getSpatialReference());
118+
transformations = TransformationCatalog.getTransformationsBySuitability(
119+
originalGraphic.getGeometry().getSpatialReference(), map.getSpatialReference());
120120
}
121121
transformationsListView.getItems().addAll(transformations);
122122
});
@@ -129,10 +129,10 @@ protected void updateItem(DatumTransformation transformation, boolean bln) {
129129
transformButton.setOnAction(e -> {
130130
DatumTransformation transformation = transformationsListView.getSelectionModel().getSelectedItem();
131131
if (transformation != null) {
132-
Point projectedPoint = (Point) GeometryEngine.project(pointGraphic.getGeometry(), mapView
133-
.getSpatialReference(), transformation);
134-
transformedPointGraphic.setVisible(true);
135-
transformedPointGraphic.setGeometry(projectedPoint);
132+
Point projectedPoint = (Point) GeometryEngine.project(originalGraphic.getGeometry(), mapView.getSpatialReference(),
133+
transformation);
134+
transformedGraphic.setVisible(true);
135+
transformedGraphic.setGeometry(projectedPoint);
136136
}
137137
});
138138

@@ -156,7 +156,7 @@ protected void updateItem(DatumTransformation transformation, boolean bln) {
156156
* Stops and releases all resources used in application.
157157
*/
158158
@Override
159-
public void stop() throws Exception {
159+
public void stop() {
160160

161161
if (mapView != null) {
162162
mapView.dispose();

0 commit comments

Comments
 (0)