Ejemplo n.º 1
0
 public void AddPoint(KmlPoint p)
 {
     if (p != null && p.CN != "")
         _Points.Add(p);
 }
Ejemplo n.º 2
0
        public void WriteKmlPoint(KmlPoint point)
        {
            try
            {
                if (point != null)
                {
                    WriteStartElement("Point");

                    if (point.Name != null)
                        WriteAttributeString("id", point.Name);
                    WriteComment("Point Guid: " + point.CN);

                    if (point.Extrude != null)
                        WriteElementString("extrude", point.Extrude.ToString());

                    if (point.AltMode != null)
                    {
                        if (point.AltMode == AltitudeMode.clampToGround || point.AltMode == AltitudeMode.relativeToGround || point.AltMode == AltitudeMode.absolute)
                            WriteElementString("altitudeMode", point.AltMode.ToString());
                        else
                            WriteElementString("gx:altitudeMode", point.AltMode.ToString());
                    }

                    WriteStartElement("coordinates");
                    StringBuilder sb = new StringBuilder();
                    sb.Append(point.Coordinates.Lon + "," + point.Coordinates.Lat);

                    if (point.Coordinates.Alt != null)
                        sb.Append("," + point.Coordinates.Alt + " ");
                    else
                        sb.Append(" ");
                    WriteValue(sb.ToString());
                    WriteEndElement();

                    //end poly
                    WriteEndElement();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("WriteKmlPoint Error: " + ex.Message);
            }
        }