Ejemplo n.º 1
0
        private void showUserMap()
        {
            map.MapType           = MKMapType.HybridFlyover;
            map.ShowsUserLocation = true;
            map.ZoomEnabled       = true;
            map.ScrollEnabled     = true;
            map.ShowsBuildings    = true;
            map.PitchEnabled      = true;
            map.ShowsCompass      = false;
            double lat = 30.2652233534254;
            double lon = -97.73815460962083;
            CLLocationCoordinate2D mapCenter = new CLLocationCoordinate2D(lat, lon);
            CLLocationCoordinate2D viewPoint = new CLLocationCoordinate2D(lat + 0.0050, lon - 0.0072);
            MKCoordinateRegion     mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 1500, 1500);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;
            var camera = MKMapCamera.CameraLookingAtCenterCoordinate(mapCenter, viewPoint, 500);

            map.Camera   = camera;
            mapDelegate  = new MapDelegate();
            map.Delegate = mapDelegate;
            askUserPermissions();

            var tapRecogniser     = new UITapGestureRecognizer(this, new Selector("MapTapSelector:"));
            var longTapRecogniser = new UILongPressGestureRecognizer(this, new Selector("MapLongTapSelector:"));

            map.AddGestureRecognizer(tapRecogniser);
            map.AddGestureRecognizer(longTapRecogniser);
            var hotelOverlay = MKCircle.Circle(mapCenter, 1000);

            map.AddOverlay(hotelOverlay);
        }
Ejemplo n.º 2
0
        partial void btnSingapore_Activated(UIBarButtonItem sender)
        {
            var camera = new MKMapCamera {
                CenterCoordinate = locSingapore,
                Altitude         = 10000,
                Pitch            = 45,
                Heading          = 180
            };

            map.SetCamera(camera, true);
        }
Ejemplo n.º 3
0
        private void UserLocation(object sender, MKUserLocationEventArgs e)
        {
            MKMapView nativeMap = Control as MKMapView;
            // Create the camera
            MKMapCamera camera = new MKMapCamera
            {
                Pitch            = 80,
                CenterCoordinate = new CLLocationCoordinate2D(e.UserLocation.Location.Coordinate.Latitude, e.UserLocation.Location.Coordinate.Longitude),
                Altitude         = 100,
                Heading          = e.UserLocation.Heading.HeadingAccuracy,
            };

            nativeMap.SetCamera(camera, true);
        }
        private void ShowMap()
        {
            if (Vm.Conference.Address.Latitude.HasValue && Vm.Conference.Address.Longitude.HasValue)
            {
                conferenceMap.Hidden = false;

                MKMapCamera currentLocation = new MKMapCamera {
                    CenterCoordinate = new CLLocationCoordinate2D((double)Vm.Conference.Address.Latitude.Value, (double)Vm.Conference.Address.Longitude.Value),
                    Altitude         = 1200.0,
                    Pitch            = 45.0f,
                    Heading          = 130.0
                };

                conferenceMap.SetCamera(currentLocation, animated: true);
            }
            else
            {
                //TODO : Look for address?
                conferenceMap.Hidden = true;
            }
        }
        //~MapViewController()
        //{
        //	Console.WriteLine("MapViewController is about to be collected");
        //}
        void Lm_LocationsUpdated(object sender, CLLocationsUpdatedEventArgs e)
        {
            CLLocation newLocation = e.Locations[e.Locations.Length - 1];

            lastKnowLocation = newLocation;

            if (normalRangeMeters != 0 || maxRangeMeters != 0)
            {
                if (RangeMapView.Overlays != null && RangeMapView.Overlays.Count() > 0)
                {
                    return;
                    //RangeMapView.RemoveOverlays(RangeMapView.Overlays);
                }

                if (normalRangeMeters != 0)
                {
                    var normalRangeCircle = MKCircle.Circle(lastKnowLocation.Coordinate, normalRangeMeters);
                    RangeMapView.AddOverlay(normalRangeCircle);
                }

                if (maxRangeMeters != 0)
                {
                    var maxRangeCircle = MKCircle.Circle(lastKnowLocation.Coordinate, maxRangeMeters);
                    RangeMapView.AddOverlay(maxRangeCircle);
                }


                MKMapCamera camera = new MKMapCamera
                {
                    CenterCoordinate = lastKnowLocation.Coordinate,
                    //Altitude = maxRangeMeters != 0 ? maxRangeMeters * 20 : normalRangeMeters *20
                    Altitude = 100000000,
                    Pitch    = 0.0f,
                };

                RangeMapView.SetCamera(camera, true);

                View.BringSubviewToFront(CloseButton);
            }
        }
        private void ShowMap()
		{
			if (Vm.Conference.Address.Latitude.HasValue && Vm.Conference.Address.Longitude.HasValue) {
				conferenceMap.Hidden = false;

				MKMapCamera currentLocation = new MKMapCamera {
					CenterCoordinate = new CLLocationCoordinate2D ((double)Vm.Conference.Address.Latitude.Value, (double)Vm.Conference.Address.Longitude.Value),
					Altitude = 1200.0,
					Pitch = 45.0f,
					Heading = 130.0
				};

				conferenceMap.SetCamera (currentLocation, animated: true);
			} else {
				//TODO : Look for address?
				conferenceMap.Hidden = true;
			}
		}
