void UpdateGroundOverlayProperties() { CenterCamera(DemoUtils.BerlinLatLng); _groundOverlay.Bearing = 135; _groundOverlay.IsClickable = true; _groundOverlay.IsVisible = true; // Mutually exclusive but setting both to test _groundOverlay.Position = DemoUtils.BerlinLatLng; _groundOverlay.Bounds = DemoUtils.BerlinLatLngBounds; _groundOverlay.Transparency = 0.25f; _groundOverlay.ZIndex = 3; _groundOverlay.SetDimensions(200000); // Just setting twice to test _groundOverlay.SetDimensions(200000, 200000); _groundOverlay.SetImage(ImageDescriptor.FromAsset("overlay.png")); _groundOverlay.SetPositionFromBounds(DemoUtils.BerlinLatLngBounds); }
public void SetPointsBy1PointsWidthHeight(View view) { if (null != overlay) { String width = imageWidth.Text.ToString().Trim(); String height = imageHeight.Text.ToString().Trim(); String latitude = positionLatitude.Text.ToString().Trim(); String longtitude = positionLongtitude.Text.ToString().Trim(); if (CheckUtils.CheckIsEdit(width) || CheckUtils.CheckIsEdit(height) || CheckUtils.CheckIsEdit(latitude) || CheckUtils.CheckIsEdit(longtitude)) { Toast.MakeText(this, "Please make sure the width & height & position is Edited", ToastLength.Short).Show(); } else { if (!CheckUtils.CheckIsRight(width) || !CheckUtils.CheckIsRight(height) || !CheckUtils.CheckIsRight(latitude) || !CheckUtils.CheckIsRight(longtitude)) { Toast.MakeText(this, "Please make sure the width & height & position is right", ToastLength.Short).Show(); } else { try { if (Single.Parse(width) < 0.0F || Single.Parse(height) < 0.0F) { Toast .MakeText(this, "Please make sure the width & height is right, this value must be non-negative", ToastLength.Short).Show(); return; } LatLng position = new LatLng(Double.Parse(latitude), Double.Parse(longtitude)); overlay.Position = position; overlay.SetDimensions(Single.Parse(width), Single.Parse(height)); CameraPosition cameraPosition = new CameraPosition.Builder().Target(position).Zoom(18).Bearing(0f).Tilt(0f).Build(); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); hMap.MoveCamera(cameraUpdate); } catch (Java.Lang.IllegalArgumentException e) { Toast.MakeText(this, "IllegalArgumentException:" + e.Message, ToastLength.Short).Show(); } } } } }