public override void LoadDetails(XmlNode node, KmlRoot owner)
        {
            base.LoadDetails(node, owner);

            if (node["coordinates"] != null)
            {
                string data = node["coordinates"].InnerText;
                data = data.Replace(", ", ",").Replace(" ,", ",").Replace(" , ", ",").Replace("(", "").Replace(")", "");
                string[] lines = data.Split(new char[] { '\n', '\r', ' ' });
                foreach (string line in lines)
                {
                    string[] parts = line.Split(new char[] { ',' });
                    if (parts.Length > 1)
                    {
                        KmlCoordinate pnt = new KmlCoordinate();
                        pnt.Lng = double.Parse(parts[0]);
                        pnt.Lat = double.Parse(parts[1]);
                        if (parts.Length > 2)
                        {
                            pnt.Alt = double.Parse(parts[2]);
                        }
                        else
                        {
                            pnt.Alt = 0;
                        }
                        PointList.Add(pnt);
                    }
                }
            }
            if (node["extrude"] != null)
            {
                extrude = node["extrude"].InnerText.Trim() == "1";
            }

            if (node["altitudeMode"] != null)
            {
                try
                {
                    altitudeMode = (altitudeModeEnum)Enum.Parse(typeof(altitudeModeEnum), node["altitudeMode"].InnerText.Trim());
                }
                catch
                {
                }
            }
        }
        public override KmlCoordinate GetCenterPoint()
        {
            KmlCoordinate point = new KmlCoordinate();
            point.Lat = 0;
            point.Lng = 0;
            point.Alt = 0;

            foreach (KmlCoordinate pnt in PointList)
            {
                point.Lat += pnt.Lat;
                point.Lng += pnt.Lng;
                point.Alt += pnt.Alt;
            }
            point.Lat /= PointList.Count;
            point.Lng /= PointList.Count;
            point.Alt /= PointList.Count;

            return point;
        }
        public override KmlCoordinate GetCenterPoint()
        {
            KmlCoordinate point = new KmlCoordinate();
            point.Lat = 0;
            point.Lng = 0;
            point.Alt = 0;

            int count = 0;
            foreach (KmlGeometry child in Children)
            {
                count++;
                KmlCoordinate pnt = child.GetCenterPoint();
                point.Lat += pnt.Lat;
                point.Lng += pnt.Lng;
                point.Alt += pnt.Alt;
            }

            point.Lat /= count;
            point.Lng /= count;
            point.Alt /= count;

            return point;
        }
        public override KmlCoordinate GetCenterPoint()
        {
            KmlCoordinate point = new KmlCoordinate();
            point.Lat = this.latitude;
            point.Lng = this.longitude;
            point.Alt = this.altitude;

            return point;
        }
 public void ParseWkt(string geoText, string option, double alt, Dates date)
 {
     string[] parts = geoText.Split(new char[] { '(', ',', ')' });
     foreach (string part in parts)
     {
         string[] coordinates = part.Trim().Split(new char[] { ' ' });
         if (coordinates.Length > 1)
         {
             KmlCoordinate pnt = new KmlCoordinate();
             pnt.Lng = double.Parse(coordinates[0]);
             if (Astronomical)
             {
                 pnt.Lng -= 180;
             }
             pnt.Lat = double.Parse(coordinates[1]);
             if (coordinates.Length > 2 && alt == 0)
             {
                 pnt.Alt = double.Parse(coordinates[2]);
             }
             else
             {
                 pnt.Alt = alt;
             }
             pnt.Date = date;
             PointList.Add(pnt);
         }
     }
 }