Skyline - it's your world

Developer

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

Contact Us

Developer - Web (JavaScript/HTML)


Getting started

  1. Download and install TerraExplorer Plus.
    Note: To work with TerraExplorer ActiveX component using JavaScript, it is recommended that you use SGAPI, an API wrapper that exposes most functionality of TerraExplorer API using JavaScript classes.
  2. Create a new HTML page.
  3. Reference the local copy of SGAPI library installed with TerraExplorer Plus.
    <script src="skyline:sgapi.js"></script>
  4. Define a div element that will hold a TerraExplorer ActiveX object
    <div id='myWorld' style="width:700px; height:500px;"></div>   
  5. Instantiate the SGWorld object which is the root of all SGAPI hierarchy, passing it the name of the div that should hold a TerraExplorer ActiveX component
    var globe = new SGWorld('myWorld');        
  6. Now you can use the SGWorld object to control the TerraExplorer ActiveX component. The following code loads a .fly project and flies to a specific location.
    <html>
    <head>
        <title>SGAPI Example</title>
        <script type="text/javascript" src="skyline:sgapi.js"></script>
        <script type="text/javascript">
            var globe;
            function Init() 
            {
                try 
                {
                    // instantiate SGWorld object
                    globe = new SGWorld("myWorld");
                    // attach callback to the load finished event
                    globe.attachEvent("onLoadFinished", OnLoadFinished);
                    // Load default developer fly file from www.skylineglobe.com web site.
                    var fly = "http://www.skylineglobe.com/SkylineGlobe/WebClient/PresentationLayer/WebClient/SkyglobeLB.fly";
                    globe.teCore.ITerraExplorer.Load(fly);
     
                }
                catch(e)
                {
                    alert(e.description);
                }
            }
            function OnLoadFinished() 
            { 
                // Fly to the Washington DC when fly is loaded
                var Washington = new SGCoord3D(-77.036667, 38.895111, 1500);
                globe.navigate.flyTo(Washington);
            }
        </script>
    </head>
    <body onload="Init()">
        <div id='myWorld' style="width:700px; height:500px;"></div>    
    </body>
    </html>
  7. View the above sample in your browser. Explore SkylineGlobe's interactive tutorial for more code samples and examples of TerraExplorer’s capabilities.

Related Links & Files

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

Content

Close