public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

            mapView.LongPress += HandleLongPress;

            // Add a default marker around Sydney.
            var sydneyMarker = new Marker () {
                Title = "Sydney!",
                Icon = UIImage.FromBundle ("glow-marker"),
                Position = new CLLocationCoordinate2D (-33.8683, 151.2086),
                Map = mapView
            };

            // Create a list of markers, adding the Sydney marker.
            markers = new List<Marker> () { sydneyMarker };

            // Create a button that, when pressed, updates the camera to fit the bounds
            // of the specified markers.
            var fitBoundsButton = new UIBarButtonItem ("Fit Bounds", UIBarButtonItemStyle.Plain, DidTapFitBounds);
            NavigationItem.RightBarButtonItem = fitBoundsButton;
        }
Exemple #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.NavigationController.HidesBottomBarWhenPushed = true;
            this.NavigationController.NavigationBar.Hidden = false;
            this.NavigationController.NavigationBar.TintColor = UIColor.White;
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(44/255f,146/255f,208/255f);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White });
            Title = "Map";
            CameraPosition camera = CameraPosition.FromCamera(33.4264393, -111.9868498, 6);

            mapView = MapView.FromCamera (new CGRect(0,64,UIScreen.MainScreen.Bounds.Width,UIScreen.MainScreen.Bounds.Height-64), camera);
            mapView.MyLocationEnabled = true;

            var xamMarker = new Marker () {
                Title = "",
                Snippet = "",
                Position = new CLLocationCoordinate2D (33.4264393, -111.9868498),
                Map = mapView
            };

            mapView.SelectedMarker = xamMarker;
            this.View.AddSubview (mapView);
        }
        public override void LoadView() {
            base.LoadView();

            _MapView = new MapView() {
                MyLocationEnabled = true,
            };
            _Markers.ForEach(mmi => mmi.Map = _MapView);
            _MapView.Settings.RotateGestures = false;
            _MapView.Tapped += (object tapSender, GMSCoordEventArgs coordEventArgs) => {
                UIAlertView nameInputAlertView = new UIAlertView("Add New Marker", "", null, "Cancel", new[] { "Add" }) {
                    AlertViewStyle = UIAlertViewStyle.PlainTextInput,
                };
                UITextField nameTextField = nameInputAlertView.GetTextField(0);
                nameTextField.Placeholder = "Marker name";
                nameTextField.BecomeFirstResponder();
                nameInputAlertView.Dismissed += (sender, e) => {
                    if (e.ButtonIndex != nameInputAlertView.CancelButtonIndex) {
                        MarkerInfo newMarkerInfo = new MarkerInfo() {
                            Latitude = coordEventArgs.Coordinate.Latitude,
                            Longitude = coordEventArgs.Coordinate.Longitude,
                            Name = nameTextField.Text,
                        };
                        NewMarkerCreated(this, new MarkerAddedEventArgs(newMarkerInfo));
                    }
                };
                nameInputAlertView.Show();
            };
            View = _MapView;
        }
