public void SetPointsBy2Points(View view)
 {
     if (null != overlay)
     {
         string northeastLatitude   = toprightLatitude.Text.ToString().Trim();
         string northeastLongtitude = toprightLongtitude.Text.ToString().Trim();
         string southwestLatitude   = bottomleftLatitude.Text.ToString().Trim();
         string southwestLontitude  = bottomleftLongtitude.Text.ToString().Trim();
         if (CheckUtils.CheckIsEdit(northeastLatitude) || CheckUtils.CheckIsEdit(northeastLongtitude) || CheckUtils.CheckIsEdit(southwestLatitude) ||
             CheckUtils.CheckIsEdit(southwestLontitude))
         {
             Toast.MakeText(this, "Please make sure these latlng are Edited", ToastLength.Short).Show();
         }
         else
         {
             if (!CheckUtils.CheckIsRight(northeastLatitude) || !CheckUtils.CheckIsRight(northeastLongtitude) ||
                 !CheckUtils.CheckIsRight(southwestLatitude) || !CheckUtils.CheckIsRight(southwestLontitude))
             {
                 Toast.MakeText(this, "Please make sure these latlng are right", ToastLength.Short).Show();
             }
             else
             {
                 try
                 {
                     overlay.SetPositionFromBounds(new LatLngBounds(
                                                       new LatLng(Double.Parse(southwestLatitude), Double.Parse(southwestLontitude)),
                                                       new LatLng(Double.Parse(northeastLatitude), Double.Parse(northeastLongtitude))));
                     CameraPosition cameraPosition = new CameraPosition.Builder()
                                                     .Target(overlay.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 ", ToastLength.Short).Show();
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
    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);
    }