Beispiel #1
0
        /*INMapReverseGeocoderDelegate 를 직접 상송받아 구현 하는 경우*/
        public void DidFindPlacemark(NGeoPoint location, NMapPlacemark placemark)
        {
            Debug.Write($"Location({location.Longitude},{location.Latitude}) DidFindPlacemark : {placemark.Address}");
            Title = placemark.Address;
            var alert = UIAlertController.Create("ReverseGeocoder", placemark.Address, UIAlertControllerStyle.Alert);
            var ok    = UIAlertAction.Create("OK", UIAlertActionStyle.Default, null);

            alert.AddAction(ok);
            this.PresentViewController(alert, true, null);
        }
Beispiel #2
0
        public static NGeoPoint NGeoPointMake(double longititude, double latitude)
        {
            var location = new NGeoPoint
            {
                Longitude = longititude,
                Latitude  = latitude,
            };

            return(location);
        }
Beispiel #3
0
        void SetMarker(NGeoPoint location)
        {
            ClearOverlays();
            var mapOverlayManager = mapView.MapOverlayManager;
            var poiDataOverlay    = mapOverlayManager.NewPOIdataOverlay();

            poiDataOverlay.InitPOIdata(1);
            var item = poiDataOverlay.AddPOIitemAtLocation(location, "마커 1", UserPOIflagType.Default, null);

            poiDataOverlay.EndPOIdata();
        }
        public void DidUpdateToLocation(NMapLocationManager locationManager, CLLocation location)
        {
            CLLocationCoordinate2D coordinate = location.Coordinate;
            NGeoPoint myLocation = new NGeoPoint();

            myLocation.Longitude = coordinate.Latitude;
            myLocation.Latitude  = coordinate.Latitude;
            var locationAccuracy = (float)location.HorizontalAccuracy;

            mapView.MapOverlayManager.SetMyLocation(myLocation, locationAccuracy);
            mapView.SetMapCenter(myLocation);
        }
Beispiel #5
0
        public override void ViewDidAppear(bool animated)
        {
            //[self.mapView viewDidAppear];
            //[self requestAddressByCoordination:NGeoPointMake(126.978371, 37.5666091)];
            mapView.ViewDidAppear();
            var location = new NGeoPoint
            {
                Longitude = 126.978391,
                Latitude  = 37.5666091,
            };

            RequestAddressByCoordination(location);
            base.ViewDidAppear(animated);
        }
Beispiel #6
0
 public void OnMapView(NMapView mapView, NMapError error)
 {
     //base.OnMapView(mapView, error);
     if (error == null)
     {
         //[self.mapView setMapCenter:NGeoPointMake(126.978371, 37.5666091) atLevel:11];
         //[self.mapView setMapEnlarged:YES mapHD:YES];
         var location = new NGeoPoint()
         {
             Latitude  = 37.5666091,
             Longitude = 126.978391
         };
         mapView.SetMapCenter(location, 11);
         mapView.SetMapEnlarged(true, true);
     }
     else
     {
         Debug.WriteLine("OnMapView:initHandler:" + error.Description);
     }
 }
Beispiel #7
0
 public void OnMapView(NMapView mapView, NMapError error)
 {
     //base.OnMapView(mapView, error);
     if (error == null)
     {
         var location = new NGeoPoint
         {
             Longitude = 126.978391,
             Latitude  = 37.5666091,
         };
         mapView.SetMapCenter(location, 11);
         mapView.SetMapEnlarged(true, true);
         mapView.SetMapViewMode(NMapViewMode.Vector);
         hasInit = true;
     }
     else
     {
         Debug.WriteLine("OnMapView:initHandler:" + error.Description);
     }
 }
Beispiel #8
0
        /* 이벤트 방식으로 구현하는 경우 */
        #endregion

        #region private Methods Area
        void RequestAddressByCoordination(NGeoPoint location)
        {
            mapView.FindPlacemarkAtLocation(location);
            SetMarker(location);
        }
Beispiel #9
0
 public void DidFailWithError(NGeoPoint location, NMapError error)
 {
     Debug.Write($"Location({location.Longitude},{location.Latitude}) didFailWithError : {error.Description}");
 }
Beispiel #10
0
        public void AdjustBounds(NMapView mapView, bool animate, bool adjustToCenter)
        {
            if (adjustToCenter)
            {
                NGeoPoint pt = mOverlayItem.Point;
                if (animate)
                {
                    mapView.MapController.AnimateTo(pt, true);
                }
                else
                {
                    mapView.MapController.MapCenter = pt;
                }
            }
            else
            {
                Rect boundsVisible = mapView.MapController.BoundsVisible;
                Rect bounds        = GetBounds(mapView);

                int marginX = MarginX;

                if (!boundsVisible.Contains(bounds))
                {
                    int centerX = 0;
                    if (bounds.Width() >= boundsVisible.Width())
                    {
                        centerX = bounds.CenterX();
                    }
                    else
                    {
                        if (bounds.Left < boundsVisible.Left)
                        {
                            centerX = boundsVisible.Left - bounds.Left + marginX;
                        }
                        else if (bounds.Right > boundsVisible.Right)
                        {
                            centerX = boundsVisible.Right - bounds.Right - marginX;
                        }
                        centerX = boundsVisible.CenterX() - centerX;
                    }

                    int centerY = 0;
                    if (bounds.Top < boundsVisible.Top)
                    {
                        centerY = boundsVisible.Top - bounds.Top + marginX;
                    }
                    else if (bounds.Bottom > boundsVisible.Bottom)
                    {
                        centerY = boundsVisible.Bottom - bounds.Bottom - marginX;
                    }
                    centerY = boundsVisible.CenterY() - centerY;

                    NGeoPoint pt = mapView.MapProjection.FromPixels(centerX, centerY);
                    if (animate)
                    {
                        mapView.MapController.AnimateTo(pt, true);
                    }
                    else
                    {
                        mapView.MapController.MapCenter = pt;
                    }
                }
            }

            if (animate)
            {
                AnimateCallout();
            }
        }