Exemplo n.º 1
0
		static public void FindMe(MKMapView map, string markerText)
		{
			map.Delegate = new MapViewDelegate();
			
			map.SetCenterCoordinate(CurrentLocation, true);
			map.Region = new MKCoordinateRegion(CurrentLocation, new MKCoordinateSpan(0.005, 0.005));
			
			map.SetCenterCoordinate(CurrentLocation, true);
			
			var meAnn = new SpotAnnotation(CurrentLocation, markerText, "");
			map.AddAnnotationObject(meAnn);
		}
Exemplo n.º 2
0
 public void SetCenterCoordinate(MapCoordinate centerCoord, bool animated = false)
 {
     setRegionCoord = centerCoord;
     if (map == null)
     {
         return;
     }
     map.SetCenterCoordinate(GetCoord(centerCoord), animated);
 }
Exemplo n.º 3
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            // add item to map
            CLLocationCoordinate2D coord = MapItems[indexPath.Row].Placemark.Location.Coordinate;

            map.SetCenterCoordinate(coord, true);


            DismissViewController(false, null);
        }
Exemplo n.º 4
0
 public void DidUpdateUserLocation(MKMapView mapView, MKUserLocation userLocation)
 {
     Console.WriteLine("Weak Lat: {0}, Long: {1}, Alt: {2}", userLocation.Coordinate.Latitude, userLocation.Coordinate.Longitude, userLocation.Location.Altitude);
     currLocation = userLocation.Coordinate;
     if (firstLaunch) {
         mapView.SetRegion(MKCoordinateRegion.FromDistance(currLocation, 250, 250), true);
         firstLaunch = false;
     }
     else
         mapView.SetCenterCoordinate(currLocation, true);
 }
Exemplo n.º 5
0
 public override void DidUpdateUserLocation(MKMapView mapView, MKUserLocation userLocation)
 {
     if (!_locationSet) {
         _locationSet = true;
         ZoomToUserLocation (mapView, userLocation);
     }
     else
     {
         mapView.SetCenterCoordinate(userLocation.Coordinate, true);
     }
 }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            //Item der Map hinzufügen
            CLLocationCoordinate2D coord = MapItems[indexPath.Row].Placemark.Location.Coordinate;

            mapView.AddAnnotations(new MKPointAnnotation()
            {
                Title      = MapItems[indexPath.Row].Name,
                Coordinate = coord
            });
            mapView.SetCenterCoordinate(coord, true);
            DismissViewController(false, null);
        }
Exemplo n.º 7
0
 public void DidUpdateUserLocation(MKMapView mapView, MKUserLocation userLocation)
 {
     Console.WriteLine("Weak Lat: {0}, Long: {1}, Alt: {2}", userLocation.Coordinate.Latitude, userLocation.Coordinate.Longitude, userLocation.Location.Altitude);
     currLocation = userLocation.Coordinate;
     if (firstLaunch)
     {
         mapView.SetRegion(MKCoordinateRegion.FromDistance(currLocation, 250, 250), true);
         firstLaunch = false;
     }
     else
     {
         mapView.SetCenterCoordinate(currLocation, true);
     }
 }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            // add item to map
            var coordinate = items[indexPath.Row].Placemark.Location.Coordinate;

            map.AddAnnotations(new MKPointAnnotation
            {
                Coordinate = coordinate,
                Title      = items[indexPath.Row].Name,
            });

            map.SetCenterCoordinate(coordinate, true);
            DismissViewController(false, null);
        }
Exemplo n.º 9
0
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                searchController.SetActive(false, true);

                // add item to map
                CLLocationCoordinate2D coord = MapItems [indexPath.Row].Placemark.Location.Coordinate;

                map.AddAnnotation(new MKPointAnnotation()
                {
                    Title      = MapItems [indexPath.Row].Name,
                    Coordinate = coord
                });

                map.SetCenterCoordinate(coord, true);
            }
