Skip to content

Commit 4bdee98

Browse files
committed
【GPX工具箱】修复了在加载下一个gpx文件时,鼠标在图表上移动有概率报错的BUG;【GPX工具箱】支持了在图表中可以不绘制点,以提升流畅度;【地图画板】新增记忆图层列表分组类型
1 parent 76ab204 commit 4bdee98

11 files changed

+67
-22
lines changed

MapBoard.UI/Config.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,20 @@ public bool Gpx_RelativeHeight
173173
set => this.SetValueAndNotify(ref gpx_RelativeHeight, value, nameof(Gpx_RelativeHeight));
174174
}
175175

176+
private bool gpx_DrawPoints;
177+
public bool Gpx_DrawPoints
178+
{
179+
get => gpx_DrawPoints;
180+
set => this.SetValueAndNotify(ref gpx_DrawPoints, value, nameof(Gpx_DrawPoints));
181+
}
182+
183+
private int lastLayerListGroupType;
184+
public int LastLayerListGroupType
185+
{
186+
get => lastLayerListGroupType;
187+
set => this.SetValueAndNotify(ref lastLayerListGroupType, value, nameof(LastLayerListGroupType));
188+
}
189+
176190
public bool HideWatermark
177191
{
178192
get => hideWatermark;

MapBoard.UI/Mapping/GpxMapView.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,17 @@ private void TracksCollectionChanged(object sender, NotifyCollectionChangedEvent
4848
case NotifyCollectionChangedAction.Remove:
4949
foreach (TrackInfo item in e.OldItems)
5050
{
51-
//GraphicsOverlays.Remove(item.LineOverlay);
5251
foreach (var point in item.Track.Points)
5352
{
5453
gpxPointAndGraphics.Remove(point);
5554
}
5655
GraphicsOverlays.Remove(item.Overlay);
57-
//foreach (var point in item.Overlay.Graphics.Select(p=>gpxPointAndGraphics.GetKey(p)).ToArray())
58-
//{
59-
// gpxPointAndGraphics.Remove(point);
60-
//}
6156
}
6257
break;
6358

6459
case NotifyCollectionChangedAction.Reset:
6560
GraphicsOverlays.Clear();
6661
gpxPointAndGraphics.Clear();
67-
//pointToTrackInfo.Clear();
6862
break;
6963
}
7064
}
@@ -223,6 +217,10 @@ public void SelectPointTo(GpxPoint point)
223217
}
224218

225219
int index = track.Track.Points.IndexOf(point);
220+
if (index < 0)
221+
{
222+
return;
223+
}
226224
for (int i = 1; i < index; i++)
227225
{
228226
var p = track.Track.Points[i];

MapBoard.UI/UI/Dialog/FeatureHistoryDialog.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
xmlns:cvt="clr-namespace:MapBoard.UI.Converter"
77
xmlns:cvt2="clr-namespace:FzLib.WPF.Converters;assembly=FzCoreLib.Windows"
88
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
9-
109
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1110
xmlns:system="clr-namespace:System;assembly=mscorlib"
1211
xmlns:ui="http://schemas.modernwpf.com/2019"

MapBoard.UI/UI/Dialog/FeatureHistoryDialog.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ private async void UndoButton_Click(object sender, RoutedEventArgs e)
121121
}
122122
catch (Exception ex)
123123
{
124+
IsEnabled = true;
124125
await CommonDialog.ShowErrorDialogAsync(ex, "撤销失败");
125126
}
126127
finally