Exemple #4
0
        public override void LoadView()
        {
            base.LoadView();
            CameraPosition camera = CameraPosition.FromCamera(37.797865, -122.402526, 0);

            mapView = Google.Maps.MapView.FromCamera(RectangleF.Empty, camera);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			MapView = new MapView ();
			InitUI ();
			View = MapView;
		}
		public override void LoadView ()
		{
			base.LoadView ();

			//Definimos una cámara y le indicamos el punto inicial donde queremos que
			//nuestro mapa aparezca así como el zoom 
			CameraPosition camera = CameraPosition.FromCamera (21.121694,-101.6641149, 12);

			//Le asignamos la cámara a nuestra variable mapView
			mapView = MapView.FromCamera (RectangleF.Empty, camera);
			mapView.MyLocationEnabled = true;

			//Definimos un Marcador para nuestro mapa
			var xamMarker = new Marker () {
				Title = "Marcador",
				Snippet = "Cuerpo del marcador",
				Position = new CLLocationCoordinate2D (21.121694,-101.6641149),
				Map = mapView
			};


			//Personalizamos la imagen de nuestro marcador
			xamMarker.Icon=UIImage.FromBundle ("p_n");

			this.View = mapView;


		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var camera = CameraPosition.FromCamera (-33.868, 151.2086, 12);
			mapView = MapView.FromCamera (CGRect.Empty, camera);
			geocoder = new Geocoder ();

			mapView.CoordinateLongPressed += (sender, e) => {
				// On a long press, reverse geocode this location.
				geocoder.ReverseGeocodeCord (e.Coordinate, (response, error) => {
					if (response != null && response.FirstResult != null) {
						var marker = new Marker () {
							Position = e.Coordinate,
							Title = response.FirstResult.AddressLine1,
							Snippet = response.FirstResult.AddressLine2,
							AppearAnimation = MarkerAnimation.Pop,
							Map = mapView
						};
					} else {
						Console.WriteLine (string.Format ("Could not reverse geocode point ({0},{1}): {2}", 
							e.Coordinate.Latitude, e.Coordinate.Longitude, error));
					}
				});
			};

			View = mapView;
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var camera = CameraPosition.FromCamera (37.78318, -122.403874, 18);
			mapView = MapView.FromCamera (CGRect.Empty, camera);
			mapView.BuildingsEnabled = false;
			View = mapView;

			// The possible floors that might be shown.
			var types = new [] { "1", "2", "3" };

			// Create a UISegmentedControl that is the navigationItem's titleView.
			switcher = new UISegmentedControl (types) {
				SelectedSegment = 0,
				ControlStyle = UISegmentedControlStyle.Bar,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
			};

			NavigationItem.TitleView = switcher;

			// Listen to touch events on the UISegmentedControl, force initial update.
			switcher.ValueChanged += DidChangeSwitcher;

			DidChangeSwitcher ();
		}
