private Mission Parse_Mission()
        {
            Mission Parsed_Misison = new Mission();
            string  Search_Area_Text, Waypoint_Text, Emergent_Target_Text, Airdrop_Text, Off_Axis_target_Text;

            FlyZone_List[FlyZone_Select_Combobox.SelectedIndex] = FlyZone_Textbox.Text;
            Search_Area_Text     = Search_Area_Textbox.Text;
            Waypoint_Text        = Waypoint_Textbox.Text;
            Emergent_Target_Text = Emergent_Target_Textbox.Text;
            Airdrop_Text         = Airdrop_Textbox.Text;
            Off_Axis_target_Text = Off_Axis_Target_Textbox.Text;


            if (Interoperability.getinstance().Settings["geo_cords"] == "DD.DDDDDD")
            {
                Parsed_Misison.fly_zones.Clear();
                for (int i = 0; i < FlyZone_List.Count; i++)
                {
                    Parsed_Misison.fly_zones.Add(new FlyZone(Max_Alt_MSL_List[i], Min_Alt_MSL_List[i], DDtoWaypoints(FlyZone_List[i]),
                                                             Border_Colour_List[i], Fill_Colour_List[i]));
                }

                //Add Search Areas
                Parsed_Misison.search_grid_points = DDtoWaypoints(Search_Area_Text);

                //Add Waypoints
                Parsed_Misison.mission_waypoints = DDwithAltitudetoWaypoints(Waypoint_Text);


                if (DDtoWaypoints(Emergent_Target_Text).Count != 0)
                {
                    Parsed_Misison.emergent_last_known_pos.latitude  = DDtoWaypoints(Emergent_Target_Text)[0].latitude;
                    Parsed_Misison.emergent_last_known_pos.longitude = DDtoWaypoints(Emergent_Target_Text)[0].longitude;
                }
                if (DDtoWaypoints(Airdrop_Text).Count != 0)
                {
                    Parsed_Misison.air_drop_pos.latitude  = DDtoWaypoints(Airdrop_Text)[0].latitude;
                    Parsed_Misison.air_drop_pos.longitude = DDtoWaypoints(Airdrop_Text)[0].longitude;
                }
                if (DDtoWaypoints(Off_Axis_target_Text).Count != 0)
                {
                    Parsed_Misison.off_axis_target_pos.latitude  = DDtoWaypoints(Off_Axis_target_Text)[0].latitude;
                    Parsed_Misison.off_axis_target_pos.longitude = DDtoWaypoints(Off_Axis_target_Text)[0].longitude;
                }
            }
            else
            {
                //Add Fly Zones
                Parsed_Misison.fly_zones.Clear();
                for (int i = 0; i < FlyZone_List.Count; i++)
                {
                    Parsed_Misison.fly_zones.Add(new FlyZone(Max_Alt_MSL_List[i], Min_Alt_MSL_List[i], DMStoWaypoints(FlyZone_List[i])));
                }

                //Add Search Areas
                Parsed_Misison.search_grid_points = DMStoWaypoints(Search_Area_Text);

                //Add Waypoints
                Parsed_Misison.mission_waypoints = DMSwithAltitudetoWaypoints(Waypoint_Text);

                if (DMStoWaypoints(Emergent_Target_Text).Count != 0)
                {
                    Parsed_Misison.emergent_last_known_pos.latitude  = DMStoWaypoints(Emergent_Target_Text)[0].latitude;
                    Parsed_Misison.emergent_last_known_pos.longitude = DMStoWaypoints(Emergent_Target_Text)[0].longitude;
                }
                if (DMStoWaypoints(Airdrop_Text).Count != 0)
                {
                    Parsed_Misison.air_drop_pos.latitude  = DMStoWaypoints(Airdrop_Text)[0].latitude;
                    Parsed_Misison.air_drop_pos.longitude = DMStoWaypoints(Airdrop_Text)[0].longitude;
                }
                if (DMStoWaypoints(Off_Axis_target_Text).Count != 0)
                {
                    Parsed_Misison.off_axis_target_pos.latitude  = DMStoWaypoints(Off_Axis_target_Text)[0].latitude;
                    Parsed_Misison.off_axis_target_pos.longitude = DMStoWaypoints(Off_Axis_target_Text)[0].longitude;
                }
            }

            return(Parsed_Misison);
        }
        private void Refresh_Map_Button_Click(object sender, EventArgs e)
        {
            Temporary_Mission = Parse_Mission();

            MAP_Update_Overlay();
            MAP_Clear_Overlays();


            for (int i = 0; i < Temporary_Mission.fly_zones.Count; i++)
            {
                MAP_addStaticPoly(Temporary_Mission.fly_zones[i].boundary_pts, "Geofence" + i.ToString(), Temporary_Mission.fly_zones[i].border_color,
                                  Temporary_Mission.fly_zones[i].fill_color, 3, 50);
            }

            MAP_addStaticPoly(Temporary_Mission.search_grid_points, "Search_Area", Color.Green, Color.Green, 3, 90);

            MAP_updateWP(Temporary_Mission.mission_waypoints);
            MAP_updateWPRoute(Temporary_Mission.mission_waypoints);

            MAP_updateOFAT_EN_DROP(Temporary_Mission);

            MAP_Update_Overlay();

            List <double> lat = new List <double>();
            List <double> lng = new List <double>();

            for (int i = 0; i < Temporary_Mission.fly_zones.Count; i++)
            {
                for (int j = 0; j < Temporary_Mission.fly_zones[i].boundary_pts.Count; j++)
                {
                    lat.Add(Temporary_Mission.fly_zones[i].boundary_pts[j].latitude);
                    lng.Add(Temporary_Mission.fly_zones[i].boundary_pts[j].longitude);
                }
            }
            for (int i = 0; i < Temporary_Mission.search_grid_points.Count; i++)
            {
                lat.Add(Temporary_Mission.search_grid_points[i].latitude);
                lng.Add(Temporary_Mission.search_grid_points[i].longitude);
            }
            if (Temporary_Mission.air_drop_pos.latitude != 0 || Temporary_Mission.air_drop_pos.longitude != 0)
            {
                lat.Add(Temporary_Mission.air_drop_pos.latitude);
                lng.Add(Temporary_Mission.air_drop_pos.longitude);
            }
            if (Temporary_Mission.emergent_last_known_pos.latitude != 0 || Temporary_Mission.emergent_last_known_pos.longitude != 0)
            {
                lat.Add(Temporary_Mission.emergent_last_known_pos.latitude);
                lng.Add(Temporary_Mission.emergent_last_known_pos.longitude);
            }
            if (Temporary_Mission.off_axis_target_pos.latitude != 0 || Temporary_Mission.off_axis_target_pos.longitude != 0)
            {
                lat.Add(Temporary_Mission.off_axis_target_pos.latitude);
                lng.Add(Temporary_Mission.off_axis_target_pos.longitude);
            }

            gMapControl1.SetZoomToFitRect(new RectLatLng((lat.Max() + lat.Min()) / 2, (lng.Max() + lng.Min()) / 2, lng.Max() - lng.Min(), lat.Max() - lat.Min()));
            gMapControl1.Position = new PointLatLng((lat.Max() + lat.Min()) / 2, (lng.Max() + lng.Min()) / 2);


            /*List<Waypoint> temp2 = new List<Waypoint>();
             * temp2.Add(new Waypoint(lat.Max(), lng.Max()));
             * temp2.Add(new Waypoint(lat.Max(), lng.Min()));
             * temp2.Add(new Waypoint(lat.Min(), lng.Min()));
             * temp2.Add(new Waypoint(lat.Min(), lng.Max()));
             * MAP_addStaticPoly(temp2, "idk", Color.Red, Color.Transparent, 3, 0);*/
        }