Rev 2369 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2369 | Rev 2372 | ||
---|---|---|---|
Line 755... | Line 755... | ||
755 | { |
755 | { |
756 | GMapMarker p = _findWPMarker(s1); |
756 | GMapMarker p = _findWPMarker(s1); |
757 | if (p != null) |
757 | if (p != null) |
758 | ((CustomMarkerWP)p.Shape).WPText = s2; |
758 | ((CustomMarkerWP)p.Shape).WPText = s2; |
759 | } |
759 | } |
- | 760 | void _WPMarkerSetType(string text, int type) |
|
- | 761 | { |
|
- | 762 | GMapMarker p = _findWPMarker(text); |
|
- | 763 | if (p != null) |
|
- | 764 | ((CustomMarkerWP)p.Shape).WPType = type; |
|
- | 765 | } |
|
760 | void _repositionWPMarker(PointLatLng point, string name) |
766 | void _repositionWPMarker(PointLatLng point, string name) |
761 | { |
767 | { |
762 | GMapMarker p = _findWPMarker(name); |
768 | GMapMarker p = _findWPMarker(name); |
763 | if (p != null) |
769 | if (p != null) |
764 | p.Position = point; |
770 | p.Position = point; |
Line 3383... | Line 3389... | ||
3383 | wpMarker.Shape = new CustomMarkerWP(this, wpMarker, name, type); |
3389 | wpMarker.Shape = new CustomMarkerWP(this, wpMarker, name, type); |
3384 | wpMarker.Offset = new System.Windows.Point(-11.5, -11.5); |
3390 | wpMarker.Offset = new System.Windows.Point(-11.5, -11.5); |
3385 | wpMarker.ZIndex = 100; |
3391 | wpMarker.ZIndex = 100; |
3386 | _setMarkerColor(wpMarker, type); |
3392 | _setMarkerColor(wpMarker, type); |
3387 | Dispatcher.Invoke(() => MainMap.Markers.Add(wpMarker)); |
3393 | Dispatcher.Invoke(() => MainMap.Markers.Add(wpMarker)); |
3388 | if (type == 0) |
3394 | if (type == 0 || type == 3) |
3389 | wpList.Add(p); |
3395 | wpList.Add(p); |
3390 | return wpMarker; |
3396 | return wpMarker; |
3391 | } |
3397 | } |
3392 | void _setMarkerColor(GMapMarker wpMarker,int iType) |
3398 | void _setMarkerColor(GMapMarker wpMarker,int iType) |
3393 | { |
3399 | { |
Line 3401... | Line 3407... | ||
3401 | { |
3407 | { |
3402 | string s = comboBoxWPColor.SelectionBoxItem.ToString(); |
3408 | string s = comboBoxWPColor.SelectionBoxItem.ToString(); |
3403 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
3409 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
3404 | } |
3410 | } |
3405 | else |
3411 | else |
3406 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("red"); |
3412 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("green"); |
3407 | break; |
3413 | break; |
3408 | case 1: |
3414 | case 1: |
3409 | if (comboBoxPOIColor.SelectionBoxItem != null) |
3415 | if (comboBoxPOIColor.SelectionBoxItem != null) |
3410 | { |
3416 | { |
3411 | string s = comboBoxPOIColor.SelectionBoxItem.ToString(); |
3417 | string s = comboBoxPOIColor.SelectionBoxItem.ToString(); |
3412 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
3418 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
3413 | } |
3419 | } |
3414 | else |
3420 | else |
3415 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("red"); |
3421 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("pink"); |
3416 | break; |
3422 | break; |
3417 | case 2: |
3423 | case 2: |
3418 | if (comboBoxFSColor.SelectionBoxItem != null) |
3424 | if (comboBoxFSColor.SelectionBoxItem != null) |
3419 | { |
3425 | { |
3420 | string s = comboBoxFSColor.SelectionBoxItem.ToString(); |
3426 | string s = comboBoxFSColor.SelectionBoxItem.ToString(); |
3421 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
3427 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
3422 | } |
3428 | } |
3423 | else |
3429 | else |
3424 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("red"); |
3430 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("red"); |
3425 | break; |
3431 | break; |
- | 3432 | case 3: |
|
- | 3433 | if (comboBoxLandingColor.SelectionBoxItem != null) |
|
- | 3434 | { |
|
- | 3435 | string s = comboBoxLandingColor.SelectionBoxItem.ToString(); |
|
- | 3436 | ((CustomMarkerWP)(wpMarker.Shape)).setColor(s); |
|
- | 3437 | } |
|
- | 3438 | else |
|
- | 3439 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("blue"); |
|
- | 3440 | break; |
|
3426 | default: |
3441 | default: |
3427 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("red"); |
3442 | ((CustomMarkerWP)(wpMarker.Shape)).setColor("red"); |
3428 | break; |
3443 | break; |
3429 | } |
3444 | } |
3430 | }); |
3445 | }); |
Line 3431... | Line 3446... | ||
3431 | 3446 | ||
3432 | } |
3447 | } |
3433 | private void comboBoxWPColor_DropDownClosed(object sender, EventArgs e) |
3448 | private void comboBoxWPColor_DropDownClosed(object sender, EventArgs e) |
3434 | { |
- | |
3435 | Dispatcher.Invoke(() => |
- | |
3436 | { |
3449 | { |
3437 | if (comboBoxWPColor.SelectionBoxItem != null) |
- | |
3438 | { |
- | |
3439 | for (int k = 0; k < MainMap.Markers.Count;k++) |
- | |
3440 | { |
- | |
3441 | GMapMarker p = MainMap.Markers[k]; |
- | |
3442 | if (p.Shape.GetType() == typeof(CustomMarkerWP)) |
- | |
3443 | { |
- | |
3444 | if (((CustomMarkerWP)p.Shape).WPType == 0) |
- | |
3445 | { |
- | |
3446 | string s = comboBoxWPColor.SelectionBoxItem.ToString(); |
- | |
3447 | ((CustomMarkerWP)(p.Shape)).setColor(s); |
- | |
3448 | } |
- | |
3449 | } |
- | |
3450 | } |
- | |
3451 | } |
- | |
3452 | }); |
3450 | _MarkerColorSelection(sender, 0); |
3453 | } |
3451 | } |
3454 | private void comboBoxPOIColor_DropDownClosed(object sender, EventArgs e) |
3452 | private void comboBoxPOIColor_DropDownClosed(object sender, EventArgs e) |
3455 | { |
- | |
3456 | Dispatcher.Invoke(() => |
- | |
3457 | { |
3453 | { |
3458 | if (comboBoxPOIColor.SelectionBoxItem != null) |
- | |
3459 | { |
- | |
3460 | for (int k = 0; k < MainMap.Markers.Count; k++) |
- | |
3461 | { |
- | |
3462 | GMapMarker p = MainMap.Markers[k]; |
- | |
3463 | if (p.Shape.GetType() == typeof(CustomMarkerWP)) |
- | |
3464 | { |
- | |
3465 | if (((CustomMarkerWP)p.Shape).WPType == 1) |
- | |
3466 | { |
- | |
3467 | string s = comboBoxPOIColor.SelectionBoxItem.ToString(); |
- | |
3468 | ((CustomMarkerWP)(p.Shape)).setColor(s); |
- | |
3469 | } |
- | |
3470 | } |
- | |
3471 | } |
- | |
3472 | } |
- | |
3473 | }); |
- | |
3474 | 3454 | _MarkerColorSelection(sender, 1); |
|
3475 | } |
3455 | } |
3476 | private void comboBoxFSColor_DropDownClosed(object sender, EventArgs e) |
3456 | private void comboBoxFSColor_DropDownClosed(object sender, EventArgs e) |
- | 3457 | { |
|
- | 3458 | _MarkerColorSelection(sender, 2); |
|
- | 3459 | } |
|
- | 3460 | private void comboBoxLandingColor_DropDownClosed(object sender, EventArgs e) |
|
- | 3461 | { |
|
- | 3462 | _MarkerColorSelection(sender,3); |
|
- | 3463 | } |
|
- | 3464 | void _MarkerColorSelection(object sender,int type) |
|
3477 | { |
3465 | { |
3478 | Dispatcher.Invoke(() => |
3466 | Dispatcher.Invoke(() => |
3479 | { |
3467 | { |
3480 | if (comboBoxFSColor.SelectionBoxItem != null) |
3468 | if (((ComboBox)sender).SelectionBoxItem != null) |
3481 | { |
3469 | { |
3482 | for (int k = 0; k < MainMap.Markers.Count; k++) |
3470 | for (int k = 0; k < MainMap.Markers.Count; k++) |
3483 | { |
3471 | { |
3484 | GMapMarker p = MainMap.Markers[k]; |
3472 | GMapMarker p = MainMap.Markers[k]; |
3485 | if (p.Shape.GetType() == typeof(CustomMarkerWP)) |
3473 | if (p.Shape != null && p.Shape.GetType() == typeof(CustomMarkerWP)) |
3486 | { |
3474 | { |
3487 | if (((CustomMarkerWP)p.Shape).WPType == 2) |
3475 | if (((CustomMarkerWP)p.Shape).WPType == type) |
3488 | { |
3476 | { |
3489 | string s = comboBoxFSColor.SelectionBoxItem.ToString(); |
3477 | string s = ((ComboBox)sender).SelectionBoxItem.ToString(); |
3490 | ((CustomMarkerWP)(p.Shape)).setColor(s); |
3478 | ((CustomMarkerWP)(p.Shape)).setColor(s); |
3491 | } |
3479 | } |
3492 | } |
3480 | } |
3493 | } |
3481 | } |
Line 3562... | Line 3550... | ||
3562 | } |
3550 | } |
3563 | private void btnSendActiveWP_Click(object sender, RoutedEventArgs e) |
3551 | private void btnSendActiveWP_Click(object sender, RoutedEventArgs e) |
3564 | { |
3552 | { |
3565 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3553 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3566 | { |
3554 | { |
3567 | //if (_wpCount > 0) |
3555 | if (_wpCount > 0) |
3568 | // _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], -1, 's'); |
3556 | _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], -1, 's'); |
3569 | //else |
3557 | else |
3570 | // _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], 1, 's'); |
3558 | _sendWayPoint(dtWaypoints.Rows[dgvWP.SelectedIndex], 1, 's'); |
Line 3571... | Line 3559... | ||
3571 | 3559 | ||
3572 | int index = dgvWP.SelectedIndex; |
3560 | //int index = dgvWP.SelectedIndex; |
3573 | Thread t = new Thread(() => _sendWPList(index)); |
3561 | //Thread t = new Thread(() => _sendWPList(index)); |
Line 3574... | Line 3562... | ||
3574 | t.Start(); |
3562 | //t.Start(); |
3575 | 3563 | ||
3576 | Dispatcher.Invoke(() => { |
3564 | Dispatcher.Invoke(() => { |
3577 | DataGridRow row; |
3565 | DataGridRow row; |
Line 3714... | Line 3702... | ||
3714 | private void btnEditWPSave_Click(object sender, RoutedEventArgs e) |
3702 | private void btnEditWPSave_Click(object sender, RoutedEventArgs e) |
3715 | { |
3703 | { |
3716 | if(dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3704 | if(dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3717 | { |
3705 | { |
3718 | string oldName = (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]; |
3706 | string oldName = (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]; |
- | 3707 | int oldType = (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1]; |
|
3719 | int i = wpList.IndexOf(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4])); |
3708 | PointLatLng pOld = new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]); |
- | 3709 | int i = wpList.IndexOf(pOld); |
|
3720 | dtWaypoints.Rows[dgvWP.SelectedIndex][1] = cbWPEditType.SelectedIndex; |
3710 | dtWaypoints.Rows[dgvWP.SelectedIndex][1] = cbWPEditType.SelectedIndex; |
3721 | dtWaypoints.Rows[dgvWP.SelectedIndex][2] = tbWPEditPrefix.Text + (dgvWP.SelectedIndex + 1).ToString(); |
3711 | dtWaypoints.Rows[dgvWP.SelectedIndex][2] = tbWPEditPrefix.Text + (dgvWP.SelectedIndex + 1).ToString(); |
3722 | dtWaypoints.Rows[dgvWP.SelectedIndex][3] = Convert.ToDouble(tbWPEditLat.Text.Replace('.', ',')); |
3712 | dtWaypoints.Rows[dgvWP.SelectedIndex][3] = Convert.ToDouble(tbWPEditLat.Text.Replace('.', ',')); |
3723 | dtWaypoints.Rows[dgvWP.SelectedIndex][4] = Convert.ToDouble(tbWPEditLon.Text.Replace('.', ',')); |
3713 | dtWaypoints.Rows[dgvWP.SelectedIndex][4] = Convert.ToDouble(tbWPEditLon.Text.Replace('.', ',')); |
- | 3714 | if (i > -1) |
|
- | 3715 | { |
|
- | 3716 | if((int)dtWaypoints.Rows[dgvWP.SelectedIndex][1] == 0 || (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1] == 3) |
|
3724 | wpList[i] = (new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4])); |
3717 | wpList[i] = (new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4])); |
- | 3718 | else |
|
- | 3719 | wpList.Remove(pOld); |
|
- | 3720 | } |
|
- | 3721 | else |
|
- | 3722 | { |
|
- | 3723 | if ((int)dtWaypoints.Rows[dgvWP.SelectedIndex][1] == 0 || (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1] == 3) |
|
- | 3724 | { |
|
- | 3725 | int found = 0; |
|
- | 3726 | for (int k = 0; k < dgvWP.SelectedIndex; k++) |
|
- | 3727 | if ((int)dtWaypoints.Rows[k][1] == 0) |
|
- | 3728 | found++; |
|
- | 3729 | wpList.Insert(found, new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4])); |
|
- | 3730 | } |
|
- | 3731 | } |
|
3725 | dtWaypoints.Rows[dgvWP.SelectedIndex][5] = tbWPEditAlt.Text; |
3732 | dtWaypoints.Rows[dgvWP.SelectedIndex][5] = tbWPEditAlt.Text; |
3726 | switch (cbWPEditHeading.SelectedIndex) |
3733 | switch (cbWPEditHeading.SelectedIndex) |
3727 | { |
3734 | { |
3728 | case 0: |
3735 | case 0: |
3729 | dtWaypoints.Rows[dgvWP.SelectedIndex][6] = "0"; |
3736 | dtWaypoints.Rows[dgvWP.SelectedIndex][6] = "0"; |
Line 3776... | Line 3783... | ||
3776 | // _clearMapMarkers(typeof(CustomMarkerWP)); |
3783 | // _clearMapMarkers(typeof(CustomMarkerWP)); |
3777 | _repositionWPMarker(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]),oldName); |
3784 | _repositionWPMarker(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]),oldName); |
3778 | _renameWPMarker(oldName, (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]); |
3785 | _renameWPMarker(oldName, (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]); |
3779 | _clearMapMarkers(typeof(CustomMarkerWPActive)); |
3786 | _clearMapMarkers(typeof(CustomMarkerWPActive)); |
3780 | _setMarkerColor(_findWPMarker((string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]), (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1]); |
3787 | _setMarkerColor(_findWPMarker((string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]), (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1]); |
- | 3788 | _WPMarkerSetType((string)dtWaypoints.Rows[dgvWP.SelectedIndex][2], (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1]); |
|
3781 | // wpList.Clear(); |
3789 | // wpList.Clear(); |
3782 | if (mRouteWP != null) |
3790 | if (mRouteWP != null) |
3783 | MainMap.Markers.Remove(mRouteWP); |
3791 | MainMap.Markers.Remove(mRouteWP); |
Line 3784... | Line 3792... | ||
3784 | 3792 | ||
Line 3804... | Line 3812... | ||
3804 | row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpEdit); |
3812 | row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpEdit); |
3805 | row.Background = new SolidColorBrush(Colors.Transparent); |
3813 | row.Background = new SolidColorBrush(Colors.Transparent); |
3806 | row.BorderBrush = new SolidColorBrush(Colors.Transparent); |
3814 | row.BorderBrush = new SolidColorBrush(Colors.Transparent); |
3807 | row.BorderThickness = new Thickness(0); |
3815 | row.BorderThickness = new Thickness(0); |
3808 | } |
3816 | } |
3809 | if ((int)dtWaypoints.Rows[index][1] == 0) |
3817 | if ((int)dtWaypoints.Rows[index][1] == 0 || (int)dtWaypoints.Rows[index][1] == 3) |
3810 | wpList.Remove(new PointLatLng((double)dtWaypoints.Rows[index][3], (double)dtWaypoints.Rows[index][4])); |
3818 | wpList.Remove(new PointLatLng((double)dtWaypoints.Rows[index][3], (double)dtWaypoints.Rows[index][4])); |
3811 | _clearWPMarker((string)dtWaypoints.Rows[index][2]); |
3819 | _clearWPMarker((string)dtWaypoints.Rows[index][2]); |
3812 | if (wpActiveMarker != null) |
3820 | if (wpActiveMarker != null) |
3813 | MainMap.Markers.Remove(wpActiveMarker); |
3821 | MainMap.Markers.Remove(wpActiveMarker); |
3814 | dtWaypoints.Rows[index].Delete(); |
3822 | dtWaypoints.Rows[index].Delete(); |
Line 3961... | Line 3969... | ||
3961 | // tbWPEditHeading.IsReadOnly = false; |
3969 | // tbWPEditHeading.IsReadOnly = false; |
Line 3962... | Line 3970... | ||
3962 | 3970 | ||
3963 | // cbWPEditSpeed.SelectedIndex = 1; |
3971 | // cbWPEditSpeed.SelectedIndex = 1; |
3964 | // tbWPEditSpeed.Text = "5.0"; |
3972 | // tbWPEditSpeed.Text = "5.0"; |
3965 | // tbWPEditSpeed.IsReadOnly = false; |
3973 | // tbWPEditSpeed.IsReadOnly = false; |
Line 3966... | Line 3974... | ||
3966 | o[7] = "50"; |
3974 | o[7] = "10"; |
3967 | 3975 | ||
3968 | // cbWPEditClimbrate.SelectedIndex = 1; |
3976 | // cbWPEditClimbrate.SelectedIndex = 1; |
3969 | // tbWPEditClimbrate.Text = "5.0"; |
3977 | // tbWPEditClimbrate.Text = "5.0"; |
Line 3970... | Line 3978... | ||
3970 | // tbWPEditClimbrate.IsReadOnly = false; |
3978 | // tbWPEditClimbrate.IsReadOnly = false; |
3971 | o[8] = "50"; |
3979 | o[8] = "10"; |
3972 | 3980 | ||
3973 | // tbWPEditRadius.Text = "10"; |
3981 | // tbWPEditRadius.Text = "10"; |
3974 | o[9] = "10"; |
3982 | o[9] = "5"; |
3975 | // tbWPEditHoldtime.Text = "5"; |
3983 | // tbWPEditHoldtime.Text = "5"; |
3976 | o[10] = "5"; |
3984 | o[10] = "5"; |
Line 4068... | Line 4076... | ||
4068 | myXmlTextWriter.Close(); |
4076 | myXmlTextWriter.Close(); |
4069 | } |
4077 | } |
4070 | } |
4078 | } |
4071 | } |
4079 | } |
Line 4072... | Line -... | ||
4072 | - | ||
4073 | 4080 | ||
4074 | private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e) |
4081 | private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e) |
4075 | { |
4082 | { |
4076 | _loadGPXLog(); |
4083 | _loadGPXLog(); |
4077 | } |
4084 | } |