예제 #1
0
        public void ParseWkt(string geoText, string option, double alt, Dates date)
        {
            //todo fix the WKT parser
            List <string> parts = UiTools.Split(geoText, "(,)");

            foreach (string part in parts)
            {
                string[] coordinates = part.Trim().Split(" ");
                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);
                }
            }
        }
예제 #2
0
        public 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);
        }