public Map(MapControl.Map passedMap, PolygonDrawer passedDrawer, Location center = null, double zoom = 14) { // Can't create a new map, so use the existing one WPFMap = passedMap; polygonDrawer = passedDrawer; WPFMap.ZoomLevel = zoom; WPFMap.MaxZoomLevel = 19; // Any closer and the map starts getting blurry // Setup easing function for centering and changing zoom level WPFMap.AnimationEasingFunction = new CubicEase(); WPFMap.AnimationEasingFunction.EasingMode = EasingMode.EaseInOut; // Default center is at MIF WPFMap.Center = center ?? new Location(54.675083, 25.273633); // Add OSM layer WPFMap.MapLayer = MapTileLayer.OpenStreetMapTileLayer; // Add map scale marker WPFMap.Children.Add(new MapScale { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom }); tempMarker = new Marker2(); tempMarker.MouseDown += new MouseButtonEventHandler(OnMarkerClick); searchRadius = new RadiusCircle(WPFMap.Center, 0.0); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 2: this.map = ((MapControl.Map)(target)); #line 64 "..\..\MainWindow.xaml" this.map.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.MapMouseLeftButtonDown); #line default #line hidden #line 64 "..\..\MainWindow.xaml" this.map.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.MapMouseRightButtonDown); #line default #line hidden #line 65 "..\..\MainWindow.xaml" this.map.MouseMove += new System.Windows.Input.MouseEventHandler(this.MapMouseMove); #line default #line hidden #line 65 "..\..\MainWindow.xaml" this.map.MouseLeave += new System.Windows.Input.MouseEventHandler(this.MapMouseLeave); #line default #line hidden #line 66 "..\..\MainWindow.xaml" this.map.ManipulationInertiaStarting += new System.EventHandler <System.Windows.Input.ManipulationInertiaStartingEventArgs>(this.MapManipulationInertiaStarting); #line default #line hidden return; case 3: this.mapImage = ((MapControl.MapImage)(target)); return; case 4: this.mouseLocation = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Maps.Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { nativeMap = null; } if (e.NewElement != null) { var formsMap = (CustomMap)e.NewElement; this.nativeMap = Control as MapControl.Map; this.customPins = formsMap.CustomPins; updateAllPins(); } }
// XamarinMapOverlay mapOverlay; // bool xamarinOverlayShown = false; protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Maps.Map> e) { base.OnElementChanged(e); if (e.OldElement != null) { // nativeMap.MapElementClick -= OnMapElementClick; // nativeMap.Children.Clear(); // mapOverlay = null; nativeMap = null; } if (e.NewElement != null) { var formsMap = (CustomMap)e.NewElement; // this.nativeMap = Control as Microsoft.Maps.MapControl.WPF.Map; this.nativeMap = Control as MapControl.Map; this.customPins = formsMap.CustomPins; updateAllPins(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 3: this.map = ((MapControl.Map)(target)); #line 132 "..\..\MainWindow.xaml" this.map.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.MapMouseLeftButtonDown); #line default #line hidden #line 133 "..\..\MainWindow.xaml" this.map.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.MapMouseRightButtonDown); #line default #line hidden #line 134 "..\..\MainWindow.xaml" this.map.MouseMove += new System.Windows.Input.MouseEventHandler(this.MapMouseMove); #line default #line hidden #line 134 "..\..\MainWindow.xaml" this.map.MouseLeave += new System.Windows.Input.MouseEventHandler(this.MapMouseLeave); #line default #line hidden #line 135 "..\..\MainWindow.xaml" this.map.ManipulationInertiaStarting += new System.EventHandler <System.Windows.Input.ManipulationInertiaStartingEventArgs>(this.MapManipulationInertiaStarting); #line default #line hidden return; case 4: this.mapImage = ((System.Windows.Controls.Image)(target)); return; case 5: this.mapGraticule = ((MapControl.MapGraticule)(target)); return; case 6: this.mouseLocation = ((System.Windows.Controls.TextBlock)(target)); return; case 7: #line 208 "..\..\MainWindow.xaml" ((System.Windows.Controls.CheckBox)(target)).Checked += new System.Windows.RoutedEventHandler(this.SeamarksChecked); #line default #line hidden #line 208 "..\..\MainWindow.xaml" ((System.Windows.Controls.CheckBox)(target)).Unchecked += new System.Windows.RoutedEventHandler(this.SeamarksUnchecked); #line default #line hidden return; case 8: this.projectionComboBox = ((System.Windows.Controls.ComboBox)(target)); return; } this._contentLoaded = true; }