CoordinateFactory Class
Factory for create coordinate objects which are used in the api
Namespace: StreetSmart.Common.FactoriesAssembly: StreetSmart.WinForms (in StreetSmart.WinForms.dll) Version: 24.7.0.0+cc0a01953d1235087ce28d3e921f5bb47d3c0460
public static class CoordinateFactory
- Inheritance
- Object CoordinateFactory
This sample shows how to use the
CoordinateFactory.
using System;
using System.Collections.Generic;
using StreetSmart.Common.Factories;
using StreetSmart.Common.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 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");
// open a panorama viewer
IList<IViewer> viewers = await _api.Open("Boschdijk 7, Eindhoven", viewerOpt);
if (viewers.Count == 1)
{
// Get the panorama viewer object
IPanoramaViewer viewer = (IPanoramaViewer) viewers[0];
// The look at coordinate
double x = 160850.585;
double y = 383923.326;
ICoordinate coordinate = CoordinateFactory.Create(x, y);
// let the viewer know where to look at
viewer.LookAtCoordinate(coordinate);
}
}
}
}
Supported in: 18.7