private void onWaypointConfirmed(PointDouble position) { Point wpfPoint = position.toWpfPoint(); wpfPoint.Y *= -1; dots.Children.Add(new EllipseGeometry(wpfPoint, thickness, thickness)); }
private void onPositionChanged(PointDouble position) { Point newPosition = position.toWpfPoint(); newPosition.Y *= -1; //map coordinates use up is positive Y, but WPF uses down is positive Y, so flip the sign when converting currentPositionDot.Center = newPosition; if (!points.Points.Any()) { pathFigure.StartPoint = newPosition; } points.Points.Add(newPosition); if (hasCoordinates) { minCoordinates.X = Math.Min(minCoordinates.X, newPosition.X); minCoordinates.Y = Math.Min(minCoordinates.Y, newPosition.Y); maxCoordinates.X = Math.Max(maxCoordinates.X, newPosition.X); maxCoordinates.Y = Math.Max(maxCoordinates.Y, newPosition.Y); } else { minCoordinates = newPosition; maxCoordinates = newPosition; hasCoordinates = true; } thickness = Math.Max(0.1, Math.Max(maxCoordinates.X - minCoordinates.X, maxCoordinates.Y - minCoordinates.Y)) / Math.Max(Width, Height) * 6; Trace.WriteLine("thickness = " + thickness); pen.Thickness = thickness; foreach (Geometry geometry in dots.Children) { if (geometry == currentPositionDot) { currentPositionDot.RadiusX = thickness * 3; currentPositionDot.RadiusY = thickness * 3; } else if (geometry is EllipseGeometry dot) { dot.RadiusX = thickness * 2.4; dot.RadiusY = thickness * 2.4; } } }