Inheritance: MonoBehaviour
Esempio n. 1
0
    public IEnumerator SetTargetData(CameraPosition cp, Transform c, Transform a, EaseType et, float t)
    {
        this.shaking = false;
        this.running = false;
        this.rotating = false;

        this.camPos = cp;
        this.cam = c;
        this.actor = a;
        this.interpolate = Interpolate.Ease(et);
        this.time = 0;
        this.time2 = t;

        Transform tmp = new GameObject().transform;
        this.camPos.Use(tmp, this.actor);
        yield return null;
        this.startPos = this.cam.position;
        this.distancePos = tmp.position - this.startPos;
        this.startRot = this.cam.rotation;
        this.endRot = tmp.rotation;
        this.startFoV = this.cam.camera.fieldOfView;
        this.distanceFov = this.camPos.fieldOfView - this.startFoV;
        GameObject.Destroy(tmp.gameObject);
        this.running = true;
    }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     _zoom = Zooming.NotZoomed;
     _camera = GetComponent<Camera>();
     _defaultTransform = new CameraPosition(transform);
     _defaultFov = _camera.fieldOfView;
     _hit = new RaycastHit();
 }
Esempio n. 3
0
 void Awake()
 {
     sidePosition = new Vector3(10, 7, 0);
     abovePosition = new Vector3(0, 10, 0);
     behindPosition = new Vector3(0, 0, -10);
     currentCamPosition = CameraPosition.Side;
     currentMaterial = BallMaterial.Rubber;
     Size = PlayerSizes.Small;
 }
Esempio n. 4
0
	// Use this for initialization
	void Start ()
    { 
        lookDirection = following.forward;

        firstPersonCameraPosition = new CameraPosition();
        firstPersonCameraPosition.Init("First Person Camera",
                                        new Vector3(0f, 1.6f, .2f),
                                        new GameObject().transform,
                                        characterController.transform
                                      );

	}
Esempio n. 5
0
    private Transform GetTransform(CameraPosition cp)
    {
        if(cp.PosType == CameraPosition.PositionType.Corner)
        {
            return cornerPositions[cp.Position];
        }
        else if(cp.PosType == CameraPosition.PositionType.Inner)
        {
            return centerPositions[cp.Position];
        }

        return null;
    }
Esempio n. 6
0
    // Use this for initialization
    void Start()
    {
        eventHand = GetComponent<EventHandler>();
        charMot =  GameObject.Find("Player").GetComponent<CharacterMotor>();
        playerInput = GameObject.Find("Player").GetComponent<PlayerInput>();
        camPos = GameObject.Find("Main Camera").GetComponent<CameraPosition>();
        charMot.canMove = false;
        camPos.canLook = false;

        triggerDelay = triggerAVgDelay +Random.Range(-5,5);

        runningIntro = true;
    }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var camera = CameraPosition.FromCamera (-37.81969, 144.966085, 4);
			mapView = MapView.FromCamera (RectangleF.Empty, camera);

			var sydneyMarker = new Marker () {
				Position = new CLLocationCoordinate2D (-33.8683, 151.2086),
				Map = mapView
			};

			melbourneMarker = new Marker () {
				Position = new CLLocationCoordinate2D (-37.81969, 144.966085),
				Map = mapView
			};

			mapView.InfoFor = (aMapView, aMarker) => {
				if (aMarker == melbourneMarker)
					return new UIImageView (UIImage.FromBundle ("Icon"));
				return null;
			};

			mapView.TappedMarker = (aMapView, aMarker) => {
				// Animate to the marker
				CATransaction.Begin ();
				CATransaction.AnimationDuration = 3;  // 3 second animation
				
				var cam = new CameraPosition (aMarker.Position, 8, 50, 60);
				mapView.Animate (cam);
				CATransaction.Commit ();
				
				// Melbourne marker has a InfoWindow so return NO to allow markerInfoWindow to
				// fire. Also check that the marker isn't already selected so that the
				// InfoWindow doesn't close.
				if (aMarker == melbourneMarker && mapView.SelectedMarker != melbourneMarker) {
					return false;
				}
				
				// The Tap has been handled so return YES
				return true;
			};

			View = mapView;
		}
Esempio n. 8
0
    void Awake()
    {
        cornerPositions = new List<Transform>();
        centerPositions = new List<Transform>();
        for(int i = 0; i < transform.GetChild(0).childCount; i++)
        {
            cornerPositions.Add(transform.GetChild(0).GetChild(i));
        }
        for (int i = 0; i < transform.GetChild(1).childCount; i++)
        {
            centerPositions.Add(transform.GetChild(1).GetChild(i));
        }

        currentPosition = defaultPosition;
        Transform tr = GetTransform(currentPosition);
        camera.position = tr.position;
        camera.rotation = tr.rotation;
    }
 //diese Methode wählt die nächste Kamera aus
 public void cycleCamera(float cycle)
 {
     if(cycle < -0.8f && changed == false)
     {
         //Kameraposition hochzählen
         camPos++;
         //falls letzte Kameraposition, gehe zum Anfang zurück
         if(camPos == CameraPosition.NUM_OF_CAMS)
         {
             camPos = CameraPosition.REAR_FLOATING_LOW;
         }
         //Kamera wurde geändert
         changed = true;
     }
     else if(cycle == 0.0f && changed == true)
     {
         //Spieler drückt nicht mehr auf den D-Pad, d.h. wir erlauben ihm die Kamera wieder zu ändern
         changed = false;
     }
 }
        private void SetupMap()
        {

            //Init Map wiht Camera
            var camera = new CameraPosition(new CLLocationCoordinate2D(36.069082, -94.155976), 15, 30, 0);
            _mapView = MapView.FromCamera(RectangleF.Empty, camera);
            _mapView.MyLocationEnabled = true;

            //Add button to zoom to location
            _mapView.Settings.MyLocationButton = true;

            _mapView.MyLocationEnabled = true;
            _mapView.MapType = MapViewType.Hybrid;
            _mapView.Settings.SetAllGesturesEnabled(true);

            //Init MapDelegate
            _mapDelegate = new MapDelegate(_mapView);
            _mapView.Delegate = _mapDelegate;

            View = _mapView;
        }
	void Update()
	{

		if(abuelaTarget)
		{
			//Debug.Log(abuelaTarget.location);

			foreach(CameraPosition camPos in cameraPositions)
			{
				if(camPos.camLocation == abuelaTarget.location)
				{
					currentCameraPosition = camPos;
					transform.position = Vector3.Lerp(transform.position, currentCameraPosition.transform.position, Time.deltaTime * smoothCamera);
				}

			}


		}

	}
Esempio n. 12
0
 public void SetCenitalCamera()
 {
     previousCameraPos          = actualCameraPos;
     actualCameraPos            = CameraPosition.CENITAL;
     needToChangeCameraPosition = true;
 }
