Click or drag to resize

IStreetSmartAPIOpen Method

Open a panorama and/or oblique viewer using a query. The query can be a coordinate, an extent, an address or a panorama/oblique ID.

Namespace:  StreetSmart.WinForms.Interfaces
Assembly:  StreetSmart.WinForms (in StreetSmart.WinForms.dll) Version: 18.3.0.0 (18.3.0.0)
Syntax
Task<IList<IViewer>> Open(
	string query,
	IViewerOptions options
)

Parameters

query
Type: SystemString
query for open a panoramic image
options
Type: StreetSmart.WinForms.InterfacesIViewerOptions
viewer options for open the panoramic image

Return Value

Type: TaskIListIViewer
Asynchronous function, A list of opened viewers
Exceptions
ExceptionCondition
StreetSmartImageNotFoundExceptionThrown when no image is found
Examples
This sample shows how to use the Open(String, IViewerOptions) function.
using System;
using System.Collections.Generic;
using StreetSmart.WinForms.Exceptions;
using StreetSmart.WinForms.Factories;
using StreetSmart.WinForms.Interfaces;

namespace Demo
{
  public class Example
  {
    private IStreetSmartAPI _api;
    private System.Windows.Forms.Panel plStreetSmart = new System.Windows.Forms.Panel();

    public void StartAPI()
    {
      _api = StreetSmartAPIFactory.Create();
      _api.APIReady += OnAPIReady;
      plStreetSmart.Controls.Add(_api.GUI);
    }

    private async void OnAPIReady(object sender, EventArgs args)
    {
      // The dom element within the api must be rendered.
      IDomElement element = DomElementFactory.Create();

      // The initialisation options of the api
      IOptions options = OptionsFactory.Create("myUsername", "myPassword", "myAPIKey", "EPSG:28992", element);

      // Initialize the api.
      await _api.Init(options);

      // The open viewer options for open a new panorama viewer in EPSG:28992.
      IViewerOptions viewerOpt = ViewerOptionsFactory.Create(new List<ViewerType> {ViewerType.Panorama}, "EPSG:28992");

      try
      {
        IList<IViewer> viewers = await _api.Open("Lange Haven 145, Schiedam", viewerOpt);
        // Todo: add functionality
      }
      catch (StreetSmartImageNotFoundException ex)
      {
        // image not found exception (ex)
      }
    }
  }
}
See Also