543,11 → 543,11 |
} |
private void btnSetHP_Click(object sender, RoutedEventArgs e) |
{ |
setHomePos(); |
_setHomePos(); |
} |
private void btnClearHP_Click(object sender, RoutedEventArgs e) |
{ |
clearHomePos(); |
_clearHomePos(); |
} |
private void btnGotoHP_Click(object sender, RoutedEventArgs e) |
{ |
682,7 → 682,7 |
MainMap.Markers.Add(copter); |
copter.Position = MainMap.Position; |
} |
void setHomePos() |
void _setHomePos() |
{ |
pHome = MainMap.Position; |
if (!MainMap.Markers.Contains(home)) |
696,8 → 696,24 |
home.Position = MainMap.Position; |
((CustomMarkerHome)(home.Shape)).setText(MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°")); |
} |
void clearHomePos() |
void _setActiveWP(int iIndex) |
{ |
if (wpActiveMarker == null || !MainMap.Markers.Contains(wpActiveMarker)) |
{ |
Dispatcher.Invoke(() => |
{ |
wpActiveMarker = new GMapMarker(wpList[iIndex]); |
wpActiveMarker.Shape = new CustomMarkerWPActive(this, wpActiveMarker, "wpActive", 0); |
wpActiveMarker.Offset = new Point(-17.5, -17.5); |
MainMap.Markers.Add(wpActiveMarker); |
}); |
} |
else |
Dispatcher.Invoke(() => wpActiveMarker.Position = wpList[iIndex]); |
|
} |
void _clearHomePos() |
{ |
MainMap.Markers.Remove(home); |
} |
void _clearMapMarkers(Type markerType) |
1629,7 → 1645,7 |
else |
{ |
_bFirstSatFix = true; |
Dispatcher.Invoke(() => setHomePos()); |
Dispatcher.Invoke(() => _setHomePos()); |
} |
} |
if (stbSatFixLostAnim != null && _bAnimSatFixActive) |
1695,16 → 1711,17 |
Dispatcher.Invoke((Action)(() => tbHP.Text = ((double)iVal / (double)10).ToString("0.0 m"))); //Distance to HP set by GPS on |
|
Dispatcher.Invoke((Action)(() => tbWPIndex.Text = data[48].ToString())); //Waypoint index |
if(_wpIndex != data[48] && wpList.Count > 0) |
if(data[48] > 0 && _wpIndex != data[48] -1 && wpList.Count > 0) |
{ |
if (wpActiveMarker != null) |
MainMap.Markers.Remove((GMapMarker)wpActiveMarker); |
wpActiveMarker = new GMapMarker(wpList[data[48]]); |
wpActiveMarker.Shape = new CustomMarkerWPActive(this, wpActiveMarker, "wpActive",0); |
MainMap.Markers.Add(wpActiveMarker); |
_setActiveWP(data[48]-1); |
_wpIndex = data[48]-1; |
} |
else |
{ |
if ((data[48] == 0 || wpList.Count == 0) & MainMap.Markers.Contains(wpActiveMarker)) |
Dispatcher.Invoke(() => MainMap.Markers.Remove(wpActiveMarker)); |
} |
|
_wpIndex = data[48]; |
if(wpList.Count > 0 && ((data[67] & 2) == 2)) |
{ |
// Dispatcher.Invoke(() => |
3080,11 → 3097,12 |
private void btnClearWPList_Click(object sender, RoutedEventArgs e) |
{ |
_clearMapMarkers(typeof(CustomMarkerWP)); |
_clearMapMarkers(typeof(CustomMarkerWPActive)); |
wpList.Clear(); |
if (mRouteWP != null) |
MainMap.Markers.Remove(mRouteWP); |
if (wpActiveMarker != null) |
MainMap.Markers.Remove(wpActiveMarker); |
//if (wpActiveMarker != null) |
// MainMap.Markers.Remove(wpActiveMarker); |
dtWaypoints.Rows.Clear(); |
Dispatcher.Invoke(() => dgvWP.Items.Refresh()); |
Dispatcher.Invoke(() => lblWPIndex.Content = 0); |