Esempio n. 13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(Catalog.GetString("Back"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ctrl.ButtonPressed(null);
                ctrl.RemoveScreen(ScreenType.Map);
            }), false);
            NavigationItem.LeftBarButtonItem.TintColor = Colors.NavBarButton;
            NavigationItem.SetHidesBackButton(false, false);

            // Get zoom factor
            zoom = NSUserDefaults.StandardUserDefaults.FloatForKey("MapZoom");

            // Get heading orientation
            headingOrientation = NSUserDefaults.StandardUserDefaults.BoolForKey("HeadingOrientation");

            if (zoom == 0f)
            {
                zoom = 16f;
            }

            // Create camera position
            CameraPosition camera;
            CoordBounds    bounds;

            if (thing != null && !(thing is Zone) && thing.ObjectLocation != null)
            {
                camera = CameraPosition.FromCamera(thing.ObjectLocation.Latitude, thing.ObjectLocation.Longitude, zoom);
            }
            else
            {
                // Set camera to mylocation, perhaps there is no other position
                camera = CameraPosition.FromCamera(engine.Latitude, engine.Longitude, zoom);
                if (thing != null && thing is Zone)
                {
                    bounds = ((Zone)thing).Bounds;
                    if (bounds != null)
                    {
                        camera = CameraPosition.FromCamera(bounds.Left + (bounds.Right - bounds.Left) / 2.0, bounds.Bottom + (bounds.Top - bounds.Bottom) / 2.0, zoom);
                    }
                }
                else
                {
                    camera = CameraPosition.FromCamera(engine.Latitude, engine.Longitude, zoom);
                }
            }

            // Init MapView
            mapView = MapView.FromCamera(RectangleF.Empty, camera);
            mapView.MyLocationEnabled = true;
            mapView.SizeToFit();
            mapView.AutoresizingMask          = UIViewAutoresizing.All;
            mapView.Frame                     = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);
            mapView.MyLocationEnabled         = true;
            mapView.Settings.CompassButton    = false;
            mapView.Settings.MyLocationButton = false;
            mapView.Settings.RotateGestures   = false;
            mapView.Settings.TiltGestures     = false;

            mapView.TappedOverlay         += OnTappedOverlay;
            mapView.TappedInfo            += OnTappedInfo;
            mapView.CameraPositionChanged += OnCameraPositionChanged;

            View.AddSubview(mapView);

            if (thing == null)
            {
                // Show all
                bounds = engine.Bounds;
                if (bounds != null)
                {
                    camera         = mapView.CameraForBounds(new CoordinateBounds(new CLLocationCoordinate2D(bounds.Left, bounds.Top), new CLLocationCoordinate2D(bounds.Right, bounds.Bottom)), new UIEdgeInsets(30f, 30f, 30f, 30f));
                    mapView.Camera = camera;
                }
            }

            btnCenter           = UIButton.FromType(UIButtonType.RoundedRect);
            btnCenter.Tag       = 1;
            btnCenter.Frame     = new RectangleF(12f, 12f, 36f, 36f);
            btnCenter.TintColor = UIColor.White;
            btnCenter.SetBackgroundImage(Images.BlueButton, UIControlState.Normal);
            btnCenter.SetBackgroundImage(Images.BlueButtonHighlight, UIControlState.Highlighted);
            btnCenter.SetImage(Images.ButtonCenter, UIControlState.Normal);
            btnCenter.ContentMode    = UIViewContentMode.Center;
            btnCenter.TouchUpInside += OnTouchUpInside;

            View.AddSubview(btnCenter);

            btnOrientation           = UIButton.FromType(UIButtonType.RoundedRect);
            btnOrientation.Tag       = 2;
            btnOrientation.Frame     = new RectangleF(12f, 61f, 36f, 36f);
            btnOrientation.TintColor = UIColor.White;
            btnOrientation.SetBackgroundImage(Images.BlueButton, UIControlState.Normal);
            btnOrientation.SetBackgroundImage(Images.BlueButtonHighlight, UIControlState.Highlighted);
            btnOrientation.SetImage((headingOrientation ? Images.ButtonOrientation : Images.ButtonOrientationNorth), UIControlState.Normal);
            btnOrientation.ContentMode    = UIViewContentMode.Center;
            btnOrientation.TouchUpInside += OnTouchUpInside;

            View.AddSubview(btnOrientation);

            btnMapType                  = UIButton.FromType(UIButtonType.RoundedRect);
            btnMapType.Tag              = 3;
            btnMapType.Frame            = new RectangleF(mapView.Frame.Width - 12f - 36f, 12f, 36f, 36f);
            btnMapType.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleBottomMargin;
            btnMapType.TintColor        = UIColor.White;
            btnMapType.SetBackgroundImage(Images.BlueButton, UIControlState.Normal);
            btnMapType.SetBackgroundImage(Images.BlueButtonHighlight, UIControlState.Highlighted);
            btnMapType.SetImage(Images.ButtonMapType, UIControlState.Normal);
            btnMapType.ContentMode    = UIViewContentMode.Center;
            btnMapType.TouchUpInside += OnTouchUpInside;

            View.AddSubview(btnMapType);

            webLegacy                          = new UIWebView();
            webLegacy.Frame                    = new RectangleF(mapView.Frame.Width - 2f - 150f, mapView.Frame.Height - 2f - 20f, 150f, 20f);
            webLegacy.AutoresizingMask         = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth;
            webLegacy.BackgroundColor          = UIColor.Clear;
            webLegacy.Opaque                   = false;
            webLegacy.ScrollView.ScrollEnabled = false;
            webLegacy.ScalesPageToFit          = true;
            webLegacy.ShouldStartLoad          = delegate(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) {
                if (navigationType == UIWebViewNavigationType.LinkClicked)
                {
                    UIApplication.SharedApplication.OpenUrl(request.Url);
                    return(false);
                }
                return(true);
            };

            View.AddSubview(webLegacy);

            // Set map source
            SetMapSource((MapSource)NSUserDefaults.StandardUserDefaults.IntForKey("MapSource"));

            Refresh();
        }
        private void InitElements()
        {
            // Enable back navigation using swipe.
            NavigationController.InteractivePopGestureRecognizer.Delegate = null;

            new AppDelegate().disableAllOrientation = true;

            var deviceModel = Xamarin.iOS.DeviceHardware.Model;


            if (deviceModel.Contains("X"))
            {
                headerView.Frame  = new Rectangle(0, 0, Convert.ToInt32(View.Frame.Width), (Convert.ToInt32(View.Frame.Height) / 10) + 8);
                backBn.Frame      = new Rectangle(0, (Convert.ToInt32(View.Frame.Width) / 20) + 20, Convert.ToInt32(View.Frame.Width) / 8, Convert.ToInt32(View.Frame.Width) / 8);
                headerLabel.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 5, (Convert.ToInt32(View.Frame.Width) / 12) + 20, (Convert.ToInt32(View.Frame.Width) / 5) * 3, Convert.ToInt32(View.Frame.Width) / 18);
            }
            else
            {
                headerView.Frame  = new Rectangle(0, 0, Convert.ToInt32(View.Frame.Width), (Convert.ToInt32(View.Frame.Height) / 10));
                backBn.Frame      = new Rectangle(0, Convert.ToInt32(View.Frame.Width) / 20, Convert.ToInt32(View.Frame.Width) / 8, Convert.ToInt32(View.Frame.Width) / 8);
                headerLabel.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 5, Convert.ToInt32(View.Frame.Width) / 12, (Convert.ToInt32(View.Frame.Width) / 5) * 3, Convert.ToInt32(View.Frame.Width) / 18);
            }
            View.BackgroundColor       = UIColor.FromRGB(36, 43, 52);
            headerView.BackgroundColor = UIColor.FromRGB(36, 43, 52);
            headerLabel.Text           = "Адрес компании";

            backBn.ImageEdgeInsets        = new UIEdgeInsets(backBn.Frame.Height / 3.5F, backBn.Frame.Width / 2.35F, backBn.Frame.Height / 3.5F, backBn.Frame.Width / 3);
            hintView.Frame                = new Rectangle(0, 0, (int)(View.Frame.Width), (int)(View.Frame.Width / 2));
            hintView.BackgroundColor      = UIColor.FromRGB(255, 99, 62);
            fingerIV.Frame                = new Rectangle((int)(View.Frame.Width / 2 - (View.Frame.Width / 24)), 25, (int)(View.Frame.Width / 12), (int)View.Frame.Width / 8);
            okBn.Layer.BorderColor        = UIColor.White.CGColor;
            okBn.Layer.BorderWidth        = 1f;
            neverShowBn.Layer.BorderColor = UIColor.White.CGColor;
            neverShowBn.Layer.BorderWidth = 1f;
            hintTV.Frame      = new Rectangle(0, (int)(fingerIV.Frame.Y + fingerIV.Frame.Height + 10), (int)View.Frame.Width, (int)hintView.Frame.Height / 3);
            okBn.Frame        = new Rectangle(10, (int)hintTV.Frame.Y + (int)hintTV.Frame.Height, (int)View.Frame.Width / 7, (int)View.Frame.Width / 10);
            neverShowBn.Frame = new Rectangle((int)(okBn.Frame.X + (int)okBn.Frame.Width + 20), (int)okBn.Frame.Y, (int)(View.Frame.Width - 40 - (int)okBn.Frame.Width), (int)View.Frame.Width / 10);
            applyAddressBn.BackgroundColor = UIColor.FromRGB(255, 99, 62);
            if (!databaseMethods.GetShowMapHint())
            {
                hintView.Hidden = true;
            }
            camera = CameraPosition.FromCamera(latitude: Convert.ToDouble(lat, CultureInfo.InvariantCulture),
                                               longitude: Convert.ToDouble(lng, CultureInfo.InvariantCulture),
                                               zoom: zoom);
            mapView                        = MapView.FromCamera(CGRect.Empty, camera);
            mapView.Frame                  = new Rectangle(0, Convert.ToInt32(headerView.Frame.Height), Convert.ToInt32(View.Frame.Width), Convert.ToInt32(View.Frame.Height));
            mapView.MyLocationEnabled      = true;
            mapView.CoordinateLongPressed += HandleLongPress;
            mapView.UserInteractionEnabled = true;

            applyAddressBn.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 15,
                                                 (Convert.ToInt32(View.Frame.Height - View.Frame.Height / 10)),
                                                 Convert.ToInt32(View.Frame.Width) - ((Convert.ToInt32(View.Frame.Width) / 15) * 2),
                                                 Convert.ToInt32(View.Frame.Height) / 12);
            applyAddressBn.Font = applyAddressBn.Font.WithSize(15f);
            applyAddressBn.SetTitle("ПОДТВЕРДИТЬ АДРЕС", UIControlState.Normal);
            address_textView.Frame  = new Rectangle(0, (int)headerView.Frame.Height, (int)(View.Frame.Width), (int)(headerView.Frame.Height));
            centerPositionBn.Frame  = new Rectangle(Convert.ToInt32(View.Frame.Width - ((View.Frame.Width / 8))), Convert.ToInt32(address_textView.Frame.Height), Convert.ToInt32(View.Frame.Width / 8), Convert.ToInt32(View.Frame.Width / 8));
            address_textLabel.Frame = new Rectangle(10, Convert.ToInt32(address_textView.Frame.Height / 2 - (int)(View.Frame.Width / 36)), (Convert.ToInt32(View.Frame.Width) - 20), Convert.ToInt32(View.Frame.Width) / 18);
            okBn.Font           = UIFont.FromName(CardsPCL.Constants.fira_sans, 17f);
            neverShowBn.Font    = UIFont.FromName(CardsPCL.Constants.fira_sans, 17f);
            applyAddressBn.Font = UIFont.FromName(CardsPCL.Constants.fira_sans, 15f);
            hintTV.Font         = UIFont.FromName(CardsPCL.Constants.fira_sans, 13.5f);
            if (EditViewController.IsCompanyReadOnly)
            {
                DisableFields();
            }
        }
 public void OnCameraChange(CameraPosition pos)
 {
     UpdateVisibleRegion(pos.Target);
 }
Esempio n. 16
0
 public void SaveCameraPosition(CameraPosition cameraPosition)
 {
     _settingsManager.Latitude  = cameraPosition.Target.Latitude;
     _settingsManager.Longitude = cameraPosition.Target.Longitude;
 }
Esempio n. 17
0
    public IEnumerator SetTargetData(Vector3 pos, Quaternion rot, float fov, Transform c, EaseType et, float t)
    {
        this.shaking = false;
        this.running = false;
        this.rotating = false;

        this.cam = c;
        this.interpolate = Interpolate.Ease(et);
        this.time = 0;
        this.time2 = t;
        this.camPos = null;

        yield return null;
        this.startPos = this.cam.position;
        this.distancePos = pos - this.startPos;
        this.startRot = this.cam.rotation;
        this.endRot = rot;
        this.startFoV = this.cam.camera.fieldOfView;
        this.distanceFov = fov - this.startFoV;
        this.running = true;
    }
        public override void LoadView()
        {
            base.LoadView();

            CameraPosition camera = CameraPosition.FromCamera(latitude: 42.392262,
                                                          longitude: -72.526992,
                                                          zoom: 6);
            mapView = MapView.FromCamera(CGRect.Empty, camera);
            mapView.MyLocationEnabled = true;

            View = mapView;
            mapView.CoordinateLongPressed += HandleLongPress;

            /*
            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, DidTapAdd);
            var clearButton = new UIBarButtonItem("Clear Markers", UIBarButtonItemStyle.Plain, (o, s) =>
            {
                mapView.Clear();

            });

            NavigationItem.RightBarButtonItems = new[] { addButton, clearButton };
            */
            mapView.TappedMarker = (aMapView, aMarker) =>
            {

                // Animate to the marker
                var cam = new CameraPosition(aMarker.Position, 8, 50, 60);
                mapView.Animate(cam);
                UIAlertView alert = new UIAlertView();
                alert.Title = "Are you sure you want to select this position as the landmarks position?";
                alert.AddButton("Cancel");
                alert.AddButton("OK");
                alert.CancelButtonIndex = 0;
                alert.Message = " If yes, please click OK";
                //alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
                alert.Clicked += (object s, UIButtonEventArgs ev) =>
                {
                    // handle click event here
                    if (ev.ButtonIndex != 0)
                    {
                        _selectPagePosition.Longitude = aMarker.Position.Longitude.ToString();
                        _selectPagePosition.Latitude = aMarker.Position.Latitude.ToString();

                        _selectPagePosition.NavigateBack();

                    }

                    //var a = Page.Navigation.NavigationStack[0];

                    // user input will be in alert.GetTextField(0).Text;
                };

                alert.Show();

                // Melbourne marker has a InfoWindow so return NO to allow markerInfoWindow to
                // fire. Also check that the marker isn't already selected so that the
                // InfoWindow doesn't close.
                /*if (aMarker == melbourneMarker && mapView.SelectedMarker != melbourneMarker)
                {
                    return false;
                }*/
                // The Tap has been handled so return YES
                return true;
            };
        }
    // Use this for initialization
    /*void Awake(){
        var fadeTexture = new Texture2D(1,1);
        fadeTexture.Resize(400,400);
        fadeTexture.SetPixel(0,0,Color.black);
        fadeTexture.Apply();

        fade = new GameObject("Effect");
        fade.AddComponent<GUITexture>();
        fade.transform.position = new Vector3(0.5f, 0.5f, 1000f);
        fade.guiTexture.texture = wSBars;
        fade.guiTexture.texture.height=200;
        //wSBars.enabled = false;
    }*/
    void Start()
    {
        follow = GameObject.FindWithTag ("Player").GetComponent<OrbitalCharacterControllerLogic>();
        followTarget = GameObject.FindWithTag ("camTarget").transform;
        lookDir = followTarget.forward;
        curLookDir = followTarget.forward;

        /*	barEffect = GetComponent<BarsEffect>();
        if(barEffect == null){
            Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
        }*/
        firstPersonCamPos = new CameraPosition();
        firstPersonCamPos.Init(
            "First Person Camera",
            new Vector3(0.0f, 0.004f, 0.005f),
            new GameObject().transform,
            followTarget
        );
    }
Esempio n. 20
0
 void Start()
 {
     cPos = GetComponent <CameraPosition> ();
 }
Esempio n. 21
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if(!Input.anyKey)
            currentKey = KeyCode.None;

        if(Input.GetKey(KeyCode.PageUp))
        {
            currentKey = KeyCode.PageUp;

            if(previousKey != currentKey)
                GrowPlayer();
        }

        if(Input.GetKey(KeyCode.PageDown))
        {
            currentKey = KeyCode.PageDown;

            if(previousKey != currentKey)
                ShrinkPlayer();
        }
        /*
        if(Input.GetKey(KeyCode.DownArrow))
        {
            rigidbody.AddForce (-Vector3.forward*(speed/2));
            currentKey = KeyCode.DownArrow;
        }

        if(Input.GetKey(KeyCode.UpArrow))
        {
            rigidbody.AddForce (Vector3.forward*speed);
            currentKey = KeyCode.UpArrow;
        }

        if(Input.GetKey(KeyCode.RightArrow))
        {
            rigidbody.AddForce (Vector3.right*speed);
            currentKey = KeyCode.RightArrow;
        }

        if(Input.GetKey(KeyCode.LeftArrow))
        {
            rigidbody.AddForce (Vector3.left*speed);
            currentKey = KeyCode.LeftArrow;
        }
        */

        HandleMovement();

        if(Input.GetKey(KeyCode.Q))
        {
            currentKey = KeyCode.Space;
            if(previousKey != currentKey)
            {
                if(currentMaterial == BallMaterial.Rubber)
                {
                    currentMaterial = BallMaterial.Metal;
                    collider.material = Metal;
                    renderer.material.color = new Color32(81,81,81,255);
                }
                else if(currentMaterial == BallMaterial.Sandpaper)
                {
                    currentMaterial = BallMaterial.Rubber;
                    collider.material = Bouncer;
                    renderer.material.color = new Color32(255,156,255,255);
                }
                else
                {
                    currentMaterial = BallMaterial.Sandpaper;
                    collider.material = Paper;
                    renderer.material.color = new Color32(241,255,112,255);
                }
            }
        }

        if(Input.GetKey(KeyCode.Space))
        {
            currentKey = KeyCode.Space;
            if(previousKey != currentKey)
            {
                if((int)currentCamPosition == Enum.GetValues(typeof(CameraPosition)).Length-1)
                    currentCamPosition = (CameraPosition)0;
                else
                    currentCamPosition = (CameraPosition)((int)currentCamPosition+1);
            }
        }

        previousKey = currentKey;
    }