Exemple #9
0
        private void SetUI()
        {
            InvokeOnMainThread(() =>
            {
                var camera = CameraPosition.FromCamera(latitude: 17.79, longitude: 78.40, zoom: 2);
                mapView    = Google.Maps.MapView.FromCamera(MapVContainer.Bounds, camera);
                mapView.MyLocationEnabled = true;
                mapView.MapType           = MapViewType.Normal;

                mapView.Settings.MyLocationButton = true;
                mapView.MyLocationEnabled         = true;

                mapView.Settings.SetAllGesturesEnabled(true);
                mapView.Settings.ZoomGestures = true;
                //mapView.Settings.

                mapView.TranslatesAutoresizingMaskIntoConstraints = false;
                MapVContainer.AddSubview(mapView);

                MapVContainer.AddConstraints(new NSLayoutConstraint[]
                {
                    NSLayoutConstraint.Create(mapView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, MapVContainer, NSLayoutAttribute.Top, 1, 0),
                    NSLayoutConstraint.Create(mapView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, MapVContainer, NSLayoutAttribute.Bottom, 1, 0),
                    NSLayoutConstraint.Create(mapView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, MapVContainer, NSLayoutAttribute.Leading, 1, 0),
                    NSLayoutConstraint.Create(mapView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, MapVContainer, NSLayoutAttribute.Trailing, 1, 0)
                });

                SetMarkers();
            });
        }
		public override void LoadView ()
		{
			base.LoadView ();
			
			var camera = CameraPosition.FromCamera (latitude: 30.2652898, 
			                                        longitude: -97.7386826, 
			                                        zoom: 17,
			                                        bearing: 15,
			                                        viewingAngle: 15);
			mapView = MapView.FromCamera (View.Bounds, camera);
			mapView.MapType = MapViewType.Normal;
			mapView.MyLocationEnabled = true;
			//mapView.Frame = View.Frame;

			var hiltonOptions = new MarkerOptions();

			hiltonOptions.Position = new MonoTouch.CoreLocation.CLLocationCoordinate2D(30.2652898, -97.7386826);
			hiltonOptions.Title = "Evolve 2013";
			hiltonOptions.Snippet = "Austin, TX";
			mapView.AddMarker(hiltonOptions);

			View.Add (mapView);

			satelliteSwitch = new UISwitch ();
			satelliteSwitch.Frame = new RectangleF(11.0f, 11.0f, satelliteSwitch.Frame.Width, satelliteSwitch.Frame.Height);
			satelliteSwitch.On = false;
			View.Add (satelliteSwitch);

			currentLocNow = UIButton.FromType (UIButtonType.RoundedRect);
			currentLocNow.Frame = new RectangleF(50, 100, 100, 20);
			currentLocNow.Center = new PointF (View.Frame.Width/2, View.Frame.Height - 20.0f);
			currentLocNow.SetTitle ("ShowMyLoc", UIControlState.Normal);
			View.AddSubview (currentLocNow);
		}
 public void AddMarkerTo(MapView map)
 {
     Marker = new Marker () {
         Position = new CLLocationCoordinate2D(Entity.Latitude, Entity.Longitude),
         Title = Entity.Name,
         Snippet = Entity.EntityType.ToString (),
         Map = map,
         Icon = IconForCurrentIconType
     };
 }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

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

			BeginInvokeOnMainThread (()=> mapView.MyLocationEnabled = true);
			var myLocationButton = new UIBarButtonItem ("Fly to My Location", UIBarButtonItemStyle.Plain, DidTapMyLocation);
			NavigationItem.RightBarButtonItem = myLocationButton;
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var camera = CameraPosition.FromCamera (-37.809487, 144.965699, 20, 0, 0);
			mapView = MapView.FromCamera (CGRect.Empty, camera);
			mapView.Settings.ZoomGestures = false;
			mapView.Settings.ScrollGestures = false;
			mapView.Settings.RotateGestures = false;
			mapView.Settings.TiltGestures = false;

			View = mapView;
		}
        public override void LoadView()
        {
            base.LoadView ();

            var camera = CameraPosition.FromCamera (35.95, -120.50, 11);

            mapView = MapView.FromCamera(CGRect.Empty, camera);
            mapView.MyLocationEnabled = true;
            mapView.MapType = MapViewType.Terrain;

            //Load all the markers in
            LoadMarkers();
            View = mapView;
        }
        private void SetGoogleMapControl()
        {
            var mapTile = (MapTile)Element;
            var mkMap = Control as MKMapView;
            mkMap.Delegate = null; //!!!IMPORTANT!!! without this code app crashs 

            var mapView = new MapView();
            mapView.TappedMarker = (map, marker) => 
            {
                TappedMarker(marker);
                return false; 
            };

            SetNativeControl(mapView);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var camera = CameraPosition.FromCamera (-33.868, 151.2086, 12);
			mapView = MapView.FromCamera (CGRect.Empty, camera);
			mapView.Settings.CompassButton = true;
			mapView.Settings.MyLocationButton = true;

			// Listen to the myLocation property of GMSMapView.
			mapView.AddObserver (this, new NSString ("myLocation"), NSKeyValueObservingOptions.New, IntPtr.Zero);

			View = mapView;
			// Ask for My Location data after the map has already been added to the UI.
			InvokeOnMainThread (()=> mapView.MyLocationEnabled = true);
		}
        public override void LoadView()
        {
            base.LoadView();
            CameraPosition camera = CameraPosition.FromCamera(latitude: 37.797865,
                                                     longitude: -122.402526,
                                                     zoom: 6);
            mapView = MapView.FromCamera(CGRect.Empty, camera);
            mapView.MyLocationEnabled = true;
            mapView.Settings.CompassButton = true;
            mapView.Settings.MyLocationButton = true;

            View = mapView;

         

        }
		public override void LoadView ()
		{
			base.LoadView ();

			CameraPosition camera = CameraPosition.FromCamera (37.797865, -122.402526, 6);

			mapView = MapView.FromCamera (RectangleF.Empty, camera);
			mapView.MyLocationEnabled = true;
			
			mapView.AddMarker (new MarkerOptions {
				Title = "Xamarin HQ",
				Snippet = "Where the magic happens.",
				Position = new CLLocationCoordinate2D (37.797865, -122.402526)
			});

			View = mapView;
		}
		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;
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			var camera = CameraPosition.FromCamera (-37.81969, 144.966085, 4);
			mapView = MapView.FromCamera (RectangleF.Empty, camera);
			AddDefaultMarkers ();

			// Add a button which adds random markers to the map.
			var addButton = new UIBarButtonItem (UIBarButtonSystemItem.Add, DidTapAdd);
			var clearButton = new UIBarButtonItem ("Clear Markers", UIBarButtonItemStyle.Plain, (o,s) => { 
				mapView.Clear ();
				AddDefaultMarkers ();
			});

			NavigationItem.RightBarButtonItems = new [] {addButton, clearButton} ;

			View = mapView;
		}
		public override void LoadView ()
		{
			base.LoadView ();

			CameraPosition camera = CameraPosition.FromCamera (37.797865, -122.402526, 6);

			mapView = MapView.FromCamera (CGRect.Empty, camera);
			mapView.MyLocationEnabled = true;

			var xamMarker = new Marker () {
				Title = "Xamarin HQ",
				Snippet = "Where the magic happens.",
				Position = new CLLocationCoordinate2D (37.797865, -122.402526),
				Map = mapView
			};

			mapView.SelectedMarker = xamMarker;

			View = mapView;
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var camera = CameraPosition.FromCamera (-33.868, 151.2086, 12);
            mapView = MapView.FromCamera (RectangleF.Empty, camera);
            View = mapView;

            // The possible different types to show.
            // Create a UISegmentedControl that is the navigationItem's titleView.
            switcher = new UISegmentedControl (new [] {"Normal", "Satellite", "Hybrid", "Terrain"}) {
                AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin,
                SelectedSegment = 0,
                ControlStyle = UISegmentedControlStyle.Bar
            };
            NavigationItem.TitleView = switcher;

            // Listen to touch events on the UISegmentedControl.
            switcher.ValueChanged += HandleValueChanged;
        }
