|
@@ -1603,6 +1603,65 @@ public static class MapControlEx
|
|
|
return ctrl;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void DrawTrack<T>(this MapControl ctrl, IEnumerable<T> items) where T : PosData, new()
|
|
|
+ {
|
|
|
+ if (items == null || !items.Any()) return;
|
|
|
+ var innerData = ctrl.Tag as InnerData;
|
|
|
+ innerData.trackStorge.Items.Clear();
|
|
|
+ var posData = items.OrderBy(p => p.SigTime);
|
|
|
+ var itemList = posData.GroupBy(t => t.ColorKey);
|
|
|
+ List<MapPolyline> listLine = new List<MapPolyline>();
|
|
|
+ int w = 12;
|
|
|
+ int h = 20;
|
|
|
+ if (ctrl.ZoomLevel < 4)
|
|
|
+ {
|
|
|
+ w = 2;
|
|
|
+ h = 4;
|
|
|
+ }
|
|
|
+ else if (ctrl.ZoomLevel < 6)
|
|
|
+ {
|
|
|
+ w = 6;
|
|
|
+ h = 12;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ w = 10;
|
|
|
+ h = 20;
|
|
|
+ }
|
|
|
+ foreach (var groupItems in itemList)
|
|
|
+ {
|
|
|
+ var targets = groupItems.ToList();
|
|
|
+ var colorKey = targets.First().ColorKey;
|
|
|
+ for (int i = 0; i < targets.Count - 1; i++)
|
|
|
+ {
|
|
|
+ var line = new MapPolyline();
|
|
|
+ line.CanEdit = false;
|
|
|
+ line.CanMove = false;
|
|
|
+ line.CanResize = false;
|
|
|
+ line.CanRotate = false;
|
|
|
+ line.EnableSelection = DefaultBoolean.False;
|
|
|
+ line.EnableHighlighting = DefaultBoolean.False;
|
|
|
+ line.IsGeodesic = true;
|
|
|
+ line.Stroke = ColorHelper.IsHtmlColor(colorKey) ? ColorTranslator.FromHtml(colorKey) : ColorHelper.GetColor(colorKey);
|
|
|
+ line.EndLineCap.Width = w;
|
|
|
+ line.EndLineCap.Length = h;
|
|
|
+ line.EndLineCap.Visible = true;
|
|
|
+ line.EndLineCap.IsFilled = false;
|
|
|
+ line.StrokeWidth = 2;
|
|
|
+ //line.EndLineCap.Length = 100;
|
|
|
+ var p1 = new GeoPoint(targets[i].PosLat, targets[i].PosLon);
|
|
|
+ var p2 = new GeoPoint(targets[i + 1].PosLat, targets[i + 1].PosLon);
|
|
|
+ line.Points.Add(p1);
|
|
|
+ line.Points.Add(p2);
|
|
|
+ listLine.Add(line);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ innerData.trackStorge.Items.AddRange(listLine);
|
|
|
+
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 绘制矩形
|
|
|
/// </summary>
|
|
@@ -2377,57 +2436,8 @@ public static class MapControlEx
|
|
|
{
|
|
|
var ctrl = e.Item.Tag as MapControl;
|
|
|
var innerData = ctrl.Tag as InnerData;
|
|
|
- innerData.trackStorge.Items.Clear();
|
|
|
var posData = innerData._dataCache.Keys.OrderBy(p => p.SigTime);
|
|
|
- var itemList = posData.GroupBy(t => t.ColorKey);
|
|
|
- List<MapPolyline> listLine = new List<MapPolyline>();
|
|
|
- int w = 12;
|
|
|
- int h = 20;
|
|
|
- if (ctrl.ZoomLevel < 4)
|
|
|
- {
|
|
|
- w = 2;
|
|
|
- h = 4;
|
|
|
- }
|
|
|
- else if (ctrl.ZoomLevel < 6)
|
|
|
- {
|
|
|
- w = 6;
|
|
|
- h = 12;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- w = 10;
|
|
|
- h = 20;
|
|
|
- }
|
|
|
- foreach (var groupItems in itemList)
|
|
|
- {
|
|
|
- var targets = groupItems.ToList();
|
|
|
- var colorKey = targets.First().ColorKey;
|
|
|
- for (int i = 0; i < targets.Count - 1; i++)
|
|
|
- {
|
|
|
- var line = new MapPolyline();
|
|
|
- line.CanEdit = false;
|
|
|
- line.CanMove = false;
|
|
|
- line.CanResize = false;
|
|
|
- line.CanRotate = false;
|
|
|
- line.EnableSelection = DefaultBoolean.False;
|
|
|
- line.EnableHighlighting = DefaultBoolean.False;
|
|
|
- line.IsGeodesic = true;
|
|
|
- line.Stroke = ColorHelper.IsHtmlColor(colorKey) ? ColorTranslator.FromHtml(colorKey) : ColorHelper.GetColor(colorKey);
|
|
|
- line.EndLineCap.Width = w;
|
|
|
- line.EndLineCap.Length = h;
|
|
|
- line.EndLineCap.Visible = true;
|
|
|
- line.EndLineCap.IsFilled = false;
|
|
|
- line.StrokeWidth = 2;
|
|
|
- //line.EndLineCap.Length = 100;
|
|
|
- var p1 = new GeoPoint(targets[i].PosLat, targets[i].PosLon);
|
|
|
- var p2 = new GeoPoint(targets[i + 1].PosLat, targets[i + 1].PosLon);
|
|
|
- line.Points.Add(p1);
|
|
|
- line.Points.Add(p2);
|
|
|
- listLine.Add(line);
|
|
|
- }
|
|
|
- }
|
|
|
- innerData.trackStorge.Items.AddRange(listLine);
|
|
|
-
|
|
|
+ ctrl.DrawTrack(posData.ToList());
|
|
|
}
|
|
|
private static void MarkDot_ItemClick(object sender, ItemClickEventArgs e)
|
|
|
{
|