Esempio n. 22
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Console.WriteLine("OnCreate Called");
            Window.RequestFeature(WindowFeatures.NoTitle);
            AppCenter.Start("7ac229ee-9940-46b8-becc-d2611c48b2ad", typeof(Analytics), typeof(Crashes), typeof(Push), typeof(Distribute));

            Push.SetSenderId(firebaseSenderId);
            Push.PushNotificationReceived += PushNotificationRecieved;
            currState = LastCustomNonConfigurationInstance as SaveState;
            SetContentView(Resource.Layout.Main);


            if (currState == null)
            {
                await ServiceLayer.SharedInstance.InitalizeSettings();

                for (int i = 1; i <= NumPokes; i++)
                {
                    try
                    {
                        pokeResourceMap[i] = (int)typeof(Resource.Mipmap).GetField($"p{i.ToString("d3")}").GetValue(null);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"poke {i} not found");
                    }
                }
                Console.WriteLine("No saved state");
            }
            else
            {
                pokeResourceMap = currState.ResourceMap;
                Console.WriteLine("saved state recalled");
            }

            lastUpdate = DateTime.UtcNow;
            if (savedInstanceState != null && savedInstanceState.ContainsKey("centerLat") && currState == null)
            {
                var cLat   = savedInstanceState.GetDouble("centerLat");
                var cLon   = savedInstanceState.GetDouble("centerLon");
                var zoom   = savedInstanceState.GetFloat("centerZoom");
                var update = savedInstanceState.GetLong("lastUpdate");
                lastUpdate = Utility.FromUnixTime(update);
                currState  = new SaveState()
                {
                    CurrentCenter = new LatLng(cLat, cLon),
                    CurrentZoom   = zoom
                };
            }

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            progress     = FindViewById(Resource.Id.progressBar) as ProgressBar;
            if (_mapFragment == null)
            {
                CameraPosition startCam;
                if (currState == null)
                {
                    startCam = new CameraPosition(mDefaultLocation, defaultZoom, 0.0f, 0.0f); //CameraUpdateFactory.NewLatLngZoom(mDefaultLocation, defaultZoom);
                }
                else
                {
                    startCam = new CameraPosition(currState.CurrentCenter, currState.CurrentZoom, 0.0f, 0.0f);
                }
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true)
                                              .InvokeRotateGesturesEnabled(false)
                                              .InvokeCamera(startCam);

                Android.App.FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }

            loginHolder = FindViewById(Resource.Id.loginHolder) as CardView;
            username    = FindViewById(Resource.Id.username) as EditText;
            if (settings.LoggedIn)
            {
                loginHolder.Visibility = ViewStates.Gone;
                _mapFragment.GetMapAsync(this);
                var imm = GetSystemService(Context.InputMethodService) as InputMethodManager;
                imm.HideSoftInputFromWindow(username.WindowToken, 0);
                if (currState == null)
                {
                    await LoadData();
                }
                else if (lastUpdate < DateTime.UtcNow.AddSeconds(-20))
                {
                    RefreshMapData(null);
                }
            }
            else
            {
                loginHolder.Visibility = ViewStates.Visible;
                password = FindViewById(Resource.Id.password) as EditText;
                username.RequestFocus();
                _mapFragment.GetMapAsync(this);
            }

            var loginButton = FindViewById(Resource.Id.signInButton) as Button;

            loginButton.Click += LoginButton_Click;
            var settingButton = FindViewById(Resource.Id.settingsButton);

            settingButton.Click += SettingButton_Click;
            var layerButton = FindViewById(Resource.Id.layerssButton);

            layerButton.Click += LayerButton_Click;
            settingsHolder     = FindViewById(Resource.Id.settingsHolder) as CardView;
            var settingsDone = settingsHolder.FindViewById(Resource.Id.settingsDoneButton);

            settingsDone.Click += SettingsDone_Click;
            var settingsInfo = settingsHolder.FindViewById(Resource.Id.settingsInfoButton);

            settingsInfo.Click += SettingsInfo_Click;


            var hideButton   = FindViewById(Resource.Id.hideButton) as Button;
            var notifyButton = FindViewById(Resource.Id.notifyButton) as Button;

            hideButton.Click   += HideButton_Click;
            notifyButton.Click += NotifyButton_Click1;


            progress.Indeterminate                = true;
            settingsListview                      = FindViewById(Resource.Id.settingsListView) as ListView;
            settingsListview.Adapter              = new SettingsAdaptor(this, pokeResourceMap);
            App.Current.LocationServiceConnected += (object sender, ServiceConnectedEventArgs e) =>
            {
                Log.Debug("MainActivity", "ServiceConnected Event Raised");
            };
            App.StartLocationService();
        }
Esempio n. 23
0
 protected virtual void PrepareCameraMoving(CameraPosition from, CameraPosition to)
 {
 }
 public static GCameraPosition ToIOS(this CameraPosition self)
 {
     return(new GCameraPosition(self.Target.ToCoord(), (float)self.Zoom, (float)self.Bearing, (float)self.Tilt));
 }
Esempio n. 25
0
        internal void SetupMatricesLand3d()
        {
            Lighting = false;
            Space    = false;
            RenderTriangle.CullInside = false;

            // For our world matrix, we will just rotate the Earth and Clouds about the y-axis.
            Matrix3d WorldMatrix = Matrix3d.RotationY(((ViewCamera.Lng - 90f) / 180f * Math.PI));

            WorldMatrix.Multiply(Matrix3d.RotationX(((-ViewCamera.Lat) / 180f * Math.PI)));
            World     = WorldMatrix;
            WorldBase = WorldMatrix.Clone();

            viewPoint = Coordinates.GeoTo3d(ViewCamera.Lat, ViewCamera.Lng);

            double distance = 0;

            if (backgroundImageset.IsMandelbrot)
            {
                distance = (4.0 * (ViewCamera.Zoom / 180)) + 0.00000000000000000000000000000000000000001;
            }
            else
            {
                distance = (4.0 * (ViewCamera.Zoom / 180)) + 0.000001;
            }
            fovAngle = ((this.ViewCamera.Zoom) / FOVMULT) / Math.PI * 180;
            fovScale = (fovAngle / Height) * 3600;

            if (gl != null)
            {
                targetAltitude = GetScaledAltitudeForLatLong(ViewCamera.Lat, ViewCamera.Lng);
                double heightNow = 1 + targetAltitude;
                targetAltitude *= NominalRadius;
                //if ((double.IsNaN(heightNow)))
                //{
                //    heightNow = 0;
                //}

                if (targetHeight < heightNow)
                {
                    targetHeight = (((targetHeight * 2) + heightNow) / 3);
                }
                else
                {
                    targetHeight = (((targetHeight * 9) + heightNow) / 10);
                }
                //if (double.IsNaN(targetHeight))
                //{
                //    targetHeight = 0;
                //}
            }
            else
            {
                targetAltitude = 0;
                targetHeight   = 1;
            }

            double rotLocal = ViewCamera.Rotation;

            CameraPosition = Vector3d.Create(
                (Math.Sin(rotLocal) * Math.Sin(ViewCamera.Angle) * distance),
                (Math.Cos(rotLocal) * Math.Sin(ViewCamera.Angle) * distance),
                (-targetHeight - (Math.Cos(ViewCamera.Angle) * distance)));
            Vector3d cameraTarget = Vector3d.Create(0.0f, 0.0f, -targetHeight);


            double camHeight = CameraPosition.Length();


            Vector3d lookUp = Vector3d.Create(Math.Sin(rotLocal) * Math.Cos(ViewCamera.Angle), Math.Cos(rotLocal) * Math.Cos(ViewCamera.Angle), Math.Sin(ViewCamera.Angle));

            View = Matrix3d.LookAtLH(
                (CameraPosition),
                (cameraTarget),
                lookUp);
            // * Matrix3d.RotationX(((-config.DomeTilt) / 180 * Math.PI));

            ViewBase = View;

            double back = Math.Sqrt((distance + 1f) * (distance + 1f) - 1);

            back = Math.Max(.5, back);
            // back = (float)camDist * 40f;
            double m_nearPlane = distance * .05f;

            m_nearPlane = distance * .05f;
            Projection  = Matrix3d.PerspectiveFovLH((Math.PI / 4.0), (double)Width / (double)Height, m_nearPlane, back);

            SetMatrixes();

            MakeFrustum();
        }
Esempio n. 26
0
 protected virtual void OnCameraChange(CameraPosition newCameraPosition)
 {
     Models.Clear();
 }
Esempio n. 27
0
 public static CameraUpdate NewCameraPosition(CameraPosition cameraPosition)
 {
     return(new CameraUpdate(cameraPosition));
 }
Esempio n. 28
0
 void Awake()
 {
     _camPos = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraPosition>();
     _defaultSize = _camPos.GetComponent<Camera>().orthographicSize;
 }
Esempio n. 29
0
		/// <summary>
		/// Use this for initialization.
		/// </summary>
		void Start ()
		{
				parentRig = this.transform.parent;
				if (parentRig == null) {
						Debug.LogError ("Parent camera to empty GameObject.", this);
				}
		
				//follow = GameObject.FindWithTag ("Player").GetComponent<CharacterControllerLogic> ();
				//followXform = GameObject.FindWithTag ("Player").transform;
				if (follow == null || followXform == null) {
						Debug.LogError ("awaiting follow and followXform.", this);
						return;
				}
				lookDir = followXform.forward;
				curLookDir = followXform.forward;
		
				barEffect = GetComponent<BarsEffect> ();
				if (barEffect == null) {
						Debug.LogError ("Attach a widescreen BarsEffect script to the camera.", this);
				}
		
				// Position and parent a GameObject where first person view should be
				firstPersonCamPos = new CameraPosition ();
				firstPersonCamPos.Init (
					"FPCam",
					follow.transform
				);	
		}
