How to Create a JavaScript Tool

Step 1: Create a JavaScript file

Create a JavaScript file. Use the SGFramework constant to access SGAPI functionalities.

Note: The SGFramework constant is created and referenced by the Web Package so you do not need to add a reference or instantiate it.

 

Step 2: Bind JS tool to a ribbon button

Add a function that binds the JS tool to a ribbon event.

Note:  You can define event buttons in the ribbon editor. Clicking the ribbon calls your function. E.g., SGFramework.Ribbon.bind("TemplateJSTool", TemplateJSBtnClick);

 

Step 3: Access SGAPI

Use the SGAPI properties and methods to provide SkylineGlobe framework functionality by creating tools to execute and manage SkylineGlobe tools and panels (e.g. Favorites, Results, and Search).

§   See the “SkylineGlobe API” chapter for a detailed reference of all available properties and methods.

 

Step 4: Access TerraExplorer API

Use the TerraExplorer v65 API properties and methods that are exposed by the SGFramework.SGWorld class to create the custom tool.

§   See the “TerraExplorer Programmer’s Guide” for a complete guide to TerraExplorer API.

 

Step 5: Publish tool

1.    Upload the JavaScript file to the SkylineGlobe Web Package server.

2.    In SkylineGlobe Manager, on the JS Sets page, click Add.

3.    On the JS Set Details page enter:

·          Name - Name of the JavaScript set.

·          Files - Absolute or relative path to the JavaScript file that should be defined in this set.

 

Step 6: Add tool to the ribbon

1.    In SkylineGlobe Manager, on the Ribbons page, click the Edit button next to the name of the ribbon you want to add the tool to.

2.    On the Ribbon details page, select the JavaScript set that includes your tool.

3.    Add an Event button to the required tab. SeeDefining the Ribbon” in the “Creating a Customized Web Application” chapter."

4.    Set the button’s actionParam to the event that was bound to the tool (Step 2).