Exemple #23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var set = this.CreateBindingSet <MapView, MapViewModel>();

            set.Apply();
            CameraPosition camera = CameraPosition.FromCamera(GetInitialCameraPosition(),
                                                              GetInitialCameraZoom());

            mapView = Google.Maps.MapView.FromCamera(CGRect.Empty, camera);
            mapView.MyLocationEnabled         = true;
            mapView.Settings.MyLocationButton = true;
            mapView.CameraPositionIdle       += MapView_CameraPositionIdle;
            mapView.InfoTapped       += MapView_InfoTapped;
            mapView.CoordinateTapped += MapView_CoordinateTapped;
            //mapView.WillMove += MapView_WillMove;
            ViewModel.Items.Changed += ItemsChanged;
            View.AddSubview(mapView);
            mapView.Frame = MapPlaceHolderView.Frame;

            var iconGenerator = new GMUDefaultClusterIconGenerator();
            var algorithm     = new GMUNonHierarchicalDistanceBasedAlgorithm();

            renderer = new GMUDefaultClusterRenderer(mapView, iconGenerator)
            {
                Delegate = new JunctionXClusterRendererDelegate(this)
            };

            clusterManager        = new GMUClusterManager(mapView, algorithm, renderer);
            mapView.TappedMarker += (map, marker) => SelectMarker(marker);

            ActivityButton.TouchDown  += ActivityButton_TouchDown;
            ActivityButton2.TouchDown += ActivityButton_TouchDown;
            AdoptButton.TouchDown     += AdoptButton_TouchDown;
            DetailsButton.TouchDown   += DetailsButton_TouchDown;
            DetailsButton2.TouchDown  += DetailsButton_TouchDown;
            CloseButton.TouchDown     += CloseButton_TouchDown;

            //var gest = new UITapGestureRecognizer(() => { View.SendSubviewToBack(MarkerInfoView);});
            //TapView.AddGestureRecognizer(gest);
        }
        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;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var camera = CameraPosition.FromCamera (-25.5605, 133.605097, 3);
            mapView = MapView.FromCamera (RectangleF.Empty, camera);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            View = new UIView (RectangleF.Empty);
            View.AddSubview (mapView);

            var holder = new UIView (new RectangleF (0, 0, 0, 59)) {
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin,
                BackgroundColor = UIColor.FromRGBA (1.0f, 1.0f, 1.0f, 0.8f)
            };

            View.AddSubview (holder);

            // Zoom Label
            var label = new UILabel (new RectangleF (16, 16, 200, 29)) {
                Text = "Zooming?",
                Font = UIFont.SystemFontOfSize (18.0f),
                TextAlignment = UITextAlignment.Left,
                BackgroundColor = UIColor.Clear
            };
            label.Layer.ShadowColor = UIColor.White.CGColor;
            label.Layer.ShadowOffset = new SizeF (0.0f, 1.0f);
            label.Layer.ShadowOpacity = 1.0f;
            label.Layer.ShadowRadius = 0.0f;
            holder.AddSubview (label);

            // Control zooming.
            zoomSwitch = new UISwitch (new RectangleF (-90, 16, 0, 0)) {
                AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin
            };
            zoomSwitch.ValueChanged += (sender, e) => mapView.Settings.ZoomGestures = zoomSwitch.On;
            zoomSwitch.On = true;
            holder.AddSubview (zoomSwitch);
        }