MapBoard.UI/UI/Dialog/SettingDialog.xaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
<RowDefinition Height="12" />
3030
<RowDefinition Height="Auto" />
3131
</Grid.RowDefinitions>
32-
<TabControl Style="{StaticResource TabControlPivotStyle}">
32+
<TabControl
33+
x:Name="tab"
34+
Style="{StaticResource TabControlPivotStyle}">
3335
<TabItem
3436
Padding="8"
3537
Header="通用">
@@ -41,7 +43,6 @@
4143
<ComboBoxItem>亮色</ComboBoxItem>
4244
<ComboBoxItem>暗色</ComboBoxItem>
4345
</ComboBox>
44-
4546
</ui:SimpleStackPanel>
4647
</TabItem>
4748
<TabItem
@@ -327,6 +328,18 @@
327328
Text="{Binding Config.Gpx_AutoSmoothLevel}" />
328329
</ui:SimpleStackPanel>
329330
</ui:SimpleStackPanel>
331+
<ui:SimpleStackPanel
332+
Orientation="Horizontal"
333+
Spacing="12">
334+
<CheckBox
335+
Content="在图表中绘制速度点"
336+
IsChecked="{Binding Config.Gpx_DrawPoints}" />
337+
<TextBlock
338+
VerticalAlignment="Center"
339+
Opacity="0.7">
340+
在数据量很大的情况下,绘制点将明显影响程序流畅度
341+
</TextBlock>
342+
</ui:SimpleStackPanel>
330343
</ui:SimpleStackPanel>
331344
</TabItem>
332345
</TabControl>

MapBoard.UI/UI/Dialog/SettingDialog.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace MapBoard.UI.Dialog
3030
/// </summary>
3131
public partial class SettingDialog : DialogWindowBase
3232
{
33-
public SettingDialog(Window owner, MapLayerCollection layers) : base(owner)
33+
public SettingDialog(Window owner, MapLayerCollection layers, int tabIndex = 0) : base(owner)
3434
{
3535
BaseLayers = new ObservableCollection<BaseLayerInfo>(
3636
Config.Instance.BaseLayers.Select(p => p.Clone()));
@@ -39,6 +39,7 @@ public SettingDialog(Window owner, MapLayerCollection layers) : base(owner)
3939
InitializeComponent();
4040
cbbCoords.ItemsSource = Enum.GetValues(typeof(CoordinateSystem)).Cast<CoordinateSystem>();
4141
Layers = layers;
42+
tab.SelectedIndex = tabIndex;
4243
}
4344

4445
private void Window_Loaded(object sender, RoutedEventArgs e)

MapBoard.UI/UI/GpxToolbox/GpxWindow.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,12 @@ await Task.WhenAll(
268268
XAxisBorderValueConverter = p => p.CenterTime,
269269
YAxisBorderValueConverter = p => p.Speed,
270270
}));
271+
271272
await Task.WhenAll(
272273
chartHelper.DrawPolygonAsync(GpxTrack.Points, 1),
273-
chartHelper.DrawPointsAsync(points, 0),
274+
chartHelper.DrawPointsAsync(points, 0, Config.Instance.Gpx_DrawPoints),
274275
chartHelper.DrawLinesAsync(lines, 0));
276+
275277
await chartHelper.StretchToFitAsync();
276278
}
277279
catch (Exception ex)

MapBoard.UI/UI/GpxToolbox/TimeBasedChartHelper.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,14 @@ private async void SketchpadPreviewMouseMove(object sender, MouseEventArgs e)
134134
|| displayedPointsX.Count == 0)
135135
{
136136
return;
137-
}
137+
}
138+
canMouseMoveUpdate = false;
138139
var pos = e.GetPosition(Sketchpad);
139140
EllipseGeometry point = GetPoint(pos.X);
140141
RefreshMouseLine(point);
141142
RefreshToolTip(point, pos.X, pos.Y);
142143
MouseOverPoint?.Invoke(this, new MouseOverPointChangedEventArgs(e, UiPoint2Point[point]));
143-
canMouseMoveUpdate = false;
144+
144145
await Task.Delay(100);
145146
canMouseMoveUpdate = true;
146147
}
@@ -237,7 +238,7 @@ private void RefreshToolTip(EllipseGeometry point, double x, double y)
237238

238239
public Func<Task> DrawActionAsync { private get; set; }
239240

