private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; GeoImage image = new GeoImage(@"SampleData/bing-aerial-900913.png"); GeoSize size = image.GetSize(); GeoImageLayer geoImageLayer = new GeoImageLayer(image, new WorldFile(GeoCommonHelper.GetMaxBound(GeoUnit.Meter), (float)size.Width, (float)size.Height)); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(geoImageLayer); Map1.Overlays.Add(layerOverlay); Map1.ZoomToFullBound(); }
public static double GetRotatedAngle(double targetRotation, double currentRotation, double increment) { currentRotation = Math.Round(currentRotation, 0); if (targetRotation != currentRotation) { targetRotation = GeoCommonHelper.GetAngleInRange(targetRotation); currentRotation = GeoCommonHelper.GetAngleInRange(currentRotation); double rotationDiff = Math.Abs(targetRotation - currentRotation); if (rotationDiff < 180) { if (targetRotation > currentRotation) { currentRotation += increment; if (currentRotation > targetRotation) { currentRotation = targetRotation; } } else { currentRotation -= increment; if (currentRotation < targetRotation) { currentRotation = targetRotation; } } } else { if (targetRotation > currentRotation) { currentRotation -= increment; if (currentRotation < targetRotation - 360) { currentRotation = targetRotation; } } else { currentRotation += increment; if (currentRotation > targetRotation + 360) { currentRotation = targetRotation; } } } } return(currentRotation); }