Exemple #26
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			stationsRepository = new WebStationRepository ();

			var centerPoint = Station.TroncalRouteCenter;
			var centerCoordinate = new CLLocationCoordinate2D (centerPoint.Y, centerPoint.X);
			var bounds = UIScreen.MainScreen.Bounds;

			CameraPosition cameraPosition = CameraPosition.FromCamera (centerCoordinate, 14.0f);
			var map = MapView.FromCamera (new RectangleF (0, 64, bounds.Width, bounds.Height - 60), cameraPosition);
			map.MyLocationEnabled = true;
			map.MapType = MapViewType.Normal;
			map.Settings.MyLocationButton = true;

			this.mapView = map;
			if (UIDevice.CurrentDevice.CheckSystemVersion(7,0)) {
				NavigationBar.Frame = new RectangleF (NavigationBar.Frame.X, NavigationBar.Frame.Y, NavigationBar.Frame.Width, 64.0f);
			}

			var item = new UINavigationItem ("CHART");
			UIBarButtonItem button = new UIBarButtonItem (MainViewController.ResizedImageIcon(UIImage.FromFile("menu.png")), UIBarButtonItemStyle.Bordered, delegate {
				navigation.ToggleMenu();
			});
			UIBarButtonItem closestStationButton = new UIBarButtonItem ("Cercana", UIBarButtonItemStyle.Bordered, delegate {
				FindClosestStation();
			});

			item.LeftBarButtonItem = button;
			item.HidesBackButton = true;
			item.RightBarButtonItem = closestStationButton;
			NavigationBar.PushNavigationItem (item, false);

			notificationView = new GCDiscreetNotificationView ("Buscando estación cercana...", 
			                                                  true, GCDNPresentationMode.Bottom, mapView);
			this.View.AddSubview (map);
			LoadMapInfo ();
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            var camera = CameraPosition.FromCamera (-33.868, 151.2086, 12);
            mapView = MapView.FromCamera (RectangleF.Empty, camera);
            mapView.Settings.CompassButton = true;
            mapView.Settings.MyLocationButton = true;

            // Listen to the myLocation property of GMSMapView.
            mapView.AddObserver (this, new NSString ("myLocation"), NSKeyValueObservingOptions.New, IntPtr.Zero);

            View = mapView;
            // Ask for My Location data after the map has already been added to the UI.
            InvokeOnMainThread (()=> mapView.MyLocationEnabled = true);
            // Perform any additional setup after loading the view, typically from a nib.
            switcher = new UISegmentedControl (new [] {"Normal", "Satellite", "Hybrid", "Terrain"}) {
                AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin,
                SelectedSegment = 0,
                ControlStyle = UISegmentedControlStyle.Bar
            };
            NavigationItem.TitleView = switcher;
            // Listen to touch events on the UISegmentedControl.
            switcher.ValueChanged += HandleValueChanged;
        }
 public MapDelegate(MapView map)
 {
     Locations = new List<CLLocationCoordinate2D>();
     Lines = new List<Google.Maps.Polyline>();
     _map = map;
 }
