Skyline - it's your world

Developer

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

Contact Us

Developer - C++


Getting started

This page demonstrates C++ development using the "#import" directive. When using the "#import" statement, it not only defines a smart pointer class for your interface using the COM_SMARTPTR_TYPEDEF() macro but also creates a wrapper class that allows accessing properties as PITerraExplorer5->DisplayErrorMessages = FALSE.

Note: The smart pointer mechanism also releases the interface pointers, so developers don’t need to worry about them in the code. When not using this mechanism, remember to release the interfaces after you finish using them.

  1. Download and install TerraExplorer Plus.
  2. Create a new Win32 Console Application project in Visual Studio, using Visual C++.
    • In Visual Studio, select File> New> Project.
    • Select Visual C++ >Win32 >Win32 Console Application.
    • Name the project TerraExplorerShowcase.
    • Click OK and then click Finish.
  3. Add the "#import" statement after all the include statements to link your project to the TerraExplorer COM interface. Make sure the name of the file in this command points to the TerraExplorer or TerraExplorer Pro executable on your computer.
    #import "C:\Program Files\Skyline\TerraExplorer\TerraExplorerX.dll" no_namespace, named_guids
  4. Initialize COM infrastructure inside your main method.
    CoInitialize();
    {
        // work with TerraExplorer here
    }
    CoUninitialize();
  5. Create the TerraExplorer CoClass.
    Note: You must create a TerraExplorer CoClass before working with the interfaces. The constant CLSID_TerraExplorer is automatically defined by the "#import" command.
    ITerraExplorer5Ptr pITerraExplorer5;
    pITerraExplorer5.CreateInstance(CLSID_TerraExplorer);
  6. Use the QueryInterface command to get the handle ID for the various interfaces.
    IPlane5Ptr    pIPlane5;
    pITerraExplorer5.QueryInterface(IID_IPlane5,(IPlane5Ptr**)&pIPlane5);
  7. Call the methods on the interface pointer.
    pITerraExplorer5->Load("http://www.skylinesoft.com/SkylineGlobe/WebClient/PresentationLayer/WebClient/SkyglobeLB.fly");
    pIPlane5->MovePosition(-102,27.5,3700000,10,0,0,0,-75.0,0);
  8. Full code for the example.
    // TerraExplorerShowcase.cpp : Defines the entry point for the console application.
    //
     
    #include "stdafx.h"
    #import "c:\Program Files\Skyline\TerraExplorer\TerraExplorerX.dll" no_namespace, named_guids
     
     
    int _tmain(int argc, _TCHAR* argv[])
    {
        CoInitialize(NULL);
        {
            ITerraExplorer5Ptr pITerraExplorer5;
            pITerraExplorer5.CreateInstance(CLSID_TerraExplorer);
     
            IPlane5Ptr    pIPlane5;
            pITerraExplorer5.QueryInterface(IID_IPlane5,(IPlane5Ptr**)&pIPlane5);
     
            pITerraExplorer5->Load("http://www.skylinesoft.com/SkylineGlobe/WebClient/PresentationLayer/WebClient/SkyglobeLB.fly");
            pIPlane5->MovePosition(-102,27.5,3700000,10,0,0,0,-75.0,0);
     
        }
        CoUninitialize();
     
        return 0;
    }

Related Links & Files

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

Content

Close