Ejemplo n.º 1
0
        public static KmlHelper StartKmlWriting()
        {
            KmlHelper kmlWriter = new KmlHelper();

            AddKmlStyle(kmlWriter);
            return(kmlWriter);
        }
Ejemplo n.º 2
0
        private static void AddKmlStyle(KmlHelper kmlWriter)
        {
            XmlNode node = kmlWriter.AddStyle(_DefStyle);

            kmlWriter.AddStylePoly(node, 2, _DefColor, false);
            kmlWriter.AddIconStyle(node, new Uri("http://maps.google.com/mapfiles/kml/paddle/wht-blank.png"));
        }
Ejemplo n.º 3
0
        public void ExportToKml(String fileName)
        {
            KmlHelper kmlWriter = StartKmlWriting();

            WriteToKml(kmlWriter, kmlWriter.DocumentNode, Name);
            kmlWriter.SaveToFile(fileName);
        }
Ejemplo n.º 4
0
        public void WriteToKml(KmlHelper kmlWriter, XmlNode node, String description)
        {
            List <GeoPoint> border = new List <GeoPoint>();

            border.Add(NorthWestCorner);
            border.Add(NorthEastCorner);
            border.Add(SouthEastCorner);
            border.Add(SouthWestCorner);
            border.Add(NorthWestCorner);
            kmlWriter.AddPolygon(node, border, Name, _DefStyle, description, true);
        }
Ejemplo n.º 5
0
        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());
            }
        }
Ejemplo n.º 6
0
 public void WriteToKml(KmlHelper kmlWriter, XmlNode node, String description)
 {
     List<GeoPoint> border = new List<GeoPoint>();
     border.Add(NorthWestCorner);
     border.Add(NorthEastCorner);
     border.Add(SouthEastCorner);
     border.Add(SouthWestCorner);
     border.Add(NorthWestCorner);
     kmlWriter.AddPolygon(node, border, Name, _DefStyle, description, true);
 }
Ejemplo n.º 7
0
 public static KmlHelper StartKmlWriting()
 {
     KmlHelper kmlWriter = new KmlHelper();
     AddKmlStyle(kmlWriter);
     return kmlWriter;
 }
Ejemplo n.º 8
0
 private static void AddKmlStyle(KmlHelper kmlWriter)
 {
     XmlNode node = kmlWriter.AddStyle(_DefStyle);
     kmlWriter.AddStylePoly(node, 2, _DefColor, false);
     kmlWriter.AddIconStyle(node, new Uri("http://maps.google.com/mapfiles/kml/paddle/wht-blank.png"));
 }
Ejemplo n.º 9
0
 internal void AddToKml(KmlHelper iKml, XmlNode iNode, String lEntityName, String iDescription)
 {
     if (Location != null)
     {
         String lName = OfficeNameEnglish[Type] + ' ' + lEntityName;
         String lAddress = String.Empty;
         if (Address != null)
         {
             lAddress = Address.ToString();
         }
         // ToDo: for Amphoe also amphoe.com URL to description
         String lDescription = iDescription;
         foreach (Uri lUri in this.Websites)
         {
             lDescription = lDescription + Environment.NewLine + lUri.ToString();
         }
         iKml.AddPoint(iNode, Location.Latitude, Location.Longitude, lName, Type.ToString(),lAddress,lDescription);
     }
 }
Ejemplo n.º 10
0
 internal static void AddKmlStyles(KmlHelper iKml)
 {
     foreach (KeyValuePair<OfficeType, String> lKeyValuePair in OfficeKmlStyles)
     {
         iKml.AddIconStyle(lKeyValuePair.Key.ToString(), new Uri(lKeyValuePair.Value));
     }
 }
Ejemplo n.º 11
0
 public void ExportToKml(String iFilename)
 {
     KmlHelper lKmlWriter = new KmlHelper();
     EntityOffice.AddKmlStyles(lKmlWriter);
     WriteToKml(lKmlWriter, lKmlWriter.DocumentNode);
     lKmlWriter.SaveToFile(iFilename);
 }
Ejemplo n.º 12
0
 private void WriteToKml(KmlHelper lKmlWriter, XmlNode iNode)
 {
     XmlNode lNode = iNode;
     String lDescription = "Geocode: " + Geocode.ToString();
     if ( (Type == EntityType.Changwat) | (Type == EntityType.Bangkok) )
     {
         lNode = lKmlWriter.AddFolder(lNode, English, false);
     }
     String lName = English;
     if ( Type == EntityType.Muban )
     {
         lName = "Mu " + (Geocode % 100).ToString();
         if ( !String.IsNullOrEmpty(English) )
         {
             lName = lName + ' ' + English;
         }
     }
     if ( !String.IsNullOrEmpty(this.Comment) )
     {
         lDescription = lDescription + Environment.NewLine + this.Comment;
     }
     foreach ( EntityOffice lOffice in Offices )
     {
         lOffice.AddToKml(lKmlWriter, lNode, lName, lDescription);
     }
     foreach ( PopulationDataEntry lEntity in SubEntities )
     {
         lEntity.WriteToKml(lKmlWriter, lNode);
     }
 }