Microsoft.Photosynth.Viewer class

Version 0.1 - Back to Photosynth Javascript API Documentation

Overview

The Viewer class allows a user to view a synth. The Viewer class handles instantiating the Silverlight control and checking that the required Silverlight runtime is installed, if the correct runtime is not installed an install display will be shown.

Constructors

Signature Description
Viewer(divId) Creates the viewer inside the div element which has the id specified in the divId parameter. NOTE: The viewer does not currently support dynamic resizing for the install and delay loading screens, so if the div is resized after these screens are shown they will not resize.

Properties

Name Type Description
id String A unique identifier for the viewer instance. This value is read only and should not be changed.
viewport3D Microsoft.Photosynth.JsInterop.Viewport The viewport which can be used to control the 3D scene i.e. change camera position, rotation

Methods

Name and Signature Return Type Description
getCurrentDisplayMode() Microsoft.Photosynth.DisplayMode When called will return the current display mode the viewer is displaying.
getPointCloudMode() Microsoft.Photosynth.PointCloudMode Gets the current point cloud mode state i.e. images only, images and point cloud
getPoseState() String When called will return a string that contains values indicating the current state of the viewer i.e. is in 3D mode, camera position. The user can then call setFromPoseState and pass in this value to recreate the current scene. IMPORTANT: The contents of this string are undocumented and are subject to change at any time so do not take any dependencies on the content of this string, the return value should only be passed back into setFromPoseState. NOTE: It is only valid to call this method once the loaded event has fired.
getSelectedImageId() Number Returns the id of the current main image in the viewer
isSlideshowRunning() Boolean Returns true if the viewer is currently in slideshow mode, false otherwise.
loadCollectionAsync(loadParameters) - When called with a Microsoft.Photosynth.LoadParameters instance will load the collection specified in the viewer. See Microsoft.Photosynth.LoadParameters for more details on the allowable load options.
moveToImage(imageId, navigationType) When called will cause the 3D view of the viewer to transition to the specified image.  The ImageId is the id returned from the getSelectedImageId() method.  The navigationType parameter should be a valid value from Microsoft.Photosynth.NavigationType
setFromPoseState(poseState) - When called and passed a valid pose state (which was returned from getPoseState), the viewer will recreate the view that was visible when the user called getPoseState. It is only valid to pass in a string that was returned from the getPoseState method. NOTE: It is only valid to call this method once the loaded event has fired.
setPointCloudMode(mode) - Sets the desired point cloud mode.  The mode parameter should be a valid value from Microsoft.Photosynth.PointCloudMode
setSlideshowInterval(seconds) - Sets the amount of time the slideshow mode will wait before transitioning from one image to another.
toggleSlideshow(transitionImmediatelyOnStart) - Toggles the slideshow mode on and off. If transitionImmediatelyOnStart is true the viewer will start to transition to the next projector as soon as the slideshow starts, if false the viewer will wait for the default slideshow pause time after starting before moving to the next image.

Events

NOTE: There is a known issue that displaying an 'alert' message when the below events are raised can sometimes cause an exception in the Silverlight runtime to occur.

Name Description
beforeToggleFullScreen(viewer, arg) Raised just before the viewer toggles its fullscreen mode.  You can set the cancel property of the arg parameter to true to stop the fullscreen toggle (NOTE: you cannot stop exiting fullscreen if the user presses the esc key in fullscreen Silverlight mode, only if they clicked on the UI icon to exit fullscreen mode).
displayModeChanged(viewer) Raised when the user goes from 2D -> 3D mode or 3D -> 2D mode. The user can call getCurrentDisplayMode to get the current display mode. The viewer parameter is an instance of the Microsoft.Photosynth.Viewer class on which the loaded event was raised.
loadCollectionCompleted(viewer) Raised once the viewer has loaded the collection, after the "loadCollectionAsync" method was called. Once this method is raised user can now start to modify the state of the viewer, the results of trying to set values before this event is raised are undefined. The viewer parameter is an instance of the Microsoft.Photosynth.Viewer class on which the displayModeChanged event was raised.
pointCloudModeChanged(viewer) Raised when the point cloud mode of the viewer changes.  You can call getPointCloudMode() to get the current point cloud mode. The viewer parameter is an instance of the Microsoft.Photosynth.Viewer class on which the event was raised.
moveToImageCompleted(viewer) Raised when the viewer transitions to an image in 3D view.  This event will not be raised during camera rotation or object rotation until after the user releases the mouse and the image has settled.  The viewer parameter is an instance of the Microsoft.Photosynth.Viewer class on which the event was raised.