Esempio n. 30
0
        public CommonUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController)
        {
            this.editorController     = editorController;
            this.standaloneController = standaloneController;
            this.propEditController   = propEditController;

            this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, delegate(CameraPosition camPos)
            {
                SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow;
                if (activeWindow != null)
                {
                    camPos.Translation = activeWindow.Translation;
                    camPos.LookAt      = activeWindow.LookAt;
                    activeWindow.calculateIncludePoint(camPos);
                }
            });

            this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.PreviewCameraPosition, delegate(CameraPosition camPos)
            {
                SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow;
                if (activeWindow != null)
                {
                    CameraPosition undo = activeWindow.createCameraPosition();
                    activeWindow.setPosition(camPos, MedicalConfig.CameraTransitionTime);
                    activeWindow.pushUndoState(undo);
                }
            });

            this.addCustomQuery <PresetState>(ChangeMedicalStateCommand.CustomEditQueries.CapturePresetState, delegate(SendResult <PresetState> resultCallback)
            {
                PresetStateCaptureDialog stateCaptureDialog = new PresetStateCaptureDialog(resultCallback);
                stateCaptureDialog.SmoothShow = true;
                stateCaptureDialog.open(true);
            });

            this.addOneWayCustomQuery(RmlView.CustomQueries.OpenFileInRmlViewer, delegate(String file)
            {
                editorController.openEditor(file);
            });

            this.addCustomQuery <Browser>(ViewCollection.CustomQueries.CreateViewBrowser, delegate(SendResult <Browser> resultCallback)
            {
                Browser browser = new Browser("Views", "Choose View Type");
                standaloneController.MvcCore.ViewHostFactory.createViewBrowser(browser);
                String errorPrompt = null;
                resultCallback(browser, ref errorPrompt);
            });

            this.addCustomQuery <Browser>(ModelCollection.CustomQueries.CreateModelBrowser, delegate(SendResult <Browser> resultCallback)
            {
                Browser browser = new Browser("Models", "Choose Model Type");

                browser.addNode(null, null, new BrowserNode("DataModel", typeof(DataModel), DataModel.DefaultName));
                browser.addNode(null, null, new BrowserNode("Navigation", typeof(NavigationModel), NavigationModel.DefaultName));
                browser.addNode(null, null, new BrowserNode("MedicalStateInfo", typeof(MedicalStateInfoModel), MedicalStateInfoModel.DefaultName));
                browser.addNode(null, null, new BrowserNode("BackStack", typeof(BackStackModel), BackStackModel.DefaultName));
                String error = null;
                resultCallback(browser, ref error);
            });

            this.addCustomQuery <Type>(RunCommandsAction.CustomQueries.ShowCommandBrowser, delegate(SendResult <Type> resultCallback)
            {
                this.showBrowser(RunCommandsAction.CreateCommandBrowser(), resultCallback);
            });

            this.addCustomQuery <Color>(ShowTextAction.CustomQueries.ChooseColor, queryDelegate =>
            {
                ColorDialog colorDialog = new ColorDialog();
                colorDialog.showModal((result, color) =>
                {
                    if (result == NativeDialogResult.OK)
                    {
                        String errorPrompt = null;
                        queryDelegate.Invoke(color, ref errorPrompt);
                    }
                });
            });

            this.addOneWayCustomQuery <ShowPropAction>(ShowPropAction.CustomQueries.KeepOpenToggle, showPropAction =>
            {
                if (showPropAction.KeepOpen)
                {
                    propEditController.removeOpenProp(showPropAction);
                }
                else
                {
                    propEditController.addOpenProp(showPropAction);
                }
            });

            this.addSyncCustomQuery <Browser, IEnumerable <String>, String>(FileBrowserEditableProperty.CustomQueries.BuildBrowser, (searchPattern, prompt) =>
            {
                return(createFileBrowser(searchPattern, prompt));
            });

            this.addSyncCustomQuery <Browser>(AnatomyManager.CustomQueries.BuildBrowser, () =>
            {
                return(AnatomyManager.buildBrowser());
            });

            this.addSyncCustomQuery <Browser>(PropBrowserEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                Browser browser = new Browser("Props", "Choose Prop");
                foreach (var propDef in standaloneController.TimelineController.PropFactory.PropDefinitions)
                {
                    if (standaloneController.LicenseManager.allowPropUse(propDef.PropLicenseId))
                    {
                        browser.addNode(propDef.BrowserPath, new BrowserNode(propDef.PrettyName, propDef.Name));
                    }
                }
                return(browser);
            });

            this.addSyncCustomQuery <Browser>(ElementNameEditableProperty.CustomQueries.BuildBrowser, () =>
            {
                Browser browser = new Browser("Screen Location Name", "Choose Screen Location Name");
                foreach (var elementName in standaloneController.GUIManager.NamedLinks)
                {
                    browser.addNode(null, null, new BrowserNode(elementName.UniqueDerivedName, elementName));
                }
                return(browser);
            });

            addOneWayCustomQuery <String>(PlaySoundAction.CustomQueries.EditExternally, soundFile =>
            {
                if (soundFile != null && editorController.ResourceProvider.exists(soundFile))
                {
                    String fullPath = editorController.ResourceProvider.getFullFilePath(soundFile);
                    OtherProcessManager.openLocalURL(fullPath);
                }
            });
        }
        private void camera_position_Click(object sender, EventArgs e)
        {
            using (CameraPosition pos = new CameraPosition())
            {
                pos.ShowDialog();

                //if (pos.X != -999 && pos.Y != -999 && pos.Angle != -1)
                //{
                    GetCurrentCamera().X = pos.X;
                    GetCurrentCamera().Y = pos.Y;
                    GetCurrentCamera().Angle = pos.Angle;
                //}

                UpdateGroupBox(GetCurrentFocusIndex());
            }
        }
Esempio n. 32
0
 public static CameraPosition[] Add(CameraPosition n, CameraPosition[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(CameraPosition str in list) tmp.Add(str);
     tmp.Add(n);
     return tmp.ToArray(typeof(CameraPosition)) as CameraPosition[];
 }
Esempio n. 33
0
 public void SetCamera(GeoPoint location, float zoom)
 {
     _mapView.Camera = CameraPosition.FromCamera(location.ToCLLocation(), zoom);
 }
Esempio n. 34
0
 public static CameraPosition[] Remove(int index, CameraPosition[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(CameraPosition str in list) tmp.Add(str);
     tmp.RemoveAt(index);
     return tmp.ToArray(typeof(CameraPosition)) as CameraPosition[];
 }
Esempio n. 35
0
        public async void getCurrentLoc(GoogleMap googleMap)
        {
            Console.WriteLine("Test - CurrentLoc");
            try
            {
                var request  = new GeolocationRequest(GeolocationAccuracy.Best);
                var location = await Geolocation.GetLocationAsync(request);

                if (location != null)
                {
                    Console.WriteLine($"current Loc - Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}");
                    MarkerOptions curLoc = new MarkerOptions();
                    curLoc.SetPosition(new LatLng(location.Latitude, location.Longitude));


                    var address = await Geocoding.GetPlacemarksAsync(location.Latitude, location.Longitude);

                    var placemark      = address?.FirstOrDefault();
                    var geocodeAddress = "";
                    if (placemark != null)
                    {
                        geocodeAddress =
                            $"AdminArea:       {placemark.AdminArea}\n" +
                            $"CountryCode:     {placemark.CountryCode}\n" +
                            $"CountryName:     {placemark.CountryName}\n" +
                            $"FeatureName:     {placemark.FeatureName}\n" +
                            $"Locality:        {placemark.Locality}\n" +
                            $"PostalCode:      {placemark.PostalCode}\n" +
                            $"SubAdminArea:    {placemark.SubAdminArea}\n" +
                            $"SubLocality:     {placemark.SubLocality}\n" +
                            $"SubThoroughfare: {placemark.SubThoroughfare}\n" +
                            $"Thoroughfare:    {placemark.Thoroughfare}\n";
                    }


                    curLoc.SetTitle("You are here");// + geocodeAddress);
                    curLoc.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueAzure));

                    googleMap.AddMarker(curLoc);


                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(new LatLng(location.Latitude, location.Longitude));
                    builder.Zoom(18);
                    builder.Bearing(155);
                    builder.Tilt(65);

                    CameraPosition cameraPosition = builder.Build();

                    CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                    googleMap.MoveCamera(cameraUpdate);
                }
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                // Handle not supported on device exception
                Toast.MakeText(Activity, "Feature Not Supported", ToastLength.Short);
            }
            catch (FeatureNotEnabledException fneEx)
            {
                // Handle not enabled on device exception
                Toast.MakeText(Activity, "Feature Not Enabled", ToastLength.Short);
            }
            catch (PermissionException pEx)
            {
                // Handle permission exception
                Toast.MakeText(Activity, "Needs more permission", ToastLength.Short);
            }
        }
Esempio n. 36
0
 //note: set newCameraPos to current camera pos if you want to just return to the rest position
 public void BeginAnimationToNewCameraPos(CameraPosition newCameraPosition)
 {
     animation = AnimationState.FlyToResting;
         nextCameraPos = newCameraPosition;
         oldAngAboutY = angAboutY;
         oldZoomLinear = ViewZoomLinear;
         animationCounter = 0.0f;
 }
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            InitElements();

            okBn.TouchUpInside += (s, e) =>
            {
                hintView.Hidden = true;
            };
            backBn.TouchUpInside += (s, e) =>
            {
                this.NavigationController.PopViewController(true);
            };
            neverShowBn.TouchUpInside += (s, e) =>
            {
                hintView.Hidden = true;
                databaseMethods.InsertMapHint(false);
            };

            if (!methods.IsConnected())
            {
                NoConnectionViewController.view_controller_name = GetType().Name;
                this.NavigationController.PushViewController(sb.InstantiateViewController(nameof(NoConnectionViewController)), false);
                return;
            }

            if (lat == "")
            {
                lat = null;
            }
            if (lng == "")
            {
                lng = null;
            }
            if (company_lat == "")
            {
                company_lat = null;
            }
            if (company_lng == "")
            {
                company_lng = null;
            }

            address_textView.Hidden = true;

            View.AddSubviews(mapView, centerPositionBn, applyAddressBn, hintView);

            mgr = new CLLocationManager();
            try
            {
                lat = mgr.Location.Coordinate.Latitude.ToString().Replace(',', '.');
                lng = mgr.Location.Coordinate.Longitude.ToString().Replace(',', '.');

                camera = CameraPosition.FromCamera(latitude: Convert.ToDouble(lat, CultureInfo.InvariantCulture),
                                                   longitude: Convert.ToDouble(lng, CultureInfo.InvariantCulture),
                                                   zoom: zoom);
                mapView.Camera = camera;
            }
            catch { }
            bool updated = false;

            mgr.LocationsUpdated += (sender, e) =>
            {
                if (!updated)
                {
                    foreach (var locss in e.Locations)
                    {
                        lat    = e.Locations[0].Coordinate.Latitude.ToString().Replace(',', '.');
                        lng    = e.Locations[0].Coordinate.Longitude.ToString().Replace(',', '.');
                        camera = CameraPosition.FromCamera(latitude: Convert.ToDouble(lat, CultureInfo.InvariantCulture),
                                                           longitude: Convert.ToDouble(lng, CultureInfo.InvariantCulture),
                                                           zoom: zoom);

                        try
                        {
                            if (!String.IsNullOrEmpty(company_lat) && !String.IsNullOrEmpty(company_lng))
                            {
                                company_lat = company_lat.Replace(',', '.');
                                company_lng = company_lng.Replace(',', '.');
                                camera      = CameraPosition.FromCamera(latitude: Convert.ToDouble(company_lat, CultureInfo.InvariantCulture),
                                                                        longitude: Convert.ToDouble(company_lng, CultureInfo.InvariantCulture),
                                                                        zoom: zoom);
                            }
                        }
                        catch { }
                        if (String.IsNullOrEmpty(lat_temporary) && String.IsNullOrEmpty(lng_temporary))
                        {
                            mapView.Camera = camera;
                        }
                    }
                }

                updated = true;
            };
            setMoscowCameraView();
            mgr.StartUpdatingLocation();
            centerPositionBn.TouchUpInside += (s, e) =>
            {
                mgr = new CLLocationManager();
                try
                {
                    lat = mgr.Location.Coordinate.Latitude.ToString().Replace(',', '.');
                    lng = mgr.Location.Coordinate.Longitude.ToString().Replace(',', '.');

                    camera = CameraPosition.FromCamera(latitude: Convert.ToDouble(lat, CultureInfo.InvariantCulture),
                                                       longitude: Convert.ToDouble(lng, CultureInfo.InvariantCulture),
                                                       zoom: zoom);
                    mapView.Camera = camera;
                }
                catch { }
            };

            try
            {
                if (company_lat == null && company_lng == null)
                {
                    try
                    {
                        var sd = await GeocodeToConsoleAsync(CompanyAddressViewController.FullCompanyAddressTemp);
                    }
                    catch
                    {
                        if (!methods.IsConnected())
                        {
                            InvokeOnMainThread(() =>
                            {
                                NoConnectionViewController.view_controller_name = GetType().Name;
                                this.NavigationController.PushViewController(sb.InstantiateViewController(nameof(NoConnectionViewController)), false);
                                return;
                            });
                        }
                        return;
                    }
                }
                else
                {
                    CLLocationCoordinate2D coord = new CLLocationCoordinate2D(Convert.ToDouble(company_lat, CultureInfo.InvariantCulture), Convert.ToDouble(company_lng, CultureInfo.InvariantCulture));
                    var marker = Marker.FromPosition(coord);
                    //marker.Title = string.Format("Marker 1");
                    marker.Icon = UIImage.FromBundle("add_loc_marker.png");
                    marker.Map  = mapView;
                    company_lat = company_lat.Replace(',', '.');
                    company_lng = company_lng.Replace(',', '.');
                    camera      = CameraPosition.FromCamera(latitude: Convert.ToDouble(company_lat, CultureInfo.InvariantCulture),
                                                            longitude: Convert.ToDouble(company_lng, CultureInfo.InvariantCulture),
                                                            zoom: zoom);
                    mapView.Camera = camera;
                }
            }
            catch { }
            applyAddressBn.TouchUpInside += (s, e) =>
            {
                CompanyAddressViewController.changedSomething = true;
                if (!String.IsNullOrEmpty(lat_temporary) && !String.IsNullOrEmpty(lng_temporary))
                {
                    company_lat = lat_temporary;
                    company_lng = lng_temporary;
                }
                else
                {
                    try
                    {
                        company_lat = mgr.Location.Coordinate.Latitude.ToString().Replace(',', '.');
                        company_lng = mgr.Location.Coordinate.Longitude.ToString().Replace(',', '.');
                    }
                    catch { }
                }
                CompanyAddressViewController.came_from_map = true;
                this.NavigationController.PopViewController(true);
            };
        }
