public MapControl() { renderCanvas = new Canvas { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, Background = new SolidColorBrush(Colors.Transparent), }; Children.Add(RenderCanvas); bboxRect = new Rectangle { Fill = new SolidColorBrush(Colors.Red), Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 3, RadiusX = 0.5, RadiusY = 0.5, StrokeDashArray = new DoubleCollection { 3.0 }, Opacity = 0.3, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left, Visibility = Visibility.Collapsed }; Children.Add(bboxRect); Map = new Map(); MouseInfoOverLayers = new List<ILayer>(); MouseInfoDownLayers = new List<ILayer>(); Loaded += MapControlLoaded; KeyDown += MapControlKeyDown; KeyUp += MapControlKeyUp; MouseLeftButtonDown += MapControlMouseLeftButtonDown; MouseLeftButtonUp += MapControlMouseLeftButtonUp; #if (!WINDOWS_PHONE) //turn off mouse controls MouseMove += MapControlMouseMove; MouseLeave += MapControlMouseLeave; MouseWheel += MapControlMouseWheel; #endif SizeChanged += MapControlSizeChanged; CompositionTarget.Rendering += CompositionTargetRendering; Renderer = new MapRenderer(RenderCanvas); #if (!SILVERLIGHT && !WINDOWS_PHONE) Dispatcher.ShutdownStarted += DispatcherShutdownStarted; RenderCanvas.IsManipulationEnabled = true; RenderCanvas.ManipulationDelta += OnManipulationDelta; RenderCanvas.ManipulationCompleted += OnManipulationCompleted; RenderCanvas.ManipulationInertiaStarting += OnManipulationInertiaStarting; #endif #if (WINDOWS_PHONE) RenderCanvas.ManipulationDelta += WP_OnManipulationDelta; RenderCanvas.ManipulationCompleted += WP_OnManipulationCompleted; RenderCanvas.ManipulationStarted += WP_OnManipulationStarted; #endif }
public MapControl() { InitializeComponent(); Map = new Map(); //this.viewport.Resolution = 19; #if DEBUG ShowStatistics = true; #else ShowStatistics = false; #endif MouseInfoOverLayers = new List<ILayer>(); MouseInfoDownLayers = new List<ILayer>(); Loaded += MapControl_Loaded; KeyDown += MapControl_KeyDown; KeyUp += MapControl_KeyUp; MouseLeftButtonDown += MapControl_MouseLeftButtonDown; MouseLeftButtonUp += MapControl_MouseLeftButtonUp; MouseMove += MapControl_MouseMove; MouseLeave += MapControl_MouseLeave; MouseWheel += MapControl_MouseWheel; SizeChanged += MapControlSizeChanged; CompositionTarget.Rendering += CompositionTarget_Rendering; renderer = new MapRenderer(); canvas.Children.Add(renderCanvas); #if !SILVERLIGHT Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; #endif fps.SetBinding(TextBlock.TextProperty, new Binding("Fps")); fps.DataContext = FpsCounter; }