private void MapView_ViewportChanged(object sender, EventArgs e) { var zl = (int)Math.Floor(this.ZoomLevel); if (zl != this.discreteZoomLevel) { this.discreteZoomLevel = zl; this.RaiseZoomLevelChanged(this.discreteZoomLevel); } var rect = new LocationRect { NorthWest = Common.Utils.Mid(this.Center, this.Bounds.NorthWest), SouthEast = Common.Utils.Mid(this.Center, this.Bounds.SouthEast) }; if (this.previousCenter == null) { this.previousCenter = this.Center; } if (!rect.Contains(this.previousCenter)) { this.previousCenter = this.Center; this.RaiseViewportMoved(this.previousCenter); } }
public void ShouldContainsZeroLatitudeLongitudeInZeroLocationRect() { // Arrange var locationRect = new LocationRect(0,0,0,0); // Act var isContained = locationRect.Contains(new Position(0, 0)); // Assert isContained.Should().BeTrue(); }
public void BackgroundItemsRequest(object sender, BackgroundItemsRequestEventArgs e) { LocationRect currentRegion = new LocationRect(e.UpperLeft, e.LowerRight); List <object> visibleItems = new List <object>(); if (currentRegion.Contains(bulgariaLocation)) { if (e.MinZoom == 3) { visibleItems.Add(this.BulgariaEllipse); } else if (e.MinZoom == 6) { visibleItems.Add(this.SofiaEllipse); } } e.CompleteItemsRequest(visibleItems); }
public void ItemsRequest(object sender, ItemsRequestEventArgs e) { List <object> items = new List <object>(); double minZoom = e.MinZoom; Location upperLeft = e.UpperLeft; Location lowerRight = e.LowerRight; HotSpot centerSpot = new HotSpot(); centerSpot.X = 0.5; centerSpot.Y = 0.5; Location bulgariaLocation = new Location(42.7669999748468, 25.2819999307394); LocationRect currentRegion = new LocationRect(upperLeft, lowerRight); if (currentRegion.Contains(bulgariaLocation)) { if (minZoom == 3) { Ellipse ellipse = new Ellipse(); ellipse.Width = 15; ellipse.Height = 15; ellipse.Fill = new SolidColorBrush(Colors.Red); ellipse.SetValue(MapLayer.LocationProperty, bulgariaLocation); MapLayer.SetHotSpot(ellipse, centerSpot); ToolTipService.SetToolTip(ellipse, "Bulgaria"); items.Add(ellipse); } else if (minZoom == 6) { Ellipse sofiaEllipse = new Ellipse(); sofiaEllipse.Width = 20; sofiaEllipse.Height = 20; sofiaEllipse.Stroke = new SolidColorBrush(Colors.Red); sofiaEllipse.Fill = new SolidColorBrush(Colors.Transparent); sofiaEllipse.StrokeThickness = 3; sofiaEllipse.SetValue(MapLayer.LocationProperty, new Location(42.6957539183824, 23.3327663758679)); MapLayer.SetHotSpot(sofiaEllipse, centerSpot); ToolTipService.SetToolTip(sofiaEllipse, "Sofia"); items.Add(sofiaEllipse); } } e.CompleteItemsRequest(items); }
public void ItemsRequest(object sender, ItemsRequestEventArgs e) { List<object> items = new List<object>(); double minZoom = e.MinZoom; Location upperLeft = e.UpperLeft; Location lowerRight = e.LowerRight; HotSpot centerSpot = new HotSpot(); centerSpot.X = 0.5; centerSpot.Y = 0.5; Location bulgariaLocation = new Location(42.7669999748468, 25.2819999307394); LocationRect currentRegion = new LocationRect(upperLeft, lowerRight); if (currentRegion.Contains(bulgariaLocation)) { if (minZoom == 3) { Ellipse ellipse = new Ellipse(); ellipse.Width = 15; ellipse.Height = 15; ellipse.Fill = new SolidColorBrush(Colors.Red); ellipse.SetValue(MapLayer.LocationProperty, bulgariaLocation); MapLayer.SetHotSpot(ellipse, centerSpot); ToolTipService.SetToolTip(ellipse, "Bulgaria"); items.Add(ellipse); } else if (minZoom == 6) { Ellipse sofiaEllipse = new Ellipse(); sofiaEllipse.Width = 20; sofiaEllipse.Height = 20; sofiaEllipse.Stroke = new SolidColorBrush(Colors.Red); sofiaEllipse.Fill = new SolidColorBrush(Colors.Transparent); sofiaEllipse.StrokeThickness = 3; sofiaEllipse.SetValue(MapLayer.LocationProperty, new Location(42.6957539183824, 23.3327663758679)); MapLayer.SetHotSpot(sofiaEllipse, centerSpot); ToolTipService.SetToolTip(sofiaEllipse, "Sofia"); items.Add(sofiaEllipse); } } e.CompleteItemsRequest(items); }