public void OnClick(View v)
        {
            if (hMap == null)
            {
                Log.Warn(TAG, "map is null");
                return;
            }
            if (v.Id == Resource.Id.animateCamera)
            {
                CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLng(new LatLng(20, 120));
                Toast.MakeText(this, hMap.CameraPosition.Target.ToString(), ToastLength.Long).Show();
                hMap.AnimateCamera(cameraUpdate);
            }
            if (v.Id == Resource.Id.getCameraPosition)
            {
                CameraPosition position = hMap.CameraPosition;
                Toast.MakeText(ApplicationContext, position.ToString(), ToastLength.Long).Show();

                // Displays the maximum zoom level and minimum scaling level of the current camera.
                Log.Info(TAG, position.ToString());
                Log.Info(TAG, "MaxZoomLevel:" + hMap.MaxZoomLevel + " MinZoomLevel:" + hMap.MinZoomLevel);
            }
            if (v.Id == Resource.Id.moveCamera)
            {
                CameraPosition build        = new CameraPosition.Builder().Target(new LatLng(60, 60)).Build();
                CameraUpdate   cameraUpdate = CameraUpdateFactory.NewCameraPosition(build);
                Toast.MakeText(this, hMap.CameraPosition.ToString(), ToastLength.Long).Show();
                hMap.MoveCamera(cameraUpdate);
            }
            if (v.Id == Resource.Id.ZoomBy)
            {
                CameraUpdate cameraUpdate = CameraUpdateFactory.ZoomBy(2);
                Toast.MakeText(this, "amount = 2", ToastLength.Long).Show();
                hMap.MoveCamera(cameraUpdate);
            }
            if (v.Id == Resource.Id.newLatLngBounds)
            {
                LatLng       southwest    = new LatLng(30, 60);
                LatLng       northeast    = new LatLng(60, 120);
                LatLngBounds latLngBounds = new LatLngBounds(southwest, northeast);
                Toast.MakeText(this, "southwest =" + southwest.ToString() + " northeast=" + northeast.ToString() + " padding=2",
                               ToastLength.Long).Show();
                CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngBounds(latLngBounds, 2);
                hMap.MoveCamera(cameraUpdate);
            }
            if (v.Id == Resource.Id.setCameraPosition)
            {
                LatLng         southwest      = new LatLng(30, 60);
                CameraPosition cameraPosition =
                    new CameraPosition.Builder().Target(southwest).Zoom(10).Bearing(2.0f).Tilt(2.5f).Build();
                Toast.MakeText(this, cameraPosition.ToString(), ToastLength.Long).Show();
                CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                hMap.MoveCamera(cameraUpdate);
            }
        }
Exemple #2
0
        private void initCameraChangedListener()
        {
            if (map != null)
            {
                map.CameraChange += delegate(object sender, GoogleMap.CameraChangeEventArgs e) {
                    if (sender != null && e != null)
                    {
                        mCameraPosition = e.Position;

                        if (mCameraPosition.ToString() != null)
                        {
                            DebugHelper.newMsg(TAG, "Current zoom level : " + mCameraPosition);
                        }
                    }

                    if (mEncodedPolyline != null)
                    {
                        drawPolyline(mEncodedPolyline);
                    }
                };
            }
        }
Exemple #3
0
    public void Button5()
    {
        //Console.Log("Menus Hidden.");
        //StateManager.GetController().UiRoot.Find("Home/Player Data").GetComponent<Animator>().Play("OutTop");
        //StateManager.GetController().UiRoot.Find("Home/Main Menu").GetComponent<Animator>().Play("OutBottom");

        if (cpos == 0)
        {
            cpos += direction;
        }
        else if (cpos == -1)
        {
            cpos      = 0;
            direction = 1;
        }
        else
        {
            cpos      = 0;
            direction = -1;
        }
        foreach (CameraController c in FindObjectsOfType <CameraController>())
        {
            CameraPosition p = CameraPosition.Center;
            if (cpos == -1)
            {
                p = CameraPosition.Left;
            }
            if (cpos == 1)
            {
                p = CameraPosition.Right;
            }
            Console.Log("Camera position = " + p.ToString());
            //c.SetTarget(new Vector3(-Random.Range(0, 8), 0, Random.Range(0, 8)), .35f);
            c.SetAngle(p, .25f);
        }
    }
Exemple #4
0
 public override string ToString()
 {
     return($"[{FrameNumer}] - [{CameraPosition.ToString()}]");
 }