Hi All,
it seem to me that WpfMap.ZoomToScale doesn't work well.
- I tried to Zoom In/out on screen point to some scales in ZoomLevelSet, but it works only when i have more detailed zoom.
- when i zoom the interaction effect is keeping mouse position - it shows zooming on mouse position but then it centers on the right position i entered, strange.
In attached example i try to ZoomIn, ZoomOut on specific point (red ellipse placed on the bottom of the map control).
public MainWindow()
{
InitializeComponent();
}
private void WpfMapLoaded(object sender, RoutedEventArgs e)
{
wpfMap1.MapUnit = ThinkGeo.MapSuite.Core.GeographyUnit.Meter;
var overlay = new OpenStreetMapOverlay();
overlay.TileType = TileType.SingleTile;
wpfMap1.Overlays.Add(overlay);
wpfMap1.Refresh();
}
private void ZoomInClick(object sender, RoutedEventArgs e)
{
Point pointCanvas = new Point((double)ellipse.GetValue(Canvas.LeftProperty), (double)ellipse.GetValue(Canvas.TopProperty));
Point pointMap = canvas.TranslatePoint(pointCanvas, wpfMap1);
ScreenPointF p = new ScreenPointF((float)pointMap.X, (float)pointMap.Y);
double targetScale = ZoomLevelSet.GetLowerZoomLevelScale(wpfMap1.CurrentScale, wpfMap1.ZoomLevelSet);
wpfMap1.ZoomToScale(targetScale, p);
}
private void ZoomOutClick(object sender, RoutedEventArgs e)
{
Point pointCanvas = new Point((double)ellipse.GetValue(Canvas.LeftProperty), (double)ellipse.GetValue(Canvas.TopProperty));
Point pointMap = canvas.TranslatePoint(pointCanvas, wpfMap1);
ScreenPointF p = new ScreenPointF((float)pointMap.X, (float)pointMap.Y);
double targetScale = ZoomLevelSet.GetHigherZoomLevelScale(wpfMap1.CurrentScale, wpfMap1.ZoomLevelSet);
wpfMap1.ZoomToScale(targetScale, p);
}
Please, what am i doing wrong?
Thank you Libor
TestZooming.zip (13.5 KB)