/*
 * Copyright 2016 Esri.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.esri.samples.scene;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import com.esri.arcgisruntime.mapping.ArcGISScene;
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.Surface;
import com.esri.arcgisruntime.mapping.view.Camera;
import com.esri.arcgisruntime.mapping.view.SceneView;

public class DisplayScene extends Application {

  private SceneView sceneView;
  private static final String ELEVATION_IMAGE_SERVICE =
      "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

  @Override
  public void start(Stage stage) throws Exception {

    try {

      // create stack pane and JavaFX app scene
      StackPane stackPane = new StackPane();
      Scene fxScene = new Scene(stackPane);

      // set title, size, and add JavaFX scene to stage
      stage.setTitle("Display a scene");
      stage.setWidth(800);
      stage.setHeight(700);
      stage.setScene(fxScene);
      stage.show();

      // create a scene and add a basemap to it
      ArcGISScene scene = new ArcGISScene();
      scene.setBasemap(Basemap.createImagery());

      // add the SceneView to the stack pane
      sceneView = new SceneView();
      sceneView.setArcGISScene(scene);
      stackPane.getChildren().addAll(sceneView);

      // add base surface for elevation data
      Surface surface = new Surface();
      surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
      scene.setBaseSurface(surface);

      // add a camera and initial camera position
      Camera camera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0);
      sceneView.setViewpointCamera(camera);
    } catch (Exception e) {
      // on any error, display the stack trace.
      e.printStackTrace();
    }
  }

  /**
   * Stops and releases all resources used in application.
   */
  @Override
  public void stop() {

    if (sceneView != null) {
      sceneView.dispose();
    }
  }

  /**
   * Opens and runs application.
   *
   * @param args arguments passed to this application
   */
  public static void main(String[] args) {

    Application.launch(args);
  }

}

@@ -16,22 +16,15 @@
  201
-6
+5
  Esri.
-%0A * %0A *
  Lic
@@ -71,16 +71,19 @@
 2.0 (the
+%0A *
  %22Licens
@@ -98,19 +98,16 @@
  may not
-%0A *
  use thi
@@ -151,16 +151,19 @@
 License.
+%0A *
  You may
@@ -179,19 +179,16 @@
  copy of
-%0A *
  the Lic
@@ -195,20 +195,16 @@
 ense at%0A
- * %0A
  * http:
@@ -244,15 +244,8 @@
 -2.0
-%0A * %0A *
  Unl
@@ -274,16 +274,19 @@
 able law
+%0A *
  or agre
@@ -311,19 +311,16 @@
 software
-%0A *
  distrib
@@ -344,16 +344,19 @@
 cense is
+%0A *
  distrib
@@ -388,19 +388,16 @@
  WITHOUT
-%0A *
  WARRANT
@@ -420,16 +420,19 @@
 S OF ANY
+%0A *
  KIND, e
@@ -464,19 +464,16 @@
  See the
-%0A *
  License
@@ -498,16 +498,19 @@
 language
+%0A *
  governi
@@ -545,19 +545,16 @@
 ns under
-%0A *
  the Lic
@@ -594,16 +594,30 @@
 es.scene
+.display_scene
 ;%0A%0Aimpor
@@ -1085,16 +1085,22 @@
 layScene
+Sample
  extends
@@ -1604,21 +1604,28 @@
 splay a 
-s
+S
 cene
+ Sample
 %22);%0A    

Update DisplaySceneSample.java