Esempio n. 38
0
        /// <summary>
        /// Return fixed camera up vector for each location
        /// </summary>
        /// <param name="camPos"></param>
        /// <returns></returns>
        private Vector3 CamUpVectHelper(CameraPosition camPos)
        {
            Vector3 pos = new Vector3();

            switch (camPos)
            {
                case CameraPosition.Corner:
                    pos.x = pos.z = 0.0f;
                    pos.y = 1.0f;
                    break;

                case CameraPosition.Front:
                    pos.x = pos.z = 0.0f;
                    pos.y = 1.0f;
                    break;

                case CameraPosition.Top:
                    pos.x = pos.y = 0.0f;
                    pos.z = -1.0f;
                    break;

            }

            return pos;
        }
Esempio n. 39
0
 public void SetLateralCamera()
 {
     previousCameraPos          = actualCameraPos;
     actualCameraPos            = CameraPosition.LATERAL;
     needToChangeCameraPosition = true;
 }
Esempio n. 40
0
        /// <summary>
        /// Constructor
        /// </summary>
        public OpenGLPanelViewState()
        {
            ang3D = 0;
            viewZoom = 1;
            viewZoomLinear = 0;

            viewOffset = new Vector2(0.0f, 0.0f);
            viewTempOffset = new Vector2(0.0f, 0.0f);

            drawNutrientInitialPos = false;

             crossSection = new Boundary(BoundaryShapes.Cuboid, 100, 100, 5, 0);
            crossSectionFacing = CrossSectionFacingDirection.Front;
            CrossSectionOffset = new Vector3(0,0,0);
            crossSectionEnabled = false;

            currentCameraPos = CameraPosition.Corner;
            nextCameraPos = CameraPosition.Front;
            animationCounter = 0.0f;
            angAboutY = 0.0f;
            oldAngAboutY = 0.0f;

            currentCamCoords = new Vector3(80.0f, 80.0f, 80.0f);
            oldCamCoords = new Vector3(0.0f, 0.0f, 0.0f);
            currentUpVect = new Vector3(0.0f, 1.0f, 0.0f);
            oldUpVect = new Vector3(0.0f, 0.0f, 0.0f);
        }
Esempio n. 41
0
 public void SetBackCamera()
 {
     previousCameraPos          = actualCameraPos;
     actualCameraPos            = CameraPosition.BACK;
     needToChangeCameraPosition = true;
 }
        public async void getCurrentLoc(GoogleMap gMap)
        {
            try
            {
                var request  = new GeolocationRequest(GeolocationAccuracy.Medium);
                var location = await Geolocation.GetLocationAsync(request);



                if (location != null)
                {
                    MarkerOptions curLocMarker = new MarkerOptions();
                    curLocMarker.SetPosition(new LatLng(location.Latitude, location.Longitude));
                    curLocMarker.SetTitle("I am here");
                    curLocMarker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen));
                    gMap.AddMarker(curLocMarker);



                    //Code to Zoom at Location
                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(new LatLng(location.Latitude, location.Longitude));
                    builder.Zoom(18);
                    builder.Bearing(155);
                    builder.Tilt(65);



                    var address = await Geocoding.GetPlacemarksAsync(location);

                    var placemark      = address?.FirstOrDefault();
                    var geocodeAddress = "";
                    if (placemark != null)
                    {
                        geocodeAddress =
                            $"AdminArea:       {placemark.AdminArea}\n" +
                            $"CountryCode:     {placemark.CountryCode}\n" +
                            $"CountryName:     {placemark.CountryName}\n" +
                            $"FeatureName:     {placemark.FeatureName}\n" +
                            $"Locality:        {placemark.Locality}\n" +
                            $"PostalCode:      {placemark.PostalCode}\n" +
                            $"SubAdminArea:    {placemark.SubAdminArea}\n" +
                            $"SubLocality:     {placemark.SubLocality}\n" +
                            $"SubThoroughfare: {placemark.SubThoroughfare}\n" +
                            $"Thoroughfare:    {placemark.Thoroughfare}\n";
                    }



                    Toast.MakeText(this, geocodeAddress, ToastLength.Long);
                }
                else
                {
                    GetLastLocation(gMap);
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, "Exception encountered", ToastLength.Long);
                GetLastLocation(gMap);
            }
        }
Esempio n. 43
0
        public void SetupMatricesSolarSystem(bool forStars)
        {
            Lighting = Settings.Active.SolarSystemLighting;

            Space = false;
            if (SolarSystemTrack != SolarSystemObjects.Custom && SolarSystemTrack != SolarSystemObjects.Undefined)
            {
                ViewCamera.ViewTarget = Planets.GetPlanetTargetPoint(SolarSystemTrack, ViewCamera.Lat, ViewCamera.Lng, 0);
            }
            RenderTriangle.CullInside = false;


            double cameraDistance = SolarSystemCameraDistance;

            Matrix3d trackingMatrix = Matrix3d.Identity;

            cameraDistance -= 0.000001;

            bool activeTrackingFrame = false;

            if (SolarSystemTrack == SolarSystemObjects.Custom && !string.IsNullOrEmpty(TrackingFrame))
            {
                activeTrackingFrame = true;
                FrameTarget target = LayerManager.GetFrameTarget(this, TrackingFrame);
                ViewCamera.ViewTarget = target.Target;
                trackingMatrix        = target.Matrix;
            }
            else if (!string.IsNullOrEmpty(TrackingFrame))
            {
                TrackingFrame = "";
            }


            Vector3d center = ViewCamera.ViewTarget;
            //Vector3d lightPosition = -center;

            double   localZoom = ViewCamera.Zoom * 20;
            Vector3d lookAt    = new Vector3d();

            Matrix3d viewAdjust = Matrix3d.Identity;

            viewAdjust.Multiply(Matrix3d.RotationX(((-ViewCamera.Lat) / 180f * Math.PI)));
            viewAdjust.Multiply(Matrix3d.RotationY(((-ViewCamera.Lng) / 180f * Math.PI)));

            Matrix3d lookAtAdjust = Matrix3d.Identity;


            bool dome = false;

            Vector3d lookUp;


            if (useSolarSystemTilt && !SandboxMode)
            {
                double angle = ViewCamera.Angle;
                if (cameraDistance > 0.0008)
                {
                    angle = 0;
                }
                else if (cameraDistance > 0.00001)
                {
                    double val = Math.Min(1.903089987, Util.Log10(cameraDistance) + 5) / 1.903089987;

                    angle = angle * Math.Max(0, 1 - val);
                }



                CameraPosition = Vector3d.Create(
                    (Math.Sin(-ViewCamera.Rotation) * Math.Sin(angle) * cameraDistance),
                    (Math.Cos(-ViewCamera.Rotation) * Math.Sin(angle) * cameraDistance),
                    ((Math.Cos(angle) * cameraDistance)));
                lookUp = Vector3d.Create(Math.Sin(-ViewCamera.Rotation), Math.Cos(-ViewCamera.Rotation), 0.00001f);
            }
            else
            {
                CameraPosition = Vector3d.Create(0, 0, ((cameraDistance)));

                lookUp = Vector3d.Create(Math.Sin(-ViewCamera.Rotation), Math.Cos(-ViewCamera.Rotation), 0.0001f);
            }


            CameraPosition = viewAdjust.Transform(CameraPosition);

            cameraOffset = CameraPosition.Copy();

            Matrix3d tmp = trackingMatrix.Clone();

            tmp.Invert();
            cameraOffset = Vector3d.TransformCoordinate(cameraOffset, tmp);



            lookUp = viewAdjust.Transform(lookUp);


            World                = Matrix3d.Identity;
            WorldBase            = Matrix3d.Identity;
            WorldBaseNonRotating = Matrix3d.Identity;

            View = Matrix3d.MultiplyMatrix(Matrix3d.MultiplyMatrix(trackingMatrix, Matrix3d.LookAtLH(CameraPosition, lookAt, lookUp)), lookAtAdjust);


            ViewBase = View.Clone();


            Vector3d temp = Vector3d.SubtractVectors(lookAt, CameraPosition);

            temp.Normalize();
            temp = Vector3d.TransformCoordinate(temp, trackingMatrix);
            temp.Normalize();
            viewPoint = temp;



            //if (activeTrackingFrame)
            //{
            //    Vector3d atfCamPos = RenderContext11.CameraPosition;
            //    Vector3d atfLookAt = lookAt;
            //    Vector3d atfLookUp = lookUp;
            //    Matrix3d mat = trackingMatrix;
            //    mat.Invert();

            //    atfCamPos.TransformCoordinate(mat);
            //    atfLookAt.TransformCoordinate(mat);
            //    atfLookUp.TransformCoordinate(mat);
            //    atfLookAt.Normalize();
            //    atfLookUp.Normalize();

            //    CustomTrackingParams.Angle = 0;
            //    CustomTrackingParams.Rotation = 0;
            //    CustomTrackingParams.DomeAlt = viewCamera.DomeAlt;
            //    CustomTrackingParams.DomeAz = viewCamera.DomeAz;
            //    CustomTrackingParams.TargetReferenceFrame = "";
            //    CustomTrackingParams.ViewTarget = viewCamera.ViewTarget;
            //    CustomTrackingParams.Zoom = viewCamera.Zoom;
            //    CustomTrackingParams.Target = SolarSystemObjects.Custom;


            //    Vector3d atfLook = atfCamPos - atfLookAt;
            //    atfLook.Normalize();



            //    Coordinates latlng = Coordinates.CartesianToSpherical2(atfLook);
            //    CustomTrackingParams.Lat = latlng.Lat;
            //    CustomTrackingParams.Lng = latlng.Lng - 90;

            //    Vector3d up = Coordinates.GeoTo3dDouble(latlng.Lat + 90, latlng.Lng - 90);
            //    Vector3d left = Vector3d.Cross(atfLook, up);

            //    double dotU = Math.Acos(Vector3d.Dot(atfLookUp, up));
            //    double dotL = Math.Acos(Vector3d.Dot(atfLookUp, left));

            //    CustomTrackingParams.Rotation = dotU;// -Math.PI / 2;
            //}


            double radius = Planets.GetAdjustedPlanetRadius((int)SolarSystemTrack);


            if (cameraDistance < radius * 2.0 && !forStars)
            {
                nearPlane = cameraDistance * 0.03;

                //m_nearPlane = Math.Max(m_nearPlane, .000000000030);
                nearPlane = Math.Max(nearPlane, .00000000001);
                back      = 1900;
            }
            else
            {
                if (forStars)
                {
                    back      = 900056;
                    back      = cameraDistance > 900056 ? cameraDistance * 3 : 900056;
                    nearPlane = .00003f;

                    // m_nearPlane = cameraDistance * 0.03;

                    // back = 9937812653;
                    //  back = 21421655730;
                }
                else
                {
                    back = cameraDistance > 1900 ? cameraDistance + 200 : 1900;

                    // m_nearPlane = .0001f;
                    if (Settings.Active.SolarSystemScale < 13)
                    {
                        nearPlane = (float)Math.Min(cameraDistance * 0.03, 0.01);
                    }
                    else
                    {
                        nearPlane = .001f;
                    }
                }
            }


            Projection     = Matrix3d.PerspectiveFovLH((fovLocal), (double)Width / (double)Height, nearPlane, back);
            PerspectiveFov = fovLocal;
            fovAngle       = ((this.ViewCamera.Zoom) / FOVMULT) / Math.PI * 180;
            fovScale       = (fovAngle / Height) * 3600;

            SetMatrixes();
            MakeFrustum();
        }