Exemplo n.º 10
0
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                // add item to map
                CLLocationCoordinate2D coord = MapItems[indexPath.Row].Placemark.Location.Coordinate;

                map.AddAnnotations(new MKPointAnnotation()
                {
                    Title      = MapItems[indexPath.Row].Name,
                    Coordinate = coord
                });
                map.SetCenterCoordinate(coord, true);

                CLLocationCoordinate2D coords  = map.UserLocation.Coordinate;
                NSDictionary           marker1 = new NSDictionary();
                var orignPlaceMark             = new MKPlacemark((coords), marker1);
                var sourceItem = new MKMapItem(orignPlaceMark);


                var destPlaceMark = new MKPlacemark((coord), marker1);
                var destItem      = new MKMapItem(destPlaceMark);

                var go = new MKDirectionsRequest
                {
                    Source                  = sourceItem,
                    Destination             = destItem,
                    RequestsAlternateRoutes = true
                };

                var line = new MKDirections(go);

                line.CalculateDirections((response, error) =>
                {
                    if (error != null)
                    {
                        Console.WriteLine(error.LocalizedDescription);
                    }
                    else
                    {
                        foreach (var route in response.Routes)
                        {
                            map.AddOverlay(route.Polyline);
                        }
                    }
                    var save = new NSString();
                });

                DismissViewController(false, null);
            }
Exemplo n.º 11
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            // add item to map
            var coordinate = items[indexPath.Row].Placemark.Location.Coordinate;

            map.AddAnnotations(new MKPointAnnotation
            {
                Coordinate = coordinate,
                Title      = items[indexPath.Row].Name,
            });
            showDirection(new CLLocationCoordinate2D(-35.3160, 149.1070), coordinate);
            showDirection(new CLLocationCoordinate2D(-35.3169, 149.1075), new CLLocationCoordinate2D(-35.3160, 149.1070));
            createUsersDetails(map);
            map.SetCenterCoordinate(coordinate, true);
            DismissViewController(false, null);
        }
Exemplo n.º 12
0
Arquivo: vcMap.cs Projeto: pauZc/8_iOS
        private void Do_Rute(MKDirectionsRequest req, UIColor color, CLLocationCoordinate2D[] coord, MKMapView mapView)
        {
            var dir = new MKDirections(req);

            dir.CalculateDirections((response, error) =>
            {
                if (error == null)
                {
                    var rute = response.Routes[0];
                    var rteL = new MKPolylineRenderer(rute.Polyline)
                    {
                        LineWidth   = 5.0f,
                        StrokeColor = color
                    };
                    mapView.OverlayRenderer = (mv, ol) => rteL;
                    var circleoverlay       = MKCircle.Circle(mapView.CenterCoordinate, 1000);
                    mapView.AddOverlay(circleoverlay);

                    int index = 0;

                    foreach (var position in coord)
                    {
                        coord[index] = new CLLocationCoordinate2D(position.Latitude, position.Longitude);
                        index++;
                    }
                    var routeOverlay = MKPolyline.FromCoordinates(coord);


                    mapView.AddOverlay(routeOverlay);
                    mapView.SetCenterCoordinate(coord[1], true);

                    //mapView.AddOverlay(rute.Polyline, MKOverlayLevel.AboveRoads);
                }
                else
                {
                    Console.WriteLine("Error");
                }
            });
        }
Exemplo n.º 13
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            // add item to map
            CLLocationCoordinate2D coord = MapItems[indexPath.Row].Placemark.Location.Coordinate;

            map.AddAnnotations(new MKPointAnnotation()
            {
                Title      = MapItems[indexPath.Row].Name,
                Coordinate = coord
            });

            map.SetCenterCoordinate(coord, true);

            //Also POST this item to the RecentHistory API
            HistoryItem item = new HistoryItem()
            {
                Id           = "0",
                Name         = MapItems[indexPath.Row].Name,
                DateOfSearch = DateTime.Now.ToString("F"),
                Latitude     = coord.Latitude.ToString(),
                Longitude    = coord.Longitude.ToString()
            };

            /*string test = DateTime.Now.ToLongDateString();
             * test = DateTime.Now.ToLongTimeString();
             * test = DateTime.Now.ToShortDateString();
             * test = DateTime.Now.ToShortTimeString();
             * test = DateTime.Now.ToString();
             * test = DateTime.Now.ToString("f0");
             * test = DateTime.Now.ToString("F");*/

            _mainViewModel.PostHistoryItem(item);

            //Back to main view
            DismissViewController(false, null);
        }