Web scene - slides

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to load a WebScene from an ArcGIS for Portal item and work with its slides. Slides store a snapshot of a visualization state of the scene that can be re-applied to the scene at a later time. Slides contain properties for viewpoint, layer visibilities, basemap and environment (as well as a title and thumbnail) so that users of a 3D application can easily navigate the scene and accurately recreate a stored view of that scene. In addition, the sample shows how to create new slides given the current view and store them in the presentation of the WebScene.

This WebScene depicts a fictitious urban development project in the City of Portland and it contains several slides. Each slide toggles the visibility of different layers or contains a different viewpoint of the development.

The WebScene instance has a presentation property that handles the scene's slides. The slides' properties can be used to create DOM elements to represent each viewpoint.

// The view must be ready (or resolved) before you can
// access the properties of the WebScene
view.then(function() {

  // The slides are a collection inside the presentation
  // property of the WebScene
  var slides = scene.presentation.slides;

  // Loop through each slide in the collection
  slides.forEach(function(slide) {

    // Create a new <div> element for each slide and place the title of
    // the slide in the element.
    var slideElement = domConstruct.create("div", {
      id: slide.id
    }, dom.byId("slidesDiv"));

    // Create a <div> element to display the slide title text.
    domConstruct.create("div", {
      textContent: slide.title.text
    }, slideElement);

    // Create a new <img> element and place it inside the newly created <div>.
    // This will reference the thumbnail from the slide.
    domConstruct.create("img", {
      src: slide.thumbnail.url,
      title: slide.title.text
    }, slideElement);
  });
});

Once a new DOM element is created for each slide, you can set up a click event handler to apply the slide's settings to the view. This is done with the slide's applyTo() method.

on(dom.byId(slide.id), "click", function() {
  slide.applyTo(view);
});

Sample search results

TitleSample

There were no match results from your search criteria.