Esempio n. 44
0
 public void SwitchCameras(CameraPosition desiredCam)
 {
     foreach (Camera camera in cameras)
     {
         if (camera != null && (desiredCam != GetCamPosition(camera)))
         {
             // turn camera off
             camera.enabled = false;
             camera.tag = "Untagged";
         }
         else
         {
             // turn camera on
             camera.enabled = true;
             camera.tag = "MainCamera";
         }
     }
 }
 // Use this for initialization
 void Start()
 {
     script = this;
 }
 public override Point3f Transform(Point2f imagePoint, CameraPosition cameraPosition)
 {
     //Camera.
     return(default(Point3f));
 }
    // Use this for initialization
    void Start()
    {
        characterMovement = GameObject.FindWithTag ("Player").GetComponent<CharacterMovement> ();
        characterFollower = GameObject.FindWithTag ("Player").transform;

        firstPersonCameraPosition = new CameraPosition ();
        firstPersonCameraPosition.Init (
            "First Person Camera",
            new Vector3 (0f, 1.7f, 0.5f),
            new GameObject ().transform,
            characterFollower
        );
    }
Esempio n. 48
0
    /// <summary>
    /// Instantiates and places rotation buttons onto the correct canvas.
    /// </summary>
    private void PlaceRotationButtons()
    {
        //If more than two walls no need for rotation buttons.
        if (immersiveCamera.WallCount > 2)
        {
            return;
        }

        // 1. Work out the start CameraPosition and physical camera position.
        if (immersiveCamera.WallCount == 1)
        {
            camPos = CameraPosition.Center;
        }
        else
        {
            camPos = immersiveCamera.HasLeftWall ? CameraPosition.Left : CameraPosition.Right;
        }

        // 2. Handle Single Wall case
        if (immersiveCamera.WallCount == 1)
        {
            // 2.1. Find Canvas which is in use.
            Canvas canvas = null;
            switch (immersiveCamera.surfaces[0].position)
            {
            case SurfacePosition.Left: canvas = immersiveCamera.leftUICamera.GetComponent <UICamera>().canvas; break;

            case SurfacePosition.Center: canvas = immersiveCamera.centerUICamera.GetComponent <UICamera>().canvas; break;

            case SurfacePosition.Right: canvas = immersiveCamera.rightUICamera.GetComponent <UICamera>().canvas; break;
            }

            // 2.2. Instantiate and setup Rotate Left and Right button.
            moveLeftButton  = Instantiate(moveLeftButtonPrefab, canvas.transform);
            moveRightButton = Instantiate(moveRightButtonPrefab, canvas.transform);
        }

        // 3. Handle Double Wall case
        if (immersiveCamera.WallCount == 2)
        {
            // 3.1. Find Center Canvas
            var centerCanvas = immersiveCamera.centerUICamera.GetComponent <UICamera>().canvas;

            // 3.2. Hand Left and Center Wall case.
            if (immersiveCamera.HasLeftWall)
            {
                // 3.2.1. Find Left Canvas
                var leftCanvas = immersiveCamera.leftUICamera.GetComponent <UICamera>().canvas;

                // 3.2.2. Instantiate and setup Rotate Left and Right button.
                moveLeftButton  = Instantiate(moveLeftButtonPrefab, leftCanvas.transform);
                moveRightButton = Instantiate(moveRightButtonPrefab, centerCanvas.transform);
            }

            // 3.3. Hand Right and Center Wall case.
            else
            {
                // 3.3.1. Find Right Canvas
                var rightCanvas = immersiveCamera.rightUICamera.GetComponent <UICamera>().canvas;

                // 3.3.2. Instantiate and setup Rotate Left and Right button.
                moveLeftButton  = Instantiate(moveLeftButtonPrefab, centerCanvas.transform);
                moveRightButton = Instantiate(moveRightButtonPrefab, rightCanvas.transform);
            }
        }

        // 4. Pass references to instantiated buttons.
        moveLeftButton.GetComponent <MoveLeftTrigger>().immersiveCamera             = immersiveCamera;
        moveLeftButton.GetComponent <MoveLeftTrigger>().rotationButtonsController   = this;
        moveRightButton.GetComponent <MoveRightTrigger>().immersiveCamera           = immersiveCamera;
        moveRightButton.GetComponent <MoveRightTrigger>().rotationButtonsController = this;

        // 5. Enable and disable buttons.
        EnableDisableRotationButtons();
    }
 public abstract Point3f Transform(Point2f imagePoint, CameraPosition cameraPosition);
