Skyline - it's your world

Developer

Product Overview
Why should you choose SkylineGlobe products? Click here...

Contact Us

Developer - C#


Getting started

  1. Download and install TerraExplorer Plus.
  2. Create a new Windows Forms Application project in Visual Studio, using either C# or VB.Net:
    • In Visual Studio, select File> New> Project.
    • If you want to create a C# project: Select Visual C#> Windows> Windows Forms Application. Name the project TerraExplorerShowcase, and click OK.
    • If you want to create a Visual Basic project: Select Visual Basic> Windows> Windows Forms Application. Name the project TerraExplorerShowcase, and click OK.
  3. Add TerraExplorer ActiveX objects to the Toolbox.
    • In Design view, right click the Toolbox, and select Choose Items.
    • Click the COM Components tab and select the TE3DWindow Class, TEInformationWindow Class and TENavigationMap Class check-boxes.
    • Click OK. Three icons are added to your toolbox: the 3D Window, the Information Window and the Navigation Map controls.
  4. Add a 3D Window to the form.
    • Click the 3D window control icon in the toolbox and drag it to the required location on your form.
  5. Reference TerraExplorerX COM dll.
    • From the Project menu, select Add References.
    • Click the COM Components tab and locate TerraExplorerX 1.0 Type Library from the available references.
  6. Add the using directive for TerraExplorerX namespace in the Form1 code.
    using TerraExplorerX;
    Imports TerraExplorerX
  7. Define a variable to hold a TerraExplorer object instance.
    Note: You will use this variable later to access extensive TerraExplorer API.
    private TerraExplorerClass _TE;
    Private _TE As TerraExplorer
  8. Initialize a TerraExplorer object.
    Note: This object will automatically find the ActiveX control that you have placed on the form and interact with it.

    Note: You should initialize this object only after the ActiveX object was already created, i.e. after the call to InitializeComponent() in the constructor.
    _TE = new TerraExplorerX.TerraExplorerClass();
    _TE = New TerraExplorer
  9. Now you can use TerraExplorer object to control the TerraExplorer ActiveX. The following code loads a .fly project and flies to a specific location.
    public partial class Form1 : Form
    {
        private TerraExplorerClass _TE;
        public Form1()
        {
            InitializeComponent();
            _TE = new TerraExplorerX.TerraExplorerClass();
            _TE.OnLoadFinished += new _ITerraExplorerEvents5_OnLoadFinishedEventHandler(_TE_OnLoadFinished);
        }
     
        void _TE_OnLoadFinished()
        {
            // Fly to the Washington DC when fly is loaded
            IPlane5 IPlane = _TE as IPlane5;
            IPlane.FlyTo(-77.036667, 38.895111, 1500, 1000, 0, -45.0, "FlyToLocation");
        }
     
        private void Form1_Load(object sender, EventArgs e)
        {
            // Get ITerraExplorer5 interface from _TE object
            ITerraExplorer5 ITerraExplorer = _TE as ITerraExplorer5;
            // Load default developer fly file from www.skylineglobe.com web site.
            string fly = @"http://www.skylinesoft.com/SkylineGlobe/WebClient/PresentationLayer/WebClient/SkyglobeLB.fly";
            ITerraExplorer.Load(fly);
        }
    }
    Imports TerraExplorerX
     
    Public Class Form1
        Private _TE As TerraExplorer
        Public Sub New()
     
            ' This call is required by the Windows Form Designer.
            InitializeComponent()
     
            ' Add any initialization after the InitializeComponent() call.
            _TE = New TerraExplorerX.TerraExplorerClass()
            AddHandler _TE.OnLoadFinished, AddressOf _TE_OnLoadFinished
     
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Get ITerraExplorer5 interface from _TE object
            Dim ITerraExplorer As ITerraExplorer5 = _TE
            ' Load default developer fly file from www.skylineglobe.com web site.
            Dim fly As String = "http://www.skylinesoft.com/SkylineGlobe/WebClient/PresentationLayer/WebClient/SkyglobeLB.fly"
            ITerraExplorer.Load(fly)
        End Sub
     
      Private Sub _TE_OnLoadFinished()
            ' Fly to the Washington DC when fly is loaded
            Dim IPlane As IPlane5 = TryCast(_TE, IPlane5)
            IPlane.FlyTo(-77.036667, 38.895111, 1500, 1000, 0, -45.0, "FlyToLocation")
        End Sub
     
    End Class
  10. Download additional code samples and examples of TerraExplorer’s capabilities for C# or VB.Net.
    Note: Those samples require Visual Studio 2008.
  11. Visit SkylineGlobe to see an example of a working web application that utilizes TerraExplorer.

Related Links & Files

© 2009 Skyline Software Systems Inc. All rights reserved.  contact us  |  support  |  legal notice  |  privacy

Content

Close