Exemple #1
0
        private static void Pan(object sender, ICommand command, double x, double y)
        {
            MapCanvas instance = (MapCanvas)sender;

            if (instance != null)
            {
                if (!instance.IsKeyboardCommand((RoutedCommand)command)) // Move a whole square instead of a pixel if it wasn't the keyboard who sent it
                {
                    x *= instance._mapControlFactory.TileGenerator.TileSize;
                    y *= instance._mapControlFactory.TileGenerator.TileSize;
                }
                instance._offsetX.AnimateTranslate(x);
                instance._offsetY.AnimateTranslate(y);
                instance.Focus();
            }
        }
Exemple #2
0
        private static object OnZoomPropertyCoerceValue(DependencyObject d, object baseValue)
        {
            MapCanvas        canvas = null;
            FrameworkElement child  = d as FrameworkElement;

            while (child != null)
            {
                canvas = child as MapCanvas;
                if (canvas != null)
                {
                    break;
                }
                child = child.Parent as FrameworkElement;
            }
            if (canvas != null)
            {
                return(canvas._mapControlFactory.TileGenerator.GetValidZoom((int)baseValue));
            }
            return(null);
        }
Exemple #3
0
        private static void OnLatitudeLongitudePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Search for a MapControl parent
            MapCanvas        canvas = null;
            FrameworkElement child  = d as FrameworkElement;

            while (child != null)
            {
                canvas = child as MapCanvas;
                if (canvas != null)
                {
                    break;
                }
                child = child.Parent as FrameworkElement;
            }
            if (canvas != null)
            {
                canvas.RepositionChildren();
            }
        }