private void AddPolygon(bool sky, KmlLineList geo, float lineWidth, Color polyColor, Color lineColor, bool extrude, bool fill, Dates date)
        {
            //todo can we save this work for later?
            List <Vector3d> vertexList       = new List <Vector3d>();
            List <Vector3d> vertexListGround = new List <Vector3d>();

            //todo list
            // We need to Wrap Around for complete polygone
            // we aldo need to do intereor
            //todo space? using RA/DEC
            for (int i = 0; i < (geo.PointList.Count); i++)
            {
                vertexList.Add(Coordinates.GeoTo3dDoubleRad(geo.PointList[i].Lat, geo.PointList[i].Lng, 1 + (geo.PointList[i].Alt / meanRadius)));
                vertexListGround.Add(Coordinates.GeoTo3dDoubleRad(geo.PointList[i].Lat, geo.PointList[i].Lng, 1));
            }


            for (int i = 0; i < (geo.PointList.Count - 1); i++)
            {
                if (sky)
                {
                    //tdo reenable this
                    //this.lineList2d.AddLine
                    //    (Coordinates.RADecTo3d(-(180.0 - geo.PointList[i].Lng) / 15 + 12, geo.PointList[i].Lat, 1), Coordinates.RADecTo3d(-(180.0 - geo.PointList[i + 1].Lng) / 15 + 12, geo.PointList[i + 1].Lat, 1), lineColor, date);
                }
                else
                {
                    if (extrude)
                    {
                        this.triangleList.AddQuad(vertexList[i], vertexList[i + 1], vertexListGround[i], vertexListGround[i + 1], polyColor, date);
                    }
                    if (lineWidth > 0)
                    {
                        if (extrude)
                        {
                            this.lineList.AddLine(vertexList[i], vertexList[i + 1], lineColor, date);
                        }
                        else
                        {
                            this.lineList2d.AddLine(vertexList[i], vertexList[i + 1], lineColor, date);
                        }
                        if (extrude)
                        {
                            this.lineList.AddLine(vertexListGround[i], vertexListGround[i + 1], lineColor, date);
                            this.lineList.AddLine(vertexList[i], vertexListGround[i], lineColor, date);
                            this.lineList.AddLine(vertexList[i + 1], vertexListGround[i + 1], lineColor, date);
                        }
                    }
                }
            }
            if (fill)
            {
                List <int> indexes = Tessellator.TesselateSimplePoly(vertexList);

                for (int i = 0; i < indexes.Count; i += 3)
                {
                    this.triangleList.AddTriangle(vertexList[indexes[i]], vertexList[indexes[i + 1]], vertexList[indexes[i + 2]], polyColor, date);
                }
            }
        }
        private void ParsePolygon(string parens, string mods, Color lineColor, Color polyColor, double alt, Dates date)
        {
            if (!parens.StartsWith("(") && parens.EndsWith(")"))
            {
                return;
            }
            // string the top level of parens
            parens = parens.Substring(1, parens.Length - 2);

            List <string> shapes = UiTools.SplitString(parens, ",");

            foreach (string shape in shapes)
            {
                KmlLineList lineList = new KmlLineList();
                lineList.Astronomical = astronomical;
                lineList.MeanRadius   = meanRadius;
                lineList.ParseWkt(shape, mods, alt, date);
                if (alt == 0)
                {
                    AddPolygonFlat(false, lineList, 1, polyColor, lineColor, true, true, date);
                }
                else
                {
                    AddPolygon(false, lineList, 1, polyColor, lineColor, true, true, date);
                }
            }
        }
        private void ParseLineString(string parens, string mods, Color lineColor, double alt, bool single, Dates date)
        {
            if (!parens.StartsWith("(") && parens.EndsWith(")"))
            {
                return;
            }
            if (!single)
            {
                // string the top level of parens
                parens = parens.Substring(1, parens.Length - 2);
            }
            List <string> shapes = UiTools.SplitString(parens, ",");

            foreach (string shape in shapes)
            {
                KmlLineList lineList = new KmlLineList();
                lineList.Astronomical = astronomical;
                lineList.MeanRadius   = meanRadius;

                lineList.ParseWkt(shape, mods, alt, date);
                AddPolygon(false, lineList, 1, Colors.White, lineColor, false, false, date);
            }
        }
        private void AddPolygonFlat(bool sky, KmlLineList geo, float lineWidth, Color polyColor, Color lineColor, bool extrude, bool fill, Dates date)
        {
            //todo can we save this work for later?
            List <Vector3d> vertexList = new List <Vector3d>();

            for (int i = 0; i < (geo.PointList.Count); i++)
            {
                vertexList.Add(Coordinates.GeoTo3dDoubleRad(geo.PointList[i].Lat, geo.PointList[i].Lng, 1 + (geo.PointList[i].Alt / meanRadius)));
            }


            for (int i = 0; i < (geo.PointList.Count - 1); i++)
            {
                if (sky)
                {
                    //this.lineList2d.AddLine
                    //    (Coordinates.RADecTo3d(-(180.0 - geo.PointList[i].Lng) / 15 + 12, geo.PointList[i].Lat, 1), Coordinates.RADecTo3d(-(180.0 - geo.PointList[i + 1].Lng) / 15 + 12, geo.PointList[i + 1].Lat, 1), lineColor, date);
                }
                else
                {
                    if (lineWidth > 0)
                    {
                        this.lineList2d.AddLine(vertexList[i], vertexList[i + 1], lineColor, date);
                    }
                }
            }
            if (fill)
            {
                List <int> indexes = Tessellator.TesselateSimplePoly(vertexList);

                for (int i = 0; i < indexes.Count; i += 3)
                {
                    this.triangleList2d.AddSubdividedTriangles(vertexList[indexes[i]], vertexList[indexes[i + 1]], vertexList[indexes[i + 2]], polyColor, date, 2);
                }
            }
        }