Version 5.0: Reworked MapBase and MapPath

This commit is contained in:
ClemensF 2020-03-28 21:53:38 +01:00
parent 06fd31c17b
commit 49e15ce424
41 changed files with 466 additions and 1068 deletions

View file

@ -56,7 +56,7 @@ namespace MapControl
private void DrawCylindricalGraticule(DrawingContext drawingContext, double lineDistance, string labelFormat)
{
var boundingBox = ParentMap.ViewportRectToBoundingBox(new Rect(ParentMap.RenderSize));
var boundingBox = ParentMap.ViewRectToBoundingBox(new Rect(ParentMap.RenderSize));
var latLabelStart = Math.Ceiling(boundingBox.South / lineDistance) * lineDistance;
var lonLabelStart = Math.Ceiling(boundingBox.West / lineDistance) * lineDistance;
var latLabels = new List<Label>((int)((boundingBox.North - latLabelStart) / lineDistance) + 1);
@ -72,8 +72,8 @@ namespace MapControl
CultureInfo.InvariantCulture, FlowDirection.LeftToRight, typeface, FontSize, Foreground, pixelsPerDip)));
drawingContext.DrawLine(pen,
ParentMap.LocationToViewportPoint(new Location(lat, boundingBox.West)),
ParentMap.LocationToViewportPoint(new Location(lat, boundingBox.East)));
ParentMap.LocationToView(new Location(lat, boundingBox.West)),
ParentMap.LocationToView(new Location(lat, boundingBox.East)));
}
for (var lon = lonLabelStart; lon <= boundingBox.East; lon += lineDistance)
@ -83,17 +83,17 @@ namespace MapControl
CultureInfo.InvariantCulture, FlowDirection.LeftToRight, typeface, FontSize, Foreground, pixelsPerDip)));
drawingContext.DrawLine(pen,
ParentMap.LocationToViewportPoint(new Location(boundingBox.South, lon)),
ParentMap.LocationToViewportPoint(new Location(boundingBox.North, lon)));
ParentMap.LocationToView(new Location(boundingBox.South, lon)),
ParentMap.LocationToView(new Location(boundingBox.North, lon)));
}
foreach (var latLabel in latLabels)
{
foreach (var lonLabel in lonLabels)
{
var position = ParentMap.LocationToViewportPoint(new Location(latLabel.Position, lonLabel.Position));
var position = ParentMap.LocationToView(new Location(latLabel.Position, lonLabel.Position));
drawingContext.PushTransform(new RotateTransform(ParentMap.Heading, position.X, position.Y));
drawingContext.PushTransform(new RotateTransform(ParentMap.ViewTransform.Rotation, position.X, position.Y));
drawingContext.DrawText(latLabel.Text,
new Point(position.X + StrokeThickness / 2d + 2d, position.Y - StrokeThickness / 2d - latLabel.Text.Height));
drawingContext.DrawText(lonLabel.Text,