Beispiel #1
0
 public void DeleteZone()
 {
     if (ZonePolygon != null)
     {
         MapViewControl.RemoveOverlay(ZonePolygon);
     }
     ZonePolygon = null;
 }
Beispiel #2
0
        public void CreateRouteBackground(List <LocationDTO> coordonates)
        {
            _controller.InvokeOnMainThread(() =>
            {
                // Clean the map
                if (RoutePolyline != null)
                {
                    MapViewControl.RemoveOverlay(RoutePolyline);
                }
                if (PointsOfRoute.Count > 0)
                {
                    MapViewControl.RemoveAnnotations(PointsOfRoute.ToArray());
                    PointsOfRoute.Clear();
                }
                if (SelectedPointsOfRoute != null)
                {
                    MapViewControl.RemoveAnnotation(SelectedPointsOfRoute);
                }
            });

            if (coordonates.Count != 0)
            {
                foreach (var coordonate in coordonates)
                {
                    if (IsOutOf)
                    {
                        var trackingAnnotation = new TrackingAnnotation(new CLLocationCoordinate2D(coordonate.Latitude, coordonate.Longitude)
                                                                        , " ", string.Empty);
                        trackingAnnotation.Content   = coordonate.DateLocationCreation.FormatDateFromNow();
                        trackingAnnotation.IsInAlert = IsOutOf;
                        PointsOfRoute.Add(trackingAnnotation);
                    }
                    else
                    {
                        var trackingAnnotation = new TrackingAnnotation(new CLLocationCoordinate2D(coordonate.Latitude, coordonate.Longitude)
                                                                        , " ", string.Empty);
                        trackingAnnotation.Content   = coordonate.DateLocationCreation.FormatDateFromNow();
                        trackingAnnotation.IsInAlert = IsOutOf;
                        PointsOfRoute.Add(trackingAnnotation);
                    }
                }
            }
            OnInitTrackingRouteComplete?.Invoke(null, null);
        }
Beispiel #3
0
        public MKCircle CreateAccuracyArea(double latitude
                                           , double longitude
                                           , double accuracy)
        {
            if (_accuracyArea != null)
            {
                MapViewControl.RemoveOverlay(_accuracyArea);
            }
            if (accuracy <= 0)
            {
                return(null);
            }
            var centerPostion = new CLLocationCoordinate2D(latitude, longitude);
            var circle        = MKCircle.Circle(centerPostion, accuracy);

            MapViewControl.AddOverlay(circle);
            MapViewControl.SetVisibleMapRect(circle.BoundingMapRect, new UIEdgeInsets(50, 20, 100, 20), true);
            _accuracyArea = circle;

            return(_accuracyArea);
        }