private void show_coord_value()
        {
            if ((coordObject.Point_Count == 0) && (coordObject.Polygon_Count == 0) && (coordObject.KML_Reference.Length == 0))
            {
                thisBox.Text = String.Empty;
                return;
            }

            if (coordObject.KML_Reference.Length > 0)
            {
                thisBox.Text = "KML Reference (" + coordObject.KML_Reference + ")";
                return;
            }

            if (coordObject.Polygon_Count >= 1)
            {
                if (coordObject.Get_Polygon(0).Label.Trim().Length > 0)
                {
                    thisBox.Text = "Polygon Included ( \"" + coordObject.Get_Polygon(0).Label.Trim() + "\" )";
                }
                else
                {
                    thisBox.Text = "Polygon Included";
                }

                return;
            }

            if (coordObject.Point_Count > 1)
            {
                thisBox.Text = "Multiple Points";
                return;
            }

            Coordinate_Point singlePoint = coordObject.Points[0];

            if (singlePoint.Label.Trim().Length > 0)
            {
                thisBox.Text = singlePoint.Latitude + " x " + singlePoint.Longitude + " ( \"" + singlePoint.Label + "\" )";
            }
            else
            {
                thisBox.Text = singlePoint.Latitude + " x " + singlePoint.Longitude;
            }
        }
        private void saveButton_Button_Pressed(object sender, EventArgs e)
        {
            if (!read_only)
            {
                saved = true;

                coords.KML_Reference = kmlTextBox.Text.Trim();

                coords.Clear_Points();

                try
                {
                    if ((point1LatitudeTextBox.Text.Trim().Length > 0) && (point1LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        coords.Add_Point(Convert.ToDouble(point1LatitudeTextBox.Text.Trim()), Convert.ToDouble(point1LongitudeTextBox.Text.Trim()), point1LabelTextBox.Text.Trim());
                    }

                    if ((point2LatitudeTextBox.Text.Trim().Length > 0) && (point2LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        coords.Add_Point(Convert.ToDouble(point2LatitudeTextBox.Text.Trim()), Convert.ToDouble(point2LongitudeTextBox.Text.Trim()), point2LabelTextBox.Text.Trim());
                    }

                    if ((point3LatitudeTextBox.Text.Trim().Length > 0) && (point3LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        coords.Add_Point(Convert.ToDouble(point3LatitudeTextBox.Text.Trim()), Convert.ToDouble(point3LongitudeTextBox.Text.Trim()), point3LabelTextBox.Text.Trim());
                    }

                    if ((point4LatitudeTextBox.Text.Trim().Length > 0) && (point4LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        coords.Add_Point(Convert.ToDouble(point4LatitudeTextBox.Text.Trim()), Convert.ToDouble(point4LongitudeTextBox.Text.Trim()), point4LabelTextBox.Text.Trim());
                    }

                    if ((point5LatitudeTextBox.Text.Trim().Length > 0) && (point5LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        coords.Add_Point(Convert.ToDouble(point5LatitudeTextBox.Text.Trim()), Convert.ToDouble(point5LongitudeTextBox.Text.Trim()), point5LabelTextBox.Text.Trim());
                    }
                }
                catch
                {
                }

                Coordinate_Polygon polygon = new Coordinate_Polygon();
                bool added     = false;
                bool hasPoints = false;
                if (coords.Polygon_Count > 0)
                {
                    added   = true;
                    polygon = coords.Get_Polygon(0);
                }

                polygon.Clear_Edge_Points();

                // Check for semicolons and blank longitudes
                if ((poly1LatitudeTextBox.Text.IndexOf(";") > 0) && (poly1LongitudeTextBox.Text.Trim().Length == 0))
                {
                    string[] split = poly1LatitudeTextBox.Text.Split(";".ToCharArray());
                    if (split.Length > 1)
                    {
                        poly1LatitudeTextBox.Text  = split[0];
                        poly1LongitudeTextBox.Text = split[1];
                    }
                }
                if ((poly2LatitudeTextBox.Text.IndexOf(";") > 0) && (poly2LongitudeTextBox.Text.Trim().Length == 0))
                {
                    string[] split = poly2LatitudeTextBox.Text.Split(";".ToCharArray());
                    if (split.Length > 1)
                    {
                        poly2LatitudeTextBox.Text  = split[0];
                        poly2LongitudeTextBox.Text = split[1];
                    }
                }
                if ((poly3LatitudeTextBox.Text.IndexOf(";") > 0) && (poly3LongitudeTextBox.Text.Trim().Length == 0))
                {
                    string[] split = poly3LatitudeTextBox.Text.Split(";".ToCharArray());
                    if (split.Length > 1)
                    {
                        poly3LatitudeTextBox.Text  = split[0];
                        poly3LongitudeTextBox.Text = split[1];
                    }
                }
                if ((poly4LatitudeTextBox.Text.IndexOf(";") > 0) && (poly4LongitudeTextBox.Text.Trim().Length == 0))
                {
                    string[] split = poly4LatitudeTextBox.Text.Split(";".ToCharArray());
                    if (split.Length > 1)
                    {
                        poly4LatitudeTextBox.Text  = split[0];
                        poly4LongitudeTextBox.Text = split[1];
                    }
                }
                if ((poly5LatitudeTextBox.Text.IndexOf(";") > 0) && (poly5LongitudeTextBox.Text.Trim().Length == 0))
                {
                    string[] split = poly5LatitudeTextBox.Text.Split(";".ToCharArray());
                    if (split.Length > 1)
                    {
                        poly5LatitudeTextBox.Text  = split[0];
                        poly5LongitudeTextBox.Text = split[1];
                    }
                }
                if ((poly6LatitudeTextBox.Text.IndexOf(";") > 0) && (poly6LongitudeTextBox.Text.Trim().Length == 0))
                {
                    string[] split = poly6LatitudeTextBox.Text.Split(";".ToCharArray());
                    if (split.Length > 1)
                    {
                        poly6LatitudeTextBox.Text  = split[0];
                        poly6LongitudeTextBox.Text = split[1];
                    }
                }

                try
                {
                    // Now assign any values that are present to the polygon
                    if ((poly1LatitudeTextBox.Text.Trim().Length > 0) && (poly1LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        hasPoints = true;
                        polygon.Add_Edge_Point(Convert.ToDouble(poly1LatitudeTextBox.Text.Trim()), Convert.ToDouble(poly1LongitudeTextBox.Text.Trim()), String.Empty);
                    }

                    if ((poly2LatitudeTextBox.Text.Trim().Length > 0) && (poly2LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        hasPoints = true;
                        polygon.Add_Edge_Point(Convert.ToDouble(poly2LatitudeTextBox.Text.Trim()), Convert.ToDouble(poly2LongitudeTextBox.Text.Trim()), String.Empty);
                    }

                    if ((poly3LatitudeTextBox.Text.Trim().Length > 0) && (poly3LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        hasPoints = true;
                        polygon.Add_Edge_Point(Convert.ToDouble(poly3LatitudeTextBox.Text.Trim()), Convert.ToDouble(poly3LongitudeTextBox.Text.Trim()), String.Empty);
                    }

                    if ((poly4LatitudeTextBox.Text.Trim().Length > 0) && (poly4LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        hasPoints = true;
                        polygon.Add_Edge_Point(Convert.ToDouble(poly4LatitudeTextBox.Text.Trim()), Convert.ToDouble(poly4LongitudeTextBox.Text.Trim()), String.Empty);
                    }

                    if ((poly5LatitudeTextBox.Text.Trim().Length > 0) && (poly5LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        hasPoints = true;
                        polygon.Add_Edge_Point(Convert.ToDouble(poly5LatitudeTextBox.Text.Trim()), Convert.ToDouble(poly5LongitudeTextBox.Text.Trim()), String.Empty);
                    }

                    if ((poly6LatitudeTextBox.Text.Trim().Length > 0) && (poly6LongitudeTextBox.Text.Trim().Length > 0))
                    {
                        hasPoints = true;
                        polygon.Add_Edge_Point(Convert.ToDouble(poly6LatitudeTextBox.Text.Trim()), Convert.ToDouble(poly6LongitudeTextBox.Text.Trim()), String.Empty);
                    }
                }
                catch
                {
                }

                polygon.Label = polyLabelTextBox.Text.Trim();
                if ((polygon.Label.Length == 0) && (isMap))
                {
                    polygon.Label = "Map Coverage";
                }

                // Are there just two points in this polygon?
                if (polygon.Edge_Points_Count == 2)
                {
                    Coordinate_Point first_point  = polygon.Edge_Points[0];
                    Coordinate_Point second_point = polygon.Edge_Points[1];

                    polygon.Clear_Edge_Points();

                    polygon.Add_Edge_Point(first_point);
                    polygon.Add_Edge_Point(first_point.Latitude, second_point.Longitude);
                    polygon.Add_Edge_Point(second_point);
                    polygon.Add_Edge_Point(second_point.Latitude, first_point.Longitude);
                }

                // If this has not been added and has points, add it
                if ((!added) && (hasPoints))
                {
                    coords.Add_Polygon(polygon);
                }
            }

            Close();
        }