Rev 2342 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2342 | Rev 2347 | ||
---|---|---|---|
Line 541... | Line 541... | ||
541 | else |
541 | else |
542 | _readCont(!bReadContinously); |
542 | _readCont(!bReadContinously); |
543 | } |
543 | } |
544 | private void btnSetHP_Click(object sender, RoutedEventArgs e) |
544 | private void btnSetHP_Click(object sender, RoutedEventArgs e) |
545 | { |
545 | { |
546 | setHomePos(); |
546 | _setHomePos(); |
547 | } |
547 | } |
548 | private void btnClearHP_Click(object sender, RoutedEventArgs e) |
548 | private void btnClearHP_Click(object sender, RoutedEventArgs e) |
549 | { |
549 | { |
550 | clearHomePos(); |
550 | _clearHomePos(); |
551 | } |
551 | } |
552 | private void btnGotoHP_Click(object sender, RoutedEventArgs e) |
552 | private void btnGotoHP_Click(object sender, RoutedEventArgs e) |
553 | { |
553 | { |
554 | if (home != null && MainMap.Markers.Contains(home)) |
554 | if (home != null && MainMap.Markers.Contains(home)) |
555 | MainMap.Position = home.Position; |
555 | MainMap.Position = home.Position; |
Line 680... | Line 680... | ||
680 | copter.Offset = new System.Windows.Point(-18, -18); |
680 | copter.Offset = new System.Windows.Point(-18, -18); |
681 | copter.ZIndex = int.MaxValue; |
681 | copter.ZIndex = int.MaxValue; |
682 | MainMap.Markers.Add(copter); |
682 | MainMap.Markers.Add(copter); |
683 | copter.Position = MainMap.Position; |
683 | copter.Position = MainMap.Position; |
684 | } |
684 | } |
685 | void setHomePos() |
685 | void _setHomePos() |
686 | { |
686 | { |
687 | pHome = MainMap.Position; |
687 | pHome = MainMap.Position; |
688 | if (!MainMap.Markers.Contains(home)) |
688 | if (!MainMap.Markers.Contains(home)) |
689 | { |
689 | { |
690 | home = new GMapMarker(MainMap.Position); |
690 | home = new GMapMarker(MainMap.Position); |
Line 694... | Line 694... | ||
694 | MainMap.Markers.Add(home); |
694 | MainMap.Markers.Add(home); |
695 | } |
695 | } |
696 | home.Position = MainMap.Position; |
696 | home.Position = MainMap.Position; |
697 | ((CustomMarkerHome)(home.Shape)).setText(MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°")); |
697 | ((CustomMarkerHome)(home.Shape)).setText(MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°")); |
698 | } |
698 | } |
- | 699 | void _setActiveWP(int iIndex) |
|
- | 700 | { |
|
- | 701 | if (wpActiveMarker == null || !MainMap.Markers.Contains(wpActiveMarker)) |
|
- | 702 | { |
|
- | 703 | Dispatcher.Invoke(() => |
|
- | 704 | { |
|
- | 705 | wpActiveMarker = new GMapMarker(wpList[iIndex]); |
|
- | 706 | wpActiveMarker.Shape = new CustomMarkerWPActive(this, wpActiveMarker, "wpActive", 0); |
|
- | 707 | wpActiveMarker.Offset = new Point(-17.5, -17.5); |
|
- | 708 | MainMap.Markers.Add(wpActiveMarker); |
|
- | 709 | }); |
|
- | 710 | } |
|
- | 711 | else |
|
- | 712 | Dispatcher.Invoke(() => wpActiveMarker.Position = wpList[iIndex]); |
|
- | 713 | ||
- | 714 | } |
|
699 | void clearHomePos() |
715 | void _clearHomePos() |
700 | { |
716 | { |
701 | MainMap.Markers.Remove(home); |
717 | MainMap.Markers.Remove(home); |
702 | } |
718 | } |
703 | void _clearMapMarkers(Type markerType) |
719 | void _clearMapMarkers(Type markerType) |
704 | { |
720 | { |
Line 1627... | Line 1643... | ||
1627 | if (_iFirstSatFix < 3) |
1643 | if (_iFirstSatFix < 3) |
1628 | _iFirstSatFix++; |
1644 | _iFirstSatFix++; |
1629 | else |
1645 | else |
1630 | { |
1646 | { |
1631 | _bFirstSatFix = true; |
1647 | _bFirstSatFix = true; |
1632 | Dispatcher.Invoke(() => setHomePos()); |
1648 | Dispatcher.Invoke(() => _setHomePos()); |
1633 | } |
1649 | } |
1634 | } |
1650 | } |
1635 | if (stbSatFixLostAnim != null && _bAnimSatFixActive) |
1651 | if (stbSatFixLostAnim != null && _bAnimSatFixActive) |
1636 | { |
1652 | { |
1637 | Dispatcher.Invoke(() => stbSatFixLostAnim.Stop()); |
1653 | Dispatcher.Invoke(() => stbSatFixLostAnim.Stop()); |
Line 1693... | Line 1709... | ||
1693 | iVal = data[44] + i_16; |
1709 | iVal = data[44] + i_16; |
1694 | // Dispatcher.Invoke((Action)(() => tbTopDistanceHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1710 | // Dispatcher.Invoke((Action)(() => tbTopDistanceHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1695 | Dispatcher.Invoke((Action)(() => tbHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
1711 | Dispatcher.Invoke((Action)(() => tbHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
Line 1696... | Line 1712... | ||
1696 | 1712 | ||
1697 | Dispatcher.Invoke((Action)(() => tbWPIndex.Text = data[48].ToString())); //Waypoint index |
1713 | Dispatcher.Invoke((Action)(() => tbWPIndex.Text = data[48].ToString())); //Waypoint index |
- | 1714 | if(data[48] > 0 && _wpIndex != data[48] -1 && wpList.Count > 0) |
|
- | 1715 | { |
|
- | 1716 | _setActiveWP(data[48]-1); |
|
- | 1717 | _wpIndex = data[48]-1; |
|
- | 1718 | } |
|
1698 | if(_wpIndex != data[48] && wpList.Count > 0) |
1719 | else |
1699 | { |
- | |
1700 | if (wpActiveMarker != null) |
1720 | { |
1701 | MainMap.Markers.Remove((GMapMarker)wpActiveMarker); |
- | |
1702 | wpActiveMarker = new GMapMarker(wpList[data[48]]); |
- | |
1703 | wpActiveMarker.Shape = new CustomMarkerWPActive(this, wpActiveMarker, "wpActive",0); |
1721 | if ((data[48] == 0 || wpList.Count == 0) & MainMap.Markers.Contains(wpActiveMarker)) |
1704 | MainMap.Markers.Add(wpActiveMarker); |
1722 | Dispatcher.Invoke(() => MainMap.Markers.Remove(wpActiveMarker)); |
Line 1705... | Line -... | ||
1705 | } |
- | |
1706 | 1723 | } |
|
1707 | _wpIndex = data[48]; |
1724 | |
1708 | if(wpList.Count > 0 && ((data[67] & 2) == 2)) |
1725 | if(wpList.Count > 0 && ((data[67] & 2) == 2)) |
1709 | { |
1726 | { |
1710 | // Dispatcher.Invoke(() => |
1727 | // Dispatcher.Invoke(() => |
Line 3078... | Line 3095... | ||
3078 | _readWPLFile(); |
3095 | _readWPLFile(); |
3079 | } |
3096 | } |
3080 | private void btnClearWPList_Click(object sender, RoutedEventArgs e) |
3097 | private void btnClearWPList_Click(object sender, RoutedEventArgs e) |
3081 | { |
3098 | { |
3082 | _clearMapMarkers(typeof(CustomMarkerWP)); |
3099 | _clearMapMarkers(typeof(CustomMarkerWP)); |
- | 3100 | _clearMapMarkers(typeof(CustomMarkerWPActive)); |
|
3083 | wpList.Clear(); |
3101 | wpList.Clear(); |
3084 | if (mRouteWP != null) |
3102 | if (mRouteWP != null) |
3085 | MainMap.Markers.Remove(mRouteWP); |
3103 | MainMap.Markers.Remove(mRouteWP); |
3086 | if (wpActiveMarker != null) |
3104 | //if (wpActiveMarker != null) |
3087 | MainMap.Markers.Remove(wpActiveMarker); |
3105 | // MainMap.Markers.Remove(wpActiveMarker); |
3088 | dtWaypoints.Rows.Clear(); |
3106 | dtWaypoints.Rows.Clear(); |
3089 | Dispatcher.Invoke(() => dgvWP.Items.Refresh()); |
3107 | Dispatcher.Invoke(() => dgvWP.Items.Refresh()); |
3090 | Dispatcher.Invoke(() => lblWPIndex.Content = 0); |
3108 | Dispatcher.Invoke(() => lblWPIndex.Content = 0); |
3091 | Dispatcher.Invoke(() => lblWPCount.Content = 0); |
3109 | Dispatcher.Invoke(() => lblWPCount.Content = 0); |
3092 | Dispatcher.Invoke(() => lblWPRouteDistance.Content = "0 m"); |
3110 | Dispatcher.Invoke(() => lblWPRouteDistance.Content = "0 m"); |