google earth之 "hello word"

         GE(google earth)现在已经出来第五版了 提供了个人免费版、Plus版、Pro版,个人开发只安装个人免费版就可以了,如果需要更多的功能,那么只有每年出钱钱买了。

GoogleEarth COM API参考文档可以在这里找到:http://earth.google.com/comapi/index.html

        现在我们来了解怎么用GE,首先你得去下载它 这里可以下载http://dl.pconline.com.cn/html_2/1/133/id=10745&pn=0.html

         然后安装它。

         新建一个c#窗口应该程序,我本机上时VS2008 。打开VS2008 ,新建一个Windows应用程序项目,在“项目”菜单中选择“添加引用…”,切换到“COM”选项卡,选择“Google Earth 1.0 Type Library”,其实就是Google Earth的主程序 在项目的引用中你可以看到已经添加了一个EARTHLib的引用,然后我们就可以调用其中的接口进行开发了。

        

代码
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EARTHLib;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;
using EARTHLib;

//..........

//................
//
private void StartGE()
{

try
{
GeApp
= (ApplicationGEClass)Marshal.GetActiveObject("GoogleEarth.Application");
isGeStarted
= true;
}
catch
{
GeApp
= new ApplicationGEClass();
isGeStarted
= true;
}
}

 

虽然在一个时间里 启用上面的函数后,就可以打开google earth了 

   参看http://www.cnblogs.com/wpwen/archive/2009/02/06/1385570.html

 

posted @ 2010-01-22 18:21  p-boy  阅读(314)  评论(0编辑  收藏  举报