Changeset - 6b1dee8bd7ef
[Not reviewed]
default
0 1 0
mkanning@CL-ENS241-10.cedarville.edu - 13 years ago 2013-02-14 16:26:44
mkanning@CL-ENS241-10.cedarville.edu
fixed some mapping bugs and found converter for GPS
1 file changed with 31 insertions and 9 deletions:
0 comments (0 inline, 0 general)
Demo.WindowsForms/Forms/MainForm.cs
Show inline comments
 
@@ -265,13 +265,13 @@ namespace Demo.WindowsForms
 
                return (T)formatter.Deserialize(ms);
 
            }
 
        }
 
 
        void Markers_CollectionChanged(object sender, GMap.NET.ObjectModel.NotifyCollectionChangedEventArgs e)
 
        {
 
            textBoxMarkerCount.Text = objects.Markers.Count.ToString();
 
            //textBoxMarkerCount.Text = objects.Markers.Count.ToString();
 
        }
 
 
        void Routes_CollectionChanged(object sender, GMap.NET.ObjectModel.NotifyCollectionChangedEventArgs e)
 
        {
 
            textBoxrouteCount.Text = routes.Routes.Count.ToString();
 
        }
 
@@ -2418,13 +2418,13 @@ namespace Demo.WindowsForms
 
                MessageBox.Show("Failed to open: " + ex.Message, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
 
            }
 
        }
 
 
        #endregion
 
 
        #region graph functions
 
        #region graph and map functions
 
 
        #region chart coloring
 
        //this method clears the background of all charts
 
        private void ResetChartColors()
 
        {
 
            chrtTopLeft.BackColor = Color.LightGray;
 
@@ -2558,16 +2558,16 @@ namespace Demo.WindowsForms
 
        //handle line of input data and put into chart
 
 
        //parses transmissions and saves data to CSV file
 
        public void ParseIncomingData(string rawDataReceived)
 
        {
 
            //check to see if data should be processed
 
            //if (!cboxCollectData.Checked)
 
            //{
 
            //    return;
 
            //}
 
            if (!cboxCollectData.Checked)
 
            {
 
                return;
 
            }
 
            /* sample stansmission
 
            KD8TDF-9>APRS,WIDE2-1:/151916z3944.87N/08348.75WO005/0.013 SV:09 A-30.5 B45.64 C99542
 
                                          ^char 31 ^char 40            ^60
 
            */
 
 
            //TODO: verify index charcter accuracy with real transmission
 
@@ -2576,13 +2576,16 @@ namespace Demo.WindowsForms
 
            latitude = rawDataReceived.Substring(indexStart + 1, indexEnd - indexStart - 1);
 
 
            indexStart = rawDataReceived.IndexOf("N/");
 
            indexEnd = rawDataReceived.IndexOf("WO");
 
            longitude = rawDataReceived.Substring(indexStart + 2, indexEnd - indexStart - 2);
 
 
            //addMarkerFromTransmit(latitude, longitude);
 
            if (latitude != "" && longitude != "")
 
            {
 
                addMarkerFromTransmit(latitude, longitude);
 
            }
 
            AddText(rawDataReceived + "\r\n");
 
 
            rawDataReceived = rawDataReceived.Substring(59); //remove APRS overhead from string
 
 
            //place each datum in its own variable
 
            string[] dataTransmission;
 
@@ -2688,16 +2691,17 @@ namespace Demo.WindowsForms
 
            }
 
        }
 
 
        // add marker from an APRS transmission - MDKEdit
 
        private void addMarkerFromTransmit(string lat, string lng)
 
        {
 
 
            double latitude = double.Parse(lat), longitude = double.Parse(lng);
 
            PointLatLng APRSloc = new PointLatLng();
 
            APRSloc.Lat = latitude;
 
            APRSloc.Lng = longitude;
 
            APRSloc.Lat = conv_coords((float)latitude);
 
            APRSloc.Lng = conv_coords((float)longitude)*-1;
 
 
            GMarkerGoogle m = new GMarkerGoogle(APRSloc, GMarkerGoogleType.blue_small);
 
 
            Placemark? p = null;
 
            if (xboxPlacemarkInfo.Checked)
 
            {
 
@@ -2708,12 +2712,29 @@ namespace Demo.WindowsForms
 
                    p = ret;
 
                }
 
            }
 
 
            objects.Markers.Add(m);
 
        }
 
 
        float conv_coords(float in_coords)
 
        {
 
            //Initialize the location.
 
            float f = in_coords;
 
            // Get the first two digits by turning f into an integer, then doing an integer divide by 100;
 
            // firsttowdigits should be 77 at this point.
 
            int firsttwodigits = ((int)f) / 100;                               //This assumes that f < 10000.
 
            float nexttwodigits = f - (float)(firsttwodigits * 100);
 
            float theFinalAnswer = (float)(firsttwodigits + nexttwodigits / 60.0);
 
            return theFinalAnswer;
 
        }
 
        public decimal DmsToDD(double d, double m = 0, double s = 0)
 
        {
 
            return Convert.ToDecimal((d + (m / 60) + (s / 3600)) * (d < 0 ? -1 : 1));
 
        }
 
 
        #endregion
 
 
        #region cross theading
 
 
        //these are for function calls across threads
 
        delegate void SetTextDelegate(string value);
 
@@ -2723,12 +2744,13 @@ namespace Demo.WindowsForms
 
            {
 
                Invoke(new SetTextDelegate(AddText), value);
 
            }
 
            else
 
            {
 
                tboxMessageBox.AppendText(value);// += value;
 
                textBoxMarkerCount.Text = objects.Markers.Count.ToString();
 
            }
 
        }
 
 
        delegate void ChartDataDelegate(string dataType, double data);
 
        public void AddDataToChart(string dataType, double data)
 
        {
0 comments (0 inline, 0 general)