# HG changeset patch # User mkanning@CL-ENS241-10.cedarville.edu # Date 2013-02-14 16:26:44 # Node ID 6b1dee8bd7ef2708028c2b57d328bace0e2b0d32 # Parent 2f841e844536bef1d11247d2927c06d024ab61e3 fixed some mapping bugs and found converter for GPS diff --git a/Demo.WindowsForms/Forms/MainForm.cs b/Demo.WindowsForms/Forms/MainForm.cs --- a/Demo.WindowsForms/Forms/MainForm.cs +++ b/Demo.WindowsForms/Forms/MainForm.cs @@ -268,7 +268,7 @@ namespace Demo.WindowsForms 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) @@ -2421,7 +2421,7 @@ namespace Demo.WindowsForms #endregion - #region graph functions + #region graph and map functions #region chart coloring //this method clears the background of all charts @@ -2561,10 +2561,10 @@ namespace Demo.WindowsForms 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 @@ -2579,7 +2579,10 @@ namespace Demo.WindowsForms 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 @@ -2691,10 +2694,11 @@ 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); @@ -2711,6 +2715,23 @@ namespace Demo.WindowsForms 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 @@ -2726,6 +2747,7 @@ namespace Demo.WindowsForms else { tboxMessageBox.AppendText(value);// += value; + textBoxMarkerCount.Text = objects.Markers.Count.ToString(); } }