Exemple #29
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            CameraPosition camera = CameraPosition.FromCamera(GetInitialCameraPosition(),
                                                              GetInitialCameraZoom());

            mapView = Google.Maps.MapView.FromCamera(CGRect.Empty, camera);
            mapView.MyLocationEnabled         = false;
            mapView.Settings.MyLocationButton = false;
            marker.IconView = new UIImageView(UIImage.FromBundle(ViewModel.Animal.ImageUrl));
            marker.Map      = mapView;
            var set = this.CreateBindingSet <MyAnimalActivityView, MyAnimalActivityViewModel>();

            set.Bind(NameLabel).To(vm => vm.Animal.Name);
            set.Bind(TypeLabel).To(vm => vm.Animal.Type);
            set.Bind(LocationLabel).To(vm => vm.Animal.Location);
            set.Apply();
            AnimLogoImageView.Transformations = ViewModel.Animal.AnimalImageTransformations;
            AnimLogoImageView.ImagePath       = ViewModel.Animal.ImageUrl;
            DateLabel.Text = ViewModel.Animal.BirthdateValue.ToString();

            View.AddSubview(mapView);
            mapView.Frame           = MapPlaceHolderView.Frame;
            ViewModel.Logs.Changed += delegate {
                if (ViewModel.Logs.Value != null)
                {
                    mapView.Animate(new CameraPosition(new CLLocationCoordinate2D(ViewModel.Logs.Value[0].Coordinate.Latitude,
                                                                                  ViewModel.Logs.Value[0].Coordinate.Longitude), defaultZoom));
                    Polylines = new Polyline[ViewModel.Logs.Value.Length - 1];
                    Dates     = new DateTime[ViewModel.Logs.Value.Length - 1];
                    Circles   = new Circle[ViewModel.Logs.Value.Length];
                    for (int i = 0; i < ViewModel.Logs.Value.Length - 1; i++)
                    {
                        var path     = new Google.Maps.MutablePath();
                        var polyline = new Google.Maps.Polyline();
                        path.AddCoordinate(new CLLocationCoordinate2D(latitude: ViewModel.Logs.Value[i].Coordinate.Latitude, longitude: ViewModel.Logs.Value[i].Coordinate.Longitude));
                        path.AddCoordinate(new CLLocationCoordinate2D(latitude: ViewModel.Logs.Value[i + 1].Coordinate.Latitude, longitude: ViewModel.Logs.Value[i + 1].Coordinate.Longitude));
                        polyline.Path        = path;
                        polyline.StrokeColor = CustomColor.JunctionXBlue;
                        polyline.StrokeWidth = 2.5f;
                        Polylines[i]         = polyline;
                        Dates[i]             = ViewModel.Logs.Value[i + 1].DateTimeValue;
                        var circle = new Circle();
                        circle.Position    = new CLLocationCoordinate2D(latitude: ViewModel.Logs.Value[i].Coordinate.Latitude, longitude: ViewModel.Logs.Value[i].Coordinate.Longitude);
                        circle.StrokeColor = CustomColor.JunctionXBlue;
                        circle.FillColor   = CustomColor.JunctionXBlue;
                        circle.Radius      = 7.5f;

                        Circles[i] = circle;
                        if (i + 1 == ViewModel.Logs.Value.Length - 1)
                        {
                            Circles[i + 1] = circle;
                        }
                    }
                    TimeLabel.Text         = Dates[0].ToString();
                    Slider.Value           = 0;
                    Slider.MinValue        = 0;
                    Slider.MaxValue        = ViewModel.Logs.Value.Length - 1;
                    Slider.TouchDragEnter += delegate {
                        animate = false;
                        StartButton.SetImage(UIImage.FromBundle("icPlayCircleFilled24Px"), UIControlState.Normal);
                    };
                    Slider.ValueChanged += delegate {
                        HandlePolylines();
                    };
                    HandlePolylines();

                    StartButton.TouchDown += delegate {
                        if ((int)Slider.Value != (int)Slider.MaxValue)
                        {
                            animate = !animate;
                            if (animate)
                            {
                                StartButton.SetImage(UIImage.FromBundle("icPauseCircleFilled24Px"), UIControlState.Normal);
                            }
                            else
                            {
                                StartButton.SetImage(UIImage.FromBundle("icPlayCircleFilled24Px"), UIControlState.Normal);
                            }
                            if (animate)
                            {
                                Animate();
                            }
                        }
                    };
                }
            };
        }
            public override void DidTapAtCoordinate(MapView mapView, CLLocationCoordinate2D coordinate)
            {

                //Create/Add Marker 
                var marker = new Marker { Position = coordinate, Map = mapView };
                Locations.Add(coordinate);

                if (Locations.Count > 1)
                {
                    SetDirectionsQuery();
                }
            }
		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 ();
		}