Esempio n. 50
0
    public void LoadData()
    {
        ArrayList data = XMLHandler.LoadXML(dir+filename);

        if(data.Count > 0)
        {
            foreach(Hashtable entry in data)
            {
                if(entry[XMLHandler.NODE_NAME] as string == CameraPositionData.CAMERAPOSITIONS)
                {
                    if(entry.ContainsKey(XMLHandler.NODES))
                    {
                        ArrayList subs = entry[XMLHandler.NODES] as ArrayList;
                        name = new string[subs.Count];
                        cam = new CameraPosition[subs.Count];
                        foreach(Hashtable val in subs)
                        {
                            if(val[XMLHandler.NODE_NAME] as string == CameraPositionData.CAMERAPOSITION)
                            {
                                int i = int.Parse((string)val["id"]);
                                cam[i] = new CameraPosition();
                                if(val.ContainsKey("lookat"))
                                {
                                    cam[i].lookAt = true;
                                }
                                if(val.ContainsKey("local"))
                                {
                                    cam[i].localPoint = true;
                                }
                                if(val.ContainsKey("child"))
                                {
                                    cam[i].targetChild = true;
                                    cam[i].childName = val["child"] as string;
                                }
                                if(val.ContainsKey("ignorexrotation")) cam[i].ignoreXRotation = true;
                                if(val.ContainsKey("ignoreyrotation")) cam[i].ignoreYRotation = true;
                                if(val.ContainsKey("ignorezrotation")) cam[i].ignoreZRotation = true;
                                if(val.ContainsKey("fov"))
                                {
                                    cam[i].setFoV = true;
                                    cam[i].fieldOfView = float.Parse((string)val["fov"]);
                                }

                                ArrayList s = val[XMLHandler.NODES] as ArrayList;
                                foreach(Hashtable ht in s)
                                {
                                    if(ht[XMLHandler.NODE_NAME] as string == CameraPositionData.NAME)
                                    {
                                        name[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == CameraPositionData.POSITION)
                                    {
                                        cam[i].position.x = float.Parse((string)ht["x"]);
                                        cam[i].position.y = float.Parse((string)ht["y"]);
                                        cam[i].position.z = float.Parse((string)ht["z"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == CameraPositionData.ROTATION)
                                    {
                                        cam[i].rotation.x = float.Parse((string)ht["x"]);
                                        cam[i].rotation.y = float.Parse((string)ht["y"]);
                                        cam[i].rotation.z = float.Parse((string)ht["z"]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
        public override void LoadView()
        {
            base.LoadView();

            LoadingScreen.Show();

            string role       = "";
            string searchText = "";
            double lattitude  = 21.17024;
            double longitude  = 72.831062;

            var apiCall = new ServiceApi().GetUserLocation(lattitude, longitude, searchText, role);

            apiCall.HandleError(null, true);

            apiCall.OnSucess(response =>
            {
                LoadingScreen.Hide();

                var data    = response.Result.RecordList.Count;
                var records = response.Result.RecordList;

                //List<object> abc = new List<object>();

                for (var i = 0; i < data; i++)
                {
                    var result = records[i];

                    var mapcamera = CameraPosition.FromCamera(latitude: result.Lattitude,
                                                              longitude: result.Longitude,
                                                              zoom: 5);
                    mapView = MapView.FromCamera(CGRect.Empty, mapcamera);
                    mapView.MyLocationEnabled         = true;
                    mapView.Settings.MyLocationButton = true;
                    mapView.MyLocationEnabled         = true;
                    mapView.Settings.SetAllGesturesEnabled(true);

                    //abc.Add(new { Title = result.DisplayName, Snippet = result.Address1, Position = new CLLocationCoordinate2D(result.Lattitude, result.Longitude), Map = mapView });
                }

                foreach (var mark in records)
                {
                    var marker = new Marker()
                    {
                        Title    = mark.DisplayName + " - " + mark.PhoneNumber,
                        Snippet  = mark.PhoneNumber + " - " + mark.DisplayName + " - " + mark.Image + " - " + mark.Address1 + " - " + mark.eMailAddress + " - " + mark.Rating,
                        Position = new CLLocationCoordinate2D(mark.Lattitude, mark.Longitude),
                        Map      = mapView,
                    };
                }

                mapView.TappedMarker = (mapView, marker) =>
                {
                    mapView.MarkerInfoWindow = new GMSInfoFor(markerInfoWindow);
                    string[] marker_data     = marker.Title.Split('-');
                    if (marker_data.Length > 0)
                    {
                        CommonClass.Name = marker_data[0].Trim();

                        if (marker_data.Length > 1)
                        {
                            CommonClass.MobileNumber = marker_data[1].Trim();
                        }
                    }
                    return(false);
                };

                UIView markerInfoWindow(UIView view, Marker m)
                {
                    UIView iWindow = v.Create();
                    return(iWindow);
                }

                //Use tp detect tap on the Marker Info Window
                mapView.InfoTapped += (sender, e) =>
                {
                    string[] info_data = e.Marker.Snippet.Split('-');
                    if (info_data.Length > 0)
                    {
                        number  = info_data[0].Trim();
                        name    = info_data[1].Trim();
                        image   = info_data[2].Trim();
                        address = info_data[3].Trim();
                        email   = info_data[4].Trim();
                        rating  = Convert.ToInt32(info_data[5].Trim());
                    }

                    var controller = Storyboard.InstantiateViewController <ProviderProfileViewController>();

                    controller.Name         = name;
                    controller.MobileNumber = number;
                    controller.Addres       = address;
                    controller.Image        = image;
                    controller.EmailID      = email;
                    controller.Rating       = rating;

                    NavigationController.PushViewController(controller, true);

                    //UIAlertView alert = new UIAlertView()
                    //{
                    //    Title = "Alert",
                    //    Message = "Clicked" + e.Marker.Title
                    //};
                    //alert.AddButton("OK");
                    //alert.Show();
                };

                //for (var j = 0; j < abc.Count; j++)
                //{
                //    var d = abc[j];
                //}

                //for (var j = 0; j < data; j++)
                //{
                //    foreach(var i in values)
                //    {
                //        var marker = new Marker()
                //        {
                //            Title = i.DisplayName,
                //            Snippet = i.Address1,
                //            Position = new CLLocationCoordinate2D(i.Lattitude, i.Longitude),
                //            Map = mapView,
                //        };
                //    }
                //}

                View = mapView;
            });


            //var camera = CameraPosition.FromCamera(latitude: 21.183549,
            //                                       longitude: 72.783175,
            //                                zoom: 5);
            //mapView = MapView.FromCamera(CGRect.Empty, camera);
            //mapView.MyLocationEnabled = true;
            //mapView.Settings.MyLocationButton = true;
            //mapView.MyLocationEnabled = true;
            //mapView.Settings.SetAllGesturesEnabled(true);
            //mapView.MapType = MapViewType.Satellite;


            //Marker
            //var first_marker = new Marker()
            //{
            //    Title = "Jim",
            //    //Snippet = "Surat, Gujarat",
            //    Position = new CLLocationCoordinate2D(21.183549, 72.783175),
            //    Map = mapView,
            //};

            //var second_marker = new Marker()
            //{
            //    Title = "Thomas",
            //    //Snippet = "Surat, Gujarat",
            //    Position = new CLLocationCoordinate2D(21.186312, 73.783175),
            //    Map = mapView
            //};

            //Customize Marker
            //second_marker.Icon = UIImage.FromFile("icon-marker-30");

            //View = mapView;
        }
Esempio n. 52
0
    public void TravelToPoint(CameraPosition pos)
    {
        SetPointLimit(pos.v2_Distance, pos.v2_PitchAngle);

        Transform camTrans = tran_Camera.transform;

        Vector3 desiredPos   = pos.v3_CenterPos - Vector3.Project(pos.v3_CenterPos - pos.v3_TranPos, pos.v3_TranFor);
        float   newDistance  = Vector3.Distance(desiredPos, pos.v3_CenterPos);
        Vector3 newOffset    = pos.v3_TranOffset == Vector3.zero ? pos.v3_TranPos - desiredPos : pos.v3_TranOffset;
        Vector3 newViewAngle = pos.v3_TranRot;

        Vector3 oldViewAngle = camTrans.eulerAngles;
        //print(newViewAngle - oldViewAngle);
        float   oldDistance = orbit.Distance;
        Vector3 oldOffset   = orbit.ROffset;

        float time = time_Shift;

        StopAllCoroutines();
        orbit.PauseInput(time + 0.1f);

        //shifting
        iTween.MoveTo(orbit.target.gameObject, iTween.Hash("position", pos.v3_CenterPos, "time", time, "easeType", posEaseType));

        //shift view angles
        float anplyYDiff = oldViewAngle.y - newViewAngle.y;
        float anglyXDiff = oldViewAngle.x - newViewAngle.x;

        if (Mathf.Abs(anplyYDiff) > 180)
        {
            newViewAngle = new Vector3(newViewAngle.x, oldViewAngle.y + (anplyYDiff > 0 ? 360 - anplyYDiff : -(360 + anplyYDiff)), newViewAngle.z);
        }

        if (Mathf.Abs(anglyXDiff) > 180)
        {
            newViewAngle = new Vector3(oldViewAngle.x + (anglyXDiff > 0 ? 360 - anglyXDiff : -(360 + anglyXDiff)), newViewAngle.y, newViewAngle.z);
        }

        iTween.ValueTo(tran_Camera.gameObject, iTween.Hash(
                           "from", oldViewAngle,
                           "to", newViewAngle,
                           "time", time,
                           "onupdatetarget", tran_Camera.gameObject,
                           "onupdate", "OnViewAngle",
                           "easetype", rotEaseType));

        //shift view distance
        iTween.ValueTo(tran_Camera.gameObject, iTween.Hash(
                           "from", oldDistance,
                           "to", newDistance,
                           "time", time,
                           "onupdatetarget", tran_Camera.gameObject,
                           "onupdate", "OnDistance",
                           "easetype", rotEaseType));

        //shift view offset
        iTween.ValueTo(tran_Camera.gameObject, iTween.Hash(
                           "from", oldOffset,
                           "to", newOffset,
                           "time", time,
                           "onupdatetarget", tran_Camera.gameObject,
                           "onupdate", "OnPanOffset",
                           "easetype", rotEaseType));
    }
Esempio n. 53
0
 // Use this for initialization
 void Start()
 {
     charMot = GetComponent<CharacterMotor>();
     lineOfSight = GameObject.Find("Main Camera").GetComponent<LineOfSight>();
     cameraPos = GameObject.Find("Main Camera").GetComponent<CameraPosition>();
 }
Esempio n. 54
0
        public async void OnLocationChanged(Location location)
        {
            map.Clear();
            //мои координаты
            double Mylat      = location.Latitude;
            double Mylng      = location.Longitude;
            LatLng startPoint = new LatLng(Mylat, Mylng);

            double MyLatitude  = Intent.GetDoubleExtra("latitude", 1);
            double MyLongitude = Intent.GetDoubleExtra("longitude", 1);
            LatLng endPoint    = new LatLng(MyLatitude, MyLongitude);

            MarkerOptions Point = new MarkerOptions().SetPosition(startPoint).SetTitle("Position").SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.human));

            map.AddMarker(Point);

            MarkerOptions makerOptions1 = new MarkerOptions().SetPosition(endPoint).SetTitle("ENDPOINT").SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.bank));

            map.AddMarker(makerOptions1);

            //Путь
            string start = convertPoint2String(startPoint);
            string end   = convertPoint2String(endPoint);

            Console.WriteLine("START POINT NEW = " + start);
            Console.WriteLine("END POINT NEW = " + end);
            string url = "https://maps.googleapis.com/maps/api/directions/json?origin=" + start + "&destination=" + end + "&key=KEY";

            Console.WriteLine("URLSTRING " + url);

            try
            {
                Console.WriteLine("1 = ");
                JsonValue MyWay = await GetDataFromReq(url);

                var        r        = MyWay.ToString();
                RootObject jsonline = JsonConvert.DeserializeObject <RootObject>(r);
                Console.WriteLine("2 = ");
                Console.WriteLine("!!!!!!!!!!!" + r);
                List <LatLng> resultWay = new List <LatLng>();

                jsonline.routes.Where(t => t != null).ToList().ForEach(
                    tr => tr.legs.Where(lg => lg != null).ToList().ForEach(
                        lgs => lgs.steps.Where(st => st != null).ToList().ForEach(
                            legs => resultWay = resultWay.Union(DecodePolyline(legs.polyline.points)).ToList()
                            )
                        )
                    );
                resultWay.ForEach(t => Console.WriteLine("p:" + t));
                PolylineOptions opt = new PolylineOptions();
                opt.Add(resultWay.ToArray());
                map.AddPolyline(opt);
            }
            catch (Exception e) { }

            //Передвижение
            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(new LatLng(Mylat, Mylng));
            builder.Target(startPoint);
            builder.Zoom(18);
            builder.Bearing(155);
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);
        }
Esempio n. 55
0
        private async void SearchViewOnQueryTextSubmit(object sender, SearchView.QueryTextSubmitEventArgs e)
        {
            try
            {
                SearchText = e.NewText;

                if (string.IsNullOrEmpty(SearchText) || string.IsNullOrWhiteSpace(SearchText))
                {
                    return;
                }

                SearchView.ClearFocus();

                //Show a progress
                RunOnUiThread(() => { AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading)); });

                var latLng = await GetLocationFromAddress(SearchText.Replace(" ", ""));

                if (latLng != null)
                {
                    RunOnUiThread(() => { AndHUD.Shared.Dismiss(this); });

                    DeviceAddress = SearchText;

                    Lat = latLng.Latitude;
                    Lng = latLng.Longitude;

                    // Creating a marker
                    MarkerOptions markerOptions = new MarkerOptions();

                    // Setting the position for the marker
                    markerOptions.SetPosition(latLng);

                    var addresses = await ReverseGeocodeCurrentLocation(latLng);

                    if (addresses != null)
                    {
                        DeviceAddress = addresses.GetAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
                        //string city = addresses.Locality;
                        //string state = addresses.AdminArea;
                        //string country = addresses.CountryName;
                        //string postalCode = addresses.PostalCode;
                        //string knownName = addresses.FeatureName; // Only if available else return NULL

                        // Setting the title for the marker.
                        // This will be displayed on taping the marker
                        markerOptions.SetTitle(DeviceAddress);
                    }

                    // Clears the previously touched position
                    Map.Clear();

                    // Animating to the touched position
                    Map.AnimateCamera(CameraUpdateFactory.NewLatLng(latLng));

                    // Placing a marker on the touched position
                    Map.AddMarker(markerOptions);

                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(latLng);
                    builder.Zoom(18);
                    builder.Bearing(155);
                    builder.Tilt(65);

                    CameraPosition cameraPosition = builder.Build();

                    CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                    Map.MoveCamera(cameraUpdate);
                }
                else
                {
                    RunOnUiThread(() => { AndHUD.Shared.Dismiss(this); });


                    //Error Message
                    Toast.MakeText(this, GetText(Resource.String.Lbl_Error_DisplayAddress), ToastLength.Short)?.Show();
                }
            }
            catch (Exception exception)
            {
                RunOnUiThread(() => { AndHUD.Shared.Dismiss(this); });
                Methods.DisplayReportResultTrack(exception);
            }
        }
Esempio n. 56
0
 public void MoveToPosition(CameraPosition.PositionType posType, int posID)
 {
     StartCoroutine(_MoveToPosition(posID, posType));
 }
	/// <summary>
	/// Use this for initialization.
	/// </summary>
	void Start ()
	{
		parentRig = this.transform.parent;
		if (parentRig == null)
		{
			Debug.LogError("Parent camera to empty GameObject.", this);
		}
		
		follow = GameObject.FindWithTag("Player").GetComponent<CharacterControllerLogic>();
		followXform = GameObject.FindWithTag("Player").transform;
		
		lookDir = followXform.forward;
		curLookDir = followXform.forward;
		
		barEffect = GetComponent<BarsEffect>();
		if (barEffect == null)
		{
			Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
		}
		
		// Position and parent a GameObject where first person view should be
		firstPersonCamPos = new CameraPosition();
		firstPersonCamPos.Init
			(
				"First Person Camera",
				new Vector3(0.0f, 1.6f, 0.2f),
				new GameObject().transform,
				follow.transform
			);	
	}
Esempio n. 58
0
        public void OnMapReady(GoogleMap googleMap)
        {
            try
            {
                Map = googleMap;

                var makerOptions = new MarkerOptions();
                makerOptions.SetPosition(new LatLng(Lat, Lng));
                makerOptions.SetTitle(GetText(Resource.String.Lbl_Location));

                Map.AddMarker(makerOptions);
                Map.MapType = GoogleMap.MapTypeNormal;

                switch (AppSettings.SetTabDarkTheme)
                {
                case true:
                {
                    MapStyleOptions style = MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.map_dark);
                    Map.SetMapStyle(style);
                    break;
                }
                }

                //Optional
                googleMap.UiSettings.ZoomControlsEnabled = true;
                googleMap.UiSettings.CompassEnabled      = true;

                OnLocationChanged();

                googleMap.MoveCamera(CameraUpdateFactory.ZoomIn());

                LatLng location = new LatLng(Lat, Lng);

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(18);
                builder.Bearing(155);
                builder.Tilt(65);

                CameraPosition cameraPosition = builder.Build();

                CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                googleMap.MoveCamera(cameraUpdate);

                googleMap.MapClick += async(sender, e) =>
                {
                    try
                    {
                        LatLng latLng      = e.Point;
                        var    tapTextView = "Tapped: Point=" + e.Point;
                        Console.WriteLine(tapTextView);

                        Lat = latLng.Latitude;
                        Lng = latLng.Longitude;

                        // Creating a marker
                        MarkerOptions markerOptions = new MarkerOptions();

                        // Setting the position for the marker
                        markerOptions.SetPosition(e.Point);

                        var addresses = await ReverseGeocodeCurrentLocation(latLng);

                        if (addresses != null)
                        {
                            DeviceAddress = addresses.GetAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
                            //string city = addresses.Locality;
                            //string state = addresses.AdminArea;
                            //string country = addresses.CountryName;
                            //string postalCode = addresses.PostalCode;
                            //string knownName = addresses.FeatureName; // Only if available else return NULL

                            // Setting the title for the marker.
                            // This will be displayed on taping the marker
                            markerOptions.SetTitle(DeviceAddress);
                        }

                        // Clears the previously touched position
                        googleMap.Clear();

                        // Animating to the touched position
                        googleMap.AnimateCamera(CameraUpdateFactory.NewLatLng(e.Point));

                        // Placing a marker on the touched position
                        googleMap.AddMarker(markerOptions);
                    }
                    catch (Exception exception)
                    {
                        Methods.DisplayReportResultTrack(exception);
                    }
                };

                googleMap.MapLongClick += (sender, e) =>
                {
                    try
                    {
                        var tapTextView = "Long Pressed: Point=" + e.Point;
                        Console.WriteLine(tapTextView);
                    }
                    catch (Exception exception)
                    {
                        Methods.DisplayReportResultTrack(exception);
                    }
                };

                googleMap.CameraChange += (sender, e) =>
                {
                    try
                    {
                        var cameraTextView = e.Position.ToString();
                        Console.WriteLine(cameraTextView);
                    }
                    catch (Exception exception)
                    {
                        Methods.DisplayReportResultTrack(exception);
                    }
                };
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
	/// <summary>
	/// Use this for initialization.
	/// </summary>
	void Start ()
	{
		cameraXform = this.transform;//.parent;
		if (cameraXform == null)
		{
			Debug.LogError("Parent camera to empty GameObject.", this);
		}
		
		follow = GameObject.FindWithTag("Player").GetComponent<CharacterControllerLogic>();
		followXform = GameObject.FindWithTag("Player").transform;
		
		lookDir = followXform.forward;
		curLookDir = followXform.forward;
		
		barEffect = GetComponent<BarsEffect>();
		if (barEffect == null)
		{
			Debug.LogError("Attach a widescreen BarsEffect script to the camera.", this);
		}
		
		// Position and parent a GameObject where first person view should be
		firstPersonCamPos = new CameraPosition();
		firstPersonCamPos.Init
			(
				"First Person Camera",
				new Vector3(0.0f, 1.6f, 0.2f),
				new GameObject().transform,
				follow.transform
			);	

		camState = startingState;

		// Intialize values to avoid having 0s
		characterOffset = followXform.position + new Vector3(0f, distanceUp, 0f);
		distanceUpFree = distanceUp;
		distanceAwayFree = distanceAway;
		savedRigToGoal = RigToGoalDirection;
	}
Esempio n. 60
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Map_);
            lat_tmp = "";
            lng_tmp = "";

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();

                lat_temp_NEW_start_activity = null;
                lng_temp_NEW_start_activity = null;
            }
            _mapFragment.GetMapAsync(this);

            placesOfInterstInfo.places_of_interest();

            if (ChangeDestination.changedDestinationIndicator != true)
            {
                if (Tours_detail.searchOrMovieAdapterIndicator == "MovieAdapter" || String.IsNullOrWhiteSpace(Tours_detail.searchOrMovieAdapterIndicator))
                {
                    lat_temp_NEW_start_activity = Activities.NEWstartActivity.lat;
                    lng_temp_NEW_start_activity = Activities.NEWstartActivity.lon;

                    //CultureInfo.InvariantCulture to prevent troubles while executing Convert.ToDouble in different language settings
                    LatLng location = new LatLng(Convert.ToDouble(lat_temp_NEW_start_activity, (CultureInfo.InvariantCulture)),
                                                 Convert.ToDouble(lng_temp_NEW_start_activity, (CultureInfo.InvariantCulture)));

                    /*lat_temp_NEW_start_activity = "";
                    *  lng_temp_NEW_start_activity = "";*/
                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(location);
                    builder.Zoom(15);

                    /*builder.Bearing(155);
                     * builder.Tilt(65);*/
                    CameraPosition cameraPosition = builder.Build();
                    cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                    _mapFragment.GetMapAsync(this);
                }
                else if (Tours_detail.searchOrMovieAdapterIndicator == "SearchAdapter")
                {
                    foreach (var o in SearchAdapter.experiencesStatic)
                    {
                        if (!String.IsNullOrWhiteSpace(o.lat) && !String.IsNullOrWhiteSpace(o.lng))
                        {
                            /*lat_tmp = o.lat;
                            *  lng_tmp = o.lng;*/
                            foreach (char c in o.lat)
                            {
                                if (c == ',')
                                {
                                    lat_tmp += ".";
                                }
                                else
                                {
                                    lat_tmp += c;
                                }
                            }
                            foreach (char c in o.lng)
                            {
                                if (c == ',')
                                {
                                    lng_tmp += ".";
                                }
                                else
                                {
                                    lng_tmp += c;
                                }
                            }

                            lat_search_target_users_position = Convert.ToDouble(lat_tmp, (CultureInfo.InvariantCulture)) + 0.005;
                            lng_search_target_users_position = Convert.ToDouble(lng_tmp, (CultureInfo.InvariantCulture)) + 0.005;

                            lat_tmp = "";
                            lng_tmp = "";
                        }
                    }
                    //centring camera on target location
                    LatLng target_location;

                    if (lat_search_target_users_position != 0 && lng_search_target_users_position != 0)
                    {
                        target_location = new LatLng(lat_search_target_users_position, lng_search_target_users_position);
                    }
                    else
                    {
                        string lat_replaced = NEWstartActivity.lat;
                        string lng_replaced = NEWstartActivity.lon;
                        if (lat_replaced.Contains(","))
                        {
                            lat_replaced = NEWstartActivity.lat.Replace(',', '.');
                        }
                        if (lng_replaced.Contains(","))
                        {
                            lng_replaced = NEWstartActivity.lon.Replace(',', '.');
                        }
                        target_location = new LatLng(Convert.ToDouble(lat_replaced, (CultureInfo.InvariantCulture)),
                                                     Convert.ToDouble(lng_replaced, (CultureInfo.InvariantCulture)));
                    }

                    CameraPosition.Builder target_builder = CameraPosition.InvokeBuilder();
                    target_builder.Target(target_location);
                    target_builder.Zoom(15);
                    CameraPosition target_cameraPosition = target_builder.Build();
                    cameraUpdate = CameraUpdateFactory.NewCameraPosition(target_cameraPosition);
                    _mapFragment.GetMapAsync(this);
                    //centring camera on target location ENDED
                }
            }
            else if (ChangeDestination.changedDestinationIndicator == true)
            {
                if (Tours_detail.searchOrMovieAdapterIndicator != "SearchAdapter")
                {
                    LatLng target_location = new LatLng(Convert.ToDouble(ChangeDestination.lat, (CultureInfo.InvariantCulture)),
                                                        Convert.ToDouble(ChangeDestination.lng, (CultureInfo.InvariantCulture)));
                    CameraPosition.Builder target_builder = CameraPosition.InvokeBuilder();
                    target_builder.Target(target_location);
                    target_builder.Zoom(15);
                    CameraPosition target_cameraPosition = target_builder.Build();
                    cameraUpdate = CameraUpdateFactory.NewCameraPosition(target_cameraPosition);
                }
                else if (Tours_detail.searchOrMovieAdapterIndicator == "SearchAdapter")
                {
                    foreach (var o in SearchAdapter.experiencesStatic)
                    {
                        if (!String.IsNullOrWhiteSpace(o.lat) && !String.IsNullOrWhiteSpace(o.lng))
                        {
                            /*lat_tmp = o.lat;
                            *  lng_tmp = o.lng;*/
                            foreach (char c in o.lat)
                            {
                                if (c == ',')
                                {
                                    lat_tmp += ".";
                                }
                                else
                                {
                                    lat_tmp += c;
                                }
                            }
                            foreach (char c in o.lng)
                            {
                                if (c == ',')
                                {
                                    lng_tmp += ".";
                                }
                                else
                                {
                                    lng_tmp += c;
                                }
                            }
                            lat_search_target_users_position = Convert.ToDouble(lat_tmp, (CultureInfo.InvariantCulture)) + 0.005;
                            lng_search_target_users_position = Convert.ToDouble(lng_tmp, (CultureInfo.InvariantCulture)) + 0.005;

                            lat_tmp = "";
                            lng_tmp = "";
                        }
                    }
                    LatLng target_location;

                    if (lat_search_target_users_position != 0 && lng_search_target_users_position != 0)
                    {
                        target_location = new LatLng(lat_search_target_users_position, lng_search_target_users_position);
                    }
                    else
                    {
                        string lat_replaced = NEWstartActivity.lat;
                        string lng_replaced = NEWstartActivity.lon;
                        if (lat_replaced.Contains(","))
                        {
                            lat_replaced = NEWstartActivity.lat.Replace(',', '.');
                        }
                        if (lng_replaced.Contains(","))
                        {
                            lng_replaced = NEWstartActivity.lon.Replace(',', '.');
                        }
                        target_location = new LatLng(Convert.ToDouble(lat_replaced, (CultureInfo.InvariantCulture)),
                                                     Convert.ToDouble(lng_replaced, (CultureInfo.InvariantCulture)));
                    }
                    CameraPosition.Builder target_builder = CameraPosition.InvokeBuilder();
                    target_builder.Target(target_location);
                    target_builder.Zoom(15);
                    CameraPosition target_cameraPosition = target_builder.Build();
                    cameraUpdate = CameraUpdateFactory.NewCameraPosition(target_cameraPosition);
                }
                _mapFragment.GetMapAsync(this);
            }
            //Button for centering the location of the user
            FindViewById <Button>(Resource.Id.centerPositionBn).Click += delegate
            {
                if (ChangeDestination.changedDestinationIndicator == false)
                {
                    if (Tours_detail.searchOrMovieAdapterIndicator == "MovieAdapter" || String.IsNullOrWhiteSpace(Tours_detail.searchOrMovieAdapterIndicator))
                    {
                        _mapFragment.GetMapAsync(this);
                    }
                    else if (Tours_detail.searchOrMovieAdapterIndicator == "SearchAdapter")
                    {
                        //centring camera on target location
                        LatLng target_location;
                        if (lat_search_target_users_position != 0 && lng_search_target_users_position != 0)
                        {
                            target_location = new LatLng(lat_search_target_users_position, lng_search_target_users_position);
                        }
                        else
                        {
                            string lat_replaced = NEWstartActivity.lat;
                            string lng_replaced = NEWstartActivity.lon;
                            if (lat_replaced.Contains(","))
                            {
                                lat_replaced = NEWstartActivity.lat.Replace(',', '.');
                            }
                            if (lng_replaced.Contains(","))
                            {
                                lng_replaced = NEWstartActivity.lon.Replace(',', '.');
                            }
                            target_location = new LatLng(Convert.ToDouble(lat_replaced
                                                                          , (CultureInfo.InvariantCulture)), Convert.ToDouble(lng_replaced,
                                                                                                                              (CultureInfo.InvariantCulture)));
                        }
                        CameraPosition.Builder target_builder = CameraPosition.InvokeBuilder();
                        target_builder.Target(target_location);
                        target_builder.Zoom(15);
                        CameraPosition target_cameraPosition = target_builder.Build();
                        cameraUpdate = CameraUpdateFactory.NewCameraPosition(target_cameraPosition);
                        _mapFragment.GetMapAsync(this);
                        //centring camera on target location ENDED
                    }
                }
                else if (ChangeDestination.changedDestinationIndicator == true)
                {
                    if (Tours_detail.searchOrMovieAdapterIndicator == "MovieAdapter")
                    {
                        LatLng target_location = new LatLng(Convert.ToDouble(ChangeDestination.lat, (CultureInfo.InvariantCulture)),
                                                            Convert.ToDouble(ChangeDestination.lng, (CultureInfo.InvariantCulture)));
                        CameraPosition.Builder target_builder = CameraPosition.InvokeBuilder();
                        target_builder.Target(target_location);
                        target_builder.Zoom(15);
                        CameraPosition target_cameraPosition = target_builder.Build();
                        cameraUpdate = CameraUpdateFactory.NewCameraPosition(target_cameraPosition);
                        _mapFragment.GetMapAsync(this);
                    }
                    else if (Tours_detail.searchOrMovieAdapterIndicator == "SearchAdapter")
                    {
                        //centring camera on target location
                        LatLng target_location;
                        if (lat_search_target_users_position != 0 && lng_search_target_users_position != 0)
                        {
                            target_location = new LatLng(lat_search_target_users_position, lng_search_target_users_position);
                        }
                        else
                        {
                            string lat_replaced = NEWstartActivity.lat;
                            string lng_replaced = NEWstartActivity.lon;
                            if (lat_replaced.Contains(","))
                            {
                                lat_replaced = NEWstartActivity.lat.Replace(',', '.');
                            }
                            if (lng_replaced.Contains(","))
                            {
                                lng_replaced = NEWstartActivity.lon.Replace(',', '.');
                            }
                            target_location = new LatLng(Convert.ToDouble(lat_replaced, (CultureInfo.InvariantCulture)),
                                                         Convert.ToDouble(lng_replaced, (CultureInfo.InvariantCulture)));
                        }
                        CameraPosition.Builder target_builder = CameraPosition.InvokeBuilder();
                        target_builder.Target(target_location);
                        target_builder.Zoom(15);
                        CameraPosition target_cameraPosition = target_builder.Build();
                        cameraUpdate = CameraUpdateFactory.NewCameraPosition(target_cameraPosition);
                        _mapFragment.GetMapAsync(this);
                        //centring camera on target location ENDED
                    }
                }
            };
        }