240-
public async Task DrawPointsAsync(IEnumerable<TPoint> items, int borderIndex)
241+
public async Task DrawPointsAsync(IEnumerable<TPoint> items, int borderIndex,bool draw)
241242
{
242243
BorderInfo border = borders[borderIndex];
243244
await Task.Run(() =>
@@ -254,14 +255,17 @@ await Task.Run(() =>
254255
AddPoint(x, y, item);
255256
}
256257
});
257-
Path path = new Path()
258+
if (draw)
258259
{
259-
Data = new GeometryGroup() { Children = new GeometryCollection(UiPoint2Point.Keys) },
260-
StrokeThickness = PointSize,
261-
Stroke = PointBrush,
262-
};
260+
Path path = new Path()
261+
{
262+
Data = new GeometryGroup() { Children = new GeometryCollection(UiPoint2Point.Keys) },
263+
StrokeThickness = PointSize,
264+
Stroke = PointBrush,
265+
};
263266

264267
AddSketchpadChildren(path, 3);
268+
}
265269
// lastAction = nameof(DrawPoints);
266270
// lastPointPoints = items;
267271
}
@@ -536,7 +540,7 @@ await Task.Run(() =>
536540
public Brush LineBrush { get; set; } = Brushes.Blue;
537541
public Brush PolygonBrush { get; set; } = new SolidColorBrush(Color.FromArgb(0x33, 0x55, 0x55, 0x55));
538542
public double LineThickness { get; set; } = 1;
539-
public double PointSize { get; set; } = 3;
543+
public double PointSize { get; set; } = 1;
540544
public bool MouseLineEnable { get; set; } = true;
541545
public bool ToolTipEnable { get; set; } = true;
542546
public Func<TPoint, string> ToolTipConverter { get; set; } = p => p.ToString();

MapBoard.UI/UI/LayerListPanel.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public int ViewType
102102
{
103103
viewType = value;
104104
this.Notify(nameof(ViewType));
105+
Config.Instance.LastLayerListGroupType = value;
105106
dataGrid.GroupStyle.Clear();
106107

107108
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(dataGrid.ItemsSource);
@@ -365,6 +366,10 @@ private void TextBlock_MouseUp(object sender, MouseButtonEventArgs e)
365366

366367
private void LayerListPanel_Loaded(object sender, RoutedEventArgs e)
367368
{
369+
if (Config.Instance.LastLayerListGroupType is >= 0 and < 3)
370+
{
371+
ViewType = Config.Instance.LastLayerListGroupType;
372+
}
368373
Window.GetWindow(this).SizeChanged += (s, e) => UpdateLayout(e.NewSize.Height);
369374
UpdateLayout(Window.GetWindow(this).ActualHeight);
370375
}

MapBoard.UI/UI/MapViewSidePanel.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ private async Task OpenOrCloseLayersPanelAsync(bool open)
344344
private void OpenSettingDialogButton_Click(object sender, RoutedEventArgs e)
345345
{
346346
OpenOrCloseLayersPanelAsync(false);
347-
new SettingDialog(Window.GetWindow(this), (MapView as IMapBoardGeoView).Layers).ShowDialog();
347+
new SettingDialog(Window.GetWindow(this), (MapView as IMapBoardGeoView).Layers, 1).ShowDialog();
348348
}
349349

350350
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)

日志.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,4 +1572,12 @@ Url DataGrid修改为ListBox+文本框,方便修改
15721572

15731573
## 20210801
15741574

1575-
【地图画板】新增图层列表分组视图
1575+
【地图画板】新增图层列表分组视图
1576+
1577+
## 20210809
1578+
1579+
【GPX工具箱】修复了在加载下一个gpx文件时,鼠标在图表上移动有概率报错的BUG
1580+
1581+
【GPX工具箱】支持了在图表中可以不绘制点,以提升流畅度
1582+
1583+
【地图画板】新增记忆图层列表分组类型

0 commit comments

Comments
 (0)