Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用GoogleEarth插件从VB.NET通过FC.GEPluginCtrls加载本地KML_Vb.net_Google Earth Plugin - Fatal编程技术网

使用GoogleEarth插件从VB.NET通过FC.GEPluginCtrls加载本地KML

使用GoogleEarth插件从VB.NET通过FC.GEPluginCtrls加载本地KML,vb.net,google-earth-plugin,Vb.net,Google Earth Plugin,我正试图在VB.NET(VS2010)上开发一个使用GEPlugin()的应用程序 当然,我已经能够将插件加载到表单中,并且它可以正常工作。我可以在插件上看到地球,用户可以在上面移动。但是现在我尝试使用KmlTreeView将本地kml文件加载到插件中,但没有成功 我可以使用以下代码将外部kml文件加载到插件中,如“”: Private Sub GeWebBrowser1_PluginReady(ByVal sender As System.Object, ByVal e As FC.GEPlu

我正试图在VB.NET(VS2010)上开发一个使用GEPlugin()的应用程序

当然,我已经能够将插件加载到表单中,并且它可以正常工作。我可以在插件上看到地球,用户可以在上面移动。但是现在我尝试使用KmlTreeView将本地kml文件加载到插件中,但没有成功

我可以使用以下代码将外部kml文件加载到插件中,如“”:

Private Sub GeWebBrowser1_PluginReady(ByVal sender As System.Object, ByVal e As FC.GEPluginCtrls.GEEventArgs) Handles GeWebBrowser1.PluginReady

    KmlTreeView1.SetBrowserInstance(GeWebBrowser1)
    GeWebBrowser1.FetchKml("http://onearth.jpl.nasa.gov/OnEarth_BMNG.kml")

End Sub

Private Sub GeWebBrowser1_KmlLoaded(sender As Object, e As FC.GEPluginCtrls.GEEventArgs) Handles GeWebBrowser1.KmlLoaded
    Dim kml As Object

    kml = e.ApiObject

    GeWebBrowser1.ParseKmlObject(kml)
    KmlTreeView1.ParseKmlObject(kml)
End Sub


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    GeWebBrowser1.LoadEmbeddedPlugin() ' load the plugin
End Sub
但是,我没有找到加载本地kml文件的方法。我已经检查了是否存在一个GeWebBrowser控件的方法,该方法应该允许:GeWebBrowser1.FetchKmlLocal(“本地路径”)。但它不起作用

是否有人使用过此库?如果有,是否已成功加载本地kml文件

可能我使用的是旧的库版本(1.010)?。我在web上找不到发布版本,也无法创建发布版本,因为我在尝试加载解决方案时出错

提前感谢,,
Daniel。

您应该使用内置服务器处理本地kml文件

namespace ServerTest
{
    using System;
    using System.Windows.Forms;
    using FC.GEPluginCtrls;
    using FC.GEPluginCtrls.HttpServer;

    public partial class Form1 : Form
    {
        // initialise the server and tell it where the
        // root directory is 
        private GEServer server = new GEServer("webroot");

        public Form1()
        {
            InitializeComponent();

            // the server is fully configurable...
            // server.RootDirectory = "/foo/bar/";
            // server.DefaultFileName = "bat.kml"
            // server.IPAddress = System.Net.IPAddress.Any;
            // server.Port = 80;

            // start the server
            server.Start();

            // load the plugin
            geWebBrowser1.LoadEmbededPlugin();

            // when the plug-in has loaded
            geWebBrowser1.PluginReady += (o, e) =>
            {
                // load the kml from the local server
                geWebBrowser1.FetchKml("http://localhost:8080/KML_Samples.kml");
            };

            geWebBrowser1.KmlLoaded += (o, e) =>
            {
                // add the kml to the plugin
                geWebBrowser1.ParseKmlObject(e.ApiObject);
            };
        }
    }