private void BtnOkMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (Current.Instance.Username == null || Current.Instance.Password == null || Current.Instance.Earthwatcher == null) { var ws = new WarningScreen("Log in to place a flag"); ws.Show(); _ignoreClick = true; Reset(); return; } var comment = txtComment.Text; var eId = Current.Instance.Earthwatcher.Id; //Get lat lon for flag var generalTransform = imgFlagShadow.TransformToVisual(Current.Instance.MapControl); var childToParentCoordinates = generalTransform.Transform(new Point(15, imgFlagShadow.ActualHeight)); var spherical = Current.Instance.MapControl.Viewport.ScreenToWorld(childToParentCoordinates.X, childToParentCoordinates.Y); var lonLat = SphericalMercator.ToLonLat(spherical.X, spherical.Y); //Post var flagPost = new FlagRequests(Constants.BaseApiUrl); flagPost.FlagAdded += OnFlagAdded; var flag = new Earthwatchers.Models.Flag { Comment = comment, EarthwatcherId = eId, Latitude = lonLat.y, Longitude = lonLat.x }; flagPost.Post(flag, Current.Instance.Username, Current.Instance.Password); _ignoreClick = true; Reset(); }
public static void ZoomToHexagon(MapControl mapcontrol, string geohex) { var zone = GeoHex.Decode(geohex); if (zone == null) { var ws = new WarningScreen("Sorry this land is not available"); ws.Show(); return; } var coordinates = zone.getHexCoords(); var sphericalTopLeft = SphericalMercator.FromLonLat(coordinates[0].Longitude, coordinates[1].Latitude); var sphericalBottomRight = SphericalMercator.FromLonLat(coordinates[3].Longitude, coordinates[4].Latitude); const int marge = 8000; mapcontrol.ZoomToBox(new Mapsui.Geometries.Point(sphericalTopLeft.x - marge, sphericalTopLeft.y - marge), new Mapsui.Geometries.Point(sphericalBottomRight.x + marge, sphericalBottomRight.y + marge)); //TODO: Blergh awfull dirty dirty hack to show hexagon after zoomToHexagon (problem = Extend is a center point after ZoomToBox) mapcontrol.ZoomIn(); mapcontrol.ZoomOut(); var hexLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername); hexLayer.UpdateHexagonsInView(); Current.Instance.MapControl.OnViewChanged(true); }
private bool AccessGranted() { if (!urlReceived) { var warning = new WarningScreen("Url not created yet, please wait a moment"); warning.Show(); return false; } return true; }
private bool AccessGranted() { if (!urlReceived) { var warning = new WarningScreen("Url not created yet, please wait a moment"); warning.Show(); return(false); } return(true); }