private void AddSwathToMap(MyPoint3D p1, MyPoint3D p2, double width) { VM.PolygonVM polygon = new VM.PolygonVM(); polygon.Fill = new SolidColorBrush(Colors.Blue); polygon.Fill.Opacity = 0.3; polygon.Locations = new LocationCollection(); MyPoint3D n = (p2 - p1).Normalize(); MyPoint3D np = new MyPoint3D(n.Y, -n.X, 0); polygon.Locations.Add((p1 + (np * (width / 2))).ToGeo().ToLocation()); polygon.Locations.Add((p2 + (np * (width / 2))).ToGeo().ToLocation()); polygon.Locations.Add((p2 - (np * (width / 2))).ToGeo().ToLocation()); polygon.Locations.Add((p1 - (np * (width / 2))).ToGeo().ToLocation()); Swathes.Add(polygon); }
private void AddOuterSwathToMap(List <MyPoint3D> boundary, List <MyPoint3D> innerBoundary) { VM.PolygonVM polygon = new VM.PolygonVM(); polygon.Fill = new SolidColorBrush(Colors.Blue); polygon.Fill.Opacity = 0.3; polygon.Locations = new LocationCollection(); foreach (var p in boundary) { polygon.Locations.Add(p.ToGeo().ToLocation()); } polygon.Locations.Add(polygon.Locations.First()); polygon.Locations.Add(innerBoundary.First().ToGeo().ToLocation()); for (int i = innerBoundary.Count - 1; i >= 0; i--) { polygon.Locations.Add(innerBoundary[i].ToGeo().ToLocation()); } Swathes.Add(polygon); }