Ejemplo n.º 7
0
 public Flyover(MKMapCamera mapCamera)
 {
     Coordinate = mapCamera.CenterCoordinate;
 }
Ejemplo n.º 8
0
        //UIView customPinView;
        //bool animando = false;

        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);
            var map = e.NewElement;

            if (e.OldElement != null)
            {
                _nativeMap = Control as MKMapView;
                //_nativeMap.GetViewForAnnotation = null;
            }

            if (e.NewElement != null)
            {
                //RadarPin radar = new RadarPin();
                //RadarMKAnnotation radarMKAnnotation = new RadarMKAnnotation(radar);
                _radarMap = (RadarMap)e.NewElement;
                //SetNativeControl(new MKMapView(CGRect.Empty));
                _nativeMap = Control as MKMapView;
                //MeuCustomPin customPin = new MeuCustomPin();
                //_nativeMap.Delegate = customPin;
                //_nativeMap.AddAnnotation(new MKPointAnnotation()
                //{
                //	Coordinate = new CLLocationCoordinate2D(radar.Pin.Position.Latitude, radar.Pin.Position.Longitude)
                //});
                //_nativeMap.GetViewForAnnotation = GetViewForAnnotation;
                _radarMap.AoAtualizaPosicao += (object sender, LocalizacaoInfo local) => {
                    CLLocationCoordinate2D target = new CLLocationCoordinate2D(local.Latitude, local.Longitude);

                    MKMapCamera camera = MKMapCamera.CameraLookingAtCenterCoordinate(target, PreferenciaUtils.NivelZoom, local.Sentido, local.Sentido);
                    _nativeMap.Camera = camera;
                    //MKCoordinateRegion mapRegion = MKCoordinateRegion.FromDistance(target, 100, 100);
                    //_nativeMap.CenterCoordinate = target;
                    //_nativeMap.Region = mapRegion;
                    _nativeMap.ZoomEnabled = true;
                    //_nativeMap.ShowsUserLocation = true;
                    //MeuCustomPin customPin = new MeuCustomPin();

                    _nativeMap.UserInteractionEnabled = PreferenciaUtils.RotacionarMapa;

                    //_nativeMap.UserInteractionEnabled = false;

                    /*
                     * if (!animando)
                     * {
                     *  if (map == null)
                     *      return;
                     *  CameraPosition.Builder builder = CameraPosition.InvokeBuilder(map.CameraPosition);
                     *  builder.Target(new LatLng(local.Latitude, local.Longitude));
                     *  builder.Bearing(local.Sentido);
                     *  builder.Zoom(Configuracao.MapaZoom);
                     *  builder.Tilt(Configuracao.MapaTilt);
                     *  CameraPosition cameraPosition = builder.Build();
                     *  CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                     *  map.AnimateCamera(cameraUpdate);
                     *  animando = true;
                     * }
                     */
                };
                _radarMap.AoDesenharRadar += (object sender, RadarPin radar) => {
                    var marker = new MKPointAnnotation()
                    {
                        Coordinate = new CoreLocation.CLLocationCoordinate2D(radar.Pin.Position.Latitude, radar.Pin.Position.Longitude),
                        Title      = radar.Pin.Label,
                        Subtitle   = radar.Pin.Address
                    };

                    _nativeMap.AddAnnotation(marker);
                    desenharRadar(radar);
                };
            }
        }