Update SyncMapAndSceneViewpoints.java
Renamed array list of geoviews and made it accessible to whole class
@@ -37,6 +37,7 @@ public class SyncMapAndSceneViewpoints extends Application {
private MapView mapView;
private SceneView sceneView;
+ private ArrayList<GeoView> geoViewList;
@Override
public void start(Stage stage) {
@@ -84,6 +85,11 @@ public class SyncMapAndSceneViewpoints extends Application {
synchronizeViewpoints(sceneView);
});
+ // create a list of geoviews being navigated
+ geoViewList = new ArrayList<>();
+ geoViewList.add(mapView);
+ geoViewList.add(sceneView);
+
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
@@ -100,13 +106,8 @@ public class SyncMapAndSceneViewpoints extends Application {
Viewpoint geoViewPoint = geoView.getCurrentViewpoint(Viewpoint.Type.CENTER_AND_SCALE);
- // create a list of geoviews being navigated
- ArrayList<GeoView> arrayListofGeoView = new ArrayList<>();
- arrayListofGeoView.add(mapView);
- arrayListofGeoView.add(sceneView);
-
// loop through the available geoviews. If it doesn't match the given geoview, then set the geoview to the other's viewpoint
- for (GeoView anyGeoView : arrayListofGeoView) {
+ for (GeoView anyGeoView : geoViewList) {
if (anyGeoView != geoView) {
anyGeoView.setViewpoint(geoViewPoint);
}
