/// <summary>Open KML File by show a Dialog to open a file /// Open KML File by show a Dialog to open a file /// </summary> public void OpenKMLFile() { ofdOpenKML = new OpenFileDialog(); ofdOpenKML.Filter = "*.kml文件|*.kml"; ofdOpenKML.FileName = ""; if (ofdOpenKML.ShowDialog() == DialogResult.OK) { String kmlFile = ofdOpenKML.FileName.ToString(); _geApp.OpenKmlFile(kmlFile, 1); } }
private void btnFlyTo_Click(object sender, EventArgs e) { try { var googleEarth = new ApplicationGEClass(); String tempKmlFile = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".kml"; KmlHelper kmlWriter = new KmlHelper(); kmlWriter.AddPoint(_Point.Latitude, _Point.Longitude, "Temporary location", "", "", ""); kmlWriter.SaveToFile(tempKmlFile); while (googleEarth.IsInitialized() == 0) { Thread.Sleep(500); } googleEarth.OpenKmlFile(tempKmlFile, 0); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnFlyTo_Click(object sender, EventArgs e) { try { var googleEarth = new ApplicationGEClass(); String tempKmlFile = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".kml"; KmlHelper kmlWriter = new KmlHelper(); kmlWriter.AddPoint(_Point.Latitude, _Point.Longitude, "Temporary location", "", "", ""); kmlWriter.SaveToFile(tempKmlFile); while ( googleEarth.IsInitialized() == 0 ) { Thread.Sleep(500); } googleEarth.OpenKmlFile(tempKmlFile, 0); } catch ( Exception ex ) { MessageBox.Show(ex.ToString()); } }