x
We use cookies to analyze traffic and provide you with better content. By continuing to use our site, you agree to the use of cookie technology. Read more. I agree
Slide background

Developer -
C#

Getting started
  • Download and install TerraExplorer Plus.
  • 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.
  • 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.
  • 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.
  • 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.
  • Add the using directive for TerraExplorerX namespace in the Form1 code.
    • using TerraExplorerX;
  • Define a variable to hold an SGWorld object instance.
    • Note: You will use this variable later to access extensive TerraExplorer API.
    • private SGWorld66 sgworld;
  • Initialize an SGWorld 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.
    • sgworld = new SGWorld66();
  • Now you can use SGWorld 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 SGWorld66 sgworld;
            public Form1()
            {
                InitializeComponent();
                sgworld = new SGWorld66();
            }
     
            private void Form1_Load(object sender, EventArgs e)
            {
                // Register to OnLoadFinished globe event
                sgworld.OnLoadFinished += new _ISGWorld66Events_OnLoadFinishedEventHandler(OnProjectLoadFinished);
                // Open Project in asynchronous mode
                string flyFile = "https://www.skylinesoft.com/SkylineGlobe/WebClient/PresentationLayer/WebClient/SkyglobeLB.fly";
                sgworld.Project.Open(flyFile, truenullnull);
                MessageBox.Show("Opening project " + flyFile + " in async mode");
            }
     
            void OnProjectLoadFinished()
            {
                MessageBox.Show("Received project loaded event. Click OK to fly to  Washington DC.");
                IPosition66 Washington = sgworld.Creator.CreatePosition(-77.036667, 38.895111, 1500, AltitudeTypeCode.ATC_TERRAIN_RELATIVE, 0, 0, 0, 0);
                sgworld.Navigate.FlyTo(Washington);
            }
        }
  • Download additional code samples and examples of TerraExplorer’s capabilities for C# or VB.Net.
    • Note: Those samples require Visual Studio 2008.

Select your programming language/development environment:

API
Reference Guide

See complete list of methods
and properties

Download
Center

Developer evaluations
request form