Rev 2368 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2368 | Rev 2369 | ||
---|---|---|---|
Line 727... | Line 727... | ||
727 | else |
727 | else |
728 | k++; |
728 | k++; |
729 | } |
729 | } |
Line 730... | Line 730... | ||
730 | 730 | ||
- | 731 | } |
|
731 | } |
732 | |
732 | void _clearWPMarker(String text) |
733 | GMapMarker _findWPMarker(string name) |
733 | { |
734 | { |
734 | for (int k = 0; k < MainMap.Markers.Count;) |
735 | for (int k = 0; k < MainMap.Markers.Count;) |
735 | { |
736 | { |
736 | GMapMarker p = MainMap.Markers[k]; |
737 | GMapMarker p = MainMap.Markers[k]; |
737 | if (p.GetType() == typeof(CustomMarkerWP) | (p.Shape != null && p.Shape.GetType() == typeof(CustomMarkerWP))) |
738 | if (p.GetType() == typeof(CustomMarkerWP) | (p.Shape != null && p.Shape.GetType() == typeof(CustomMarkerWP))) |
738 | if (((CustomMarkerWP)p.Shape).WPText == text) |
739 | if (((CustomMarkerWP)p.Shape).WPText == name) |
739 | { MainMap.Markers.Remove(p); break; } |
740 | return p; |
740 | else |
741 | else |
741 | k++; |
742 | k++; |
742 | else |
743 | else |
743 | k++; |
744 | k++; |
- | 745 | } |
|
- | 746 | return null; |
|
- | 747 | } |
|
- | 748 | void _clearWPMarker(string name) |
|
- | 749 | { |
|
- | 750 | GMapMarker p = _findWPMarker(name); |
|
- | 751 | if(p != null) |
|
744 | } |
752 | MainMap.Markers.Remove(p); |
745 | } |
753 | } |
746 | void _renameWPMarker(string s1, string s2) |
754 | void _renameWPMarker(string s1, string s2) |
747 | { |
755 | { |
748 | for (int k = 0; k < MainMap.Markers.Count;) |
756 | GMapMarker p = _findWPMarker(s1); |
749 | { |
- | |
750 | GMapMarker p = MainMap.Markers[k]; |
- | |
751 | if (p.GetType() == typeof(CustomMarkerWP) | (p.Shape != null && p.Shape.GetType() == typeof(CustomMarkerWP))) |
757 | if (p != null) |
- | 758 | ((CustomMarkerWP)p.Shape).WPText = s2; |
|
752 | if (((CustomMarkerWP)p.Shape).WPText == s1) |
759 | } |
753 | { ((CustomMarkerWP)p.Shape).WPText = s2; break; } |
760 | void _repositionWPMarker(PointLatLng point, string name) |
754 | else |
761 | { |
755 | k++; |
762 | GMapMarker p = _findWPMarker(name); |
756 | else |
763 | if (p != null) |
757 | k++; |
- | |
758 | } |
764 | p.Position = point; |
- | 765 | } |
|
759 | } |
766 | |
760 | // access mode |
767 | // access mode |
761 | private void comboBoxMode_DropDownClosed(object sender, EventArgs e) |
768 | private void comboBoxMode_DropDownClosed(object sender, EventArgs e) |
762 | { |
769 | { |
763 | MainMap.Manager.Mode = (AccessMode)comboBoxMode.SelectedItem; |
770 | MainMap.Manager.Mode = (AccessMode)comboBoxMode.SelectedItem; |
Line 3382... | Line 3389... | ||
3382 | wpList.Add(p); |
3389 | wpList.Add(p); |
3383 | return wpMarker; |
3390 | return wpMarker; |
3384 | } |
3391 | } |
3385 | void _setMarkerColor(GMapMarker wpMarker,int iType) |
3392 | void _setMarkerColor(GMapMarker wpMarker,int iType) |
3386 | { |
3393 | { |
- | 3394 | if(wpMarker != null) |
|
3387 | Dispatcher.Invoke(() => |
3395 | Dispatcher.Invoke(() => |
3388 | { |
3396 | { |
3389 | switch (iType) |
3397 | switch (iType) |
3390 | { |
3398 | { |
3391 | case 0: |
3399 | case 0: |
Line 3705... | Line 3713... | ||
3705 | 3713 | ||
3706 | private void btnEditWPSave_Click(object sender, RoutedEventArgs e) |
3714 | private void btnEditWPSave_Click(object sender, RoutedEventArgs e) |
3707 | { |
3715 | { |
3708 | if(dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
3716 | if(dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
- | 3717 | { |
|
- | 3718 | string oldName = (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]; |
|
3709 | { |
3719 | int i = wpList.IndexOf(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4])); |
3710 | dtWaypoints.Rows[dgvWP.SelectedIndex][1] = cbWPEditType.SelectedIndex; |
3720 | dtWaypoints.Rows[dgvWP.SelectedIndex][1] = cbWPEditType.SelectedIndex; |
3711 | dtWaypoints.Rows[dgvWP.SelectedIndex][2] = tbWPEditPrefix.Text + (dgvWP.SelectedIndex + 1).ToString(); |
3721 | dtWaypoints.Rows[dgvWP.SelectedIndex][2] = tbWPEditPrefix.Text + (dgvWP.SelectedIndex + 1).ToString(); |
3712 | dtWaypoints.Rows[dgvWP.SelectedIndex][3] = Convert.ToDouble(tbWPEditLat.Text.Replace('.', ',')); |
3722 | 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('.', ',')); |
3724 | wpList[i] = (new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4])); |
3714 | dtWaypoints.Rows[dgvWP.SelectedIndex][5] = tbWPEditAlt.Text; |
3725 | dtWaypoints.Rows[dgvWP.SelectedIndex][5] = tbWPEditAlt.Text; |
3715 | switch (cbWPEditHeading.SelectedIndex) |
3726 | switch (cbWPEditHeading.SelectedIndex) |
3716 | { |
3727 | { |
3717 | case 0: |
3728 | case 0: |
Line 3760... | Line 3771... | ||
3760 | dtWaypoints.Rows[dgvWP.SelectedIndex][12] = tbWPEditCamAngle.Text; |
3771 | dtWaypoints.Rows[dgvWP.SelectedIndex][12] = tbWPEditCamAngle.Text; |
3761 | break; |
3772 | break; |
3762 | } |
3773 | } |
3763 | dtWaypoints.Rows[dgvWP.SelectedIndex][14] = tbWPEditOut1.Text; |
3774 | dtWaypoints.Rows[dgvWP.SelectedIndex][14] = tbWPEditOut1.Text; |
Line 3764... | Line 3775... | ||
3764 | 3775 | ||
- | 3776 | // _clearMapMarkers(typeof(CustomMarkerWP)); |
|
- | 3777 | _repositionWPMarker(new PointLatLng((double)dtWaypoints.Rows[dgvWP.SelectedIndex][3], (double)dtWaypoints.Rows[dgvWP.SelectedIndex][4]),oldName); |
|
3765 | _clearMapMarkers(typeof(CustomMarkerWP)); |
3778 | _renameWPMarker(oldName, (string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]); |
- | 3779 | _clearMapMarkers(typeof(CustomMarkerWPActive)); |
|
3766 | _clearMapMarkers(typeof(CustomMarkerWPActive)); |
3780 | _setMarkerColor(_findWPMarker((string)dtWaypoints.Rows[dgvWP.SelectedIndex][2]), (int)dtWaypoints.Rows[dgvWP.SelectedIndex][1]); |
3767 | wpList.Clear(); |
3781 | // wpList.Clear(); |
3768 | if (mRouteWP != null) |
3782 | if (mRouteWP != null) |
Line 3769... | Line 3783... | ||
3769 | MainMap.Markers.Remove(mRouteWP); |
3783 | MainMap.Markers.Remove(mRouteWP); |
3770 | 3784 | ||
3771 | for (int k = 0; k < dtWaypoints.Rows.Count; k++) |
3785 | //for (int k = 0; k < dtWaypoints.Rows.Count; k++) |
3772 | { |
3786 | //{ |
3773 | _createWP(new PointLatLng((double)dtWaypoints.Rows[k][3], (double)dtWaypoints.Rows[k][4]), (string)dtWaypoints.Rows[k][2], (int)dtWaypoints.Rows[k][1]); |
3787 | // _createWP(new PointLatLng((double)dtWaypoints.Rows[k][3], (double)dtWaypoints.Rows[k][4]), (string)dtWaypoints.Rows[k][2], (int)dtWaypoints.Rows[k][1]); |
3774 | } |
3788 | //} |
Line 3775... | Line 3789... | ||
3775 | _routeUpdate(); |
3789 | _routeUpdate(); |
Line 3793... | Line 3807... | ||
3793 | row.BorderThickness = new Thickness(0); |
3807 | row.BorderThickness = new Thickness(0); |
3794 | } |
3808 | } |
3795 | if ((int)dtWaypoints.Rows[index][1] == 0) |
3809 | if ((int)dtWaypoints.Rows[index][1] == 0) |
3796 | wpList.Remove(new PointLatLng((double)dtWaypoints.Rows[index][3], (double)dtWaypoints.Rows[index][4])); |
3810 | wpList.Remove(new PointLatLng((double)dtWaypoints.Rows[index][3], (double)dtWaypoints.Rows[index][4])); |
3797 | _clearWPMarker((string)dtWaypoints.Rows[index][2]); |
3811 | _clearWPMarker((string)dtWaypoints.Rows[index][2]); |
- | 3812 | if (wpActiveMarker != null) |
|
- | 3813 | MainMap.Markers.Remove(wpActiveMarker); |
|
3798 | dtWaypoints.Rows[index].Delete(); |
3814 | dtWaypoints.Rows[index].Delete(); |
3799 | _wpIndex = -1; |
3815 | _wpIndex = -1; |
3800 | _wpEdit = -1; |
3816 | _wpEdit = -1; |
3801 | for (int i = index; i < dtWaypoints.Rows.Count; i++) //change the index of points behind deleted point + rename to new index |
3817 | for (int i = index; i < dtWaypoints.Rows.Count; i++) //change the index of points behind deleted point + rename to new index |
3802 | { |
3818 | { |
Line 3821... | Line 3837... | ||
3821 | } |
3837 | } |
3822 | private void tbWPEdit_KeyDown(object sender, KeyEventArgs e) |
3838 | private void tbWPEdit_KeyDown(object sender, KeyEventArgs e) |
3823 | { |
3839 | { |
3824 | _wpWEdit(sender); |
3840 | _wpWEdit(sender); |
3825 | } |
3841 | } |
- | 3842 | private void tbWPEdit_MouseDown(object sender, MouseButtonEventArgs e) |
|
- | 3843 | { |
|
- | 3844 | _wpWEdit(sender); |
|
- | 3845 | } |
|
3826 | void _wpWEdit(object sender) |
3846 | void _wpWEdit(object sender) |
3827 | { |
3847 | { |
3828 | if (!((TextBox)sender).IsReadOnly) |
3848 | // if (!((TextBox)sender).IsReadOnly) |
3829 | { |
3849 | { |
3830 | KeyPad.Keypad k = new KeyPad.Keypad(this); |
3850 | KeyPad.Keypad k = new KeyPad.Keypad(this); |
Line 3831... | Line 3851... | ||
3831 | 3851 | ||
3832 | switch (((TextBox)sender).Name) |
3852 | switch (((TextBox)sender).Name) |
Line 4048... | Line 4068... | ||
4048 | myXmlTextWriter.Close(); |
4068 | myXmlTextWriter.Close(); |
4049 | } |
4069 | } |
4050 | } |
4070 | } |
4051 | } |
4071 | } |
Line -... | Line 4072... | ||
- | 4072 | ||
4052 | 4073 | ||
4053 | private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e) |
4074 | private void btnLoadGPXLog_Click(object sender, RoutedEventArgs e) |
4054 | { |
4075 | { |
4055 | _loadGPXLog(); |
4076 | _loadGPXLog(); |
4056 | } |
4077 | } |