Esempio n. 1
0
        public void CreateZone(List <LatitudeLongitude> coordonates
                               , bool isInAlert
                               , bool isLastMarker = false
                               , int index         = 0)
        {
            if (coordonates?.Count < 1)
            {
                return;
            }
            DeleteZone();

            var listLocation = new List <CLLocationCoordinate2D>();

            coordonates.ForEach(coord => listLocation.Add(new CLLocationCoordinate2D {
                Latitude = coord.Latitude, Longitude = coord.Longitude
            }));

            // Create an array of coordinates from allPins
            var finalCoordonates = new CLLocationCoordinate2D[listLocation.Count + 1];

            int i = 0;

            foreach (var currentPin in listLocation)
            {
                finalCoordonates[i] = currentPin;
                i++;
            }
            finalCoordonates[i] = finalCoordonates[0];

            // Add an overlay of the Zone
            ZonePolygon = MKPolygon.FromCoordinates(finalCoordonates);
            MapViewControl.AddOverlay(ZonePolygon);
        }
Esempio n. 2
0
        public void CreateRouteForeground(List <LocationDTO> coordonates)
        {
            if (PointsOfRoute != null && PointsOfRoute.Count != 0)
            {
                foreach (var annotation in PointsOfRoute)
                {
                    MapViewControl.AddAnnotation(annotation);
                }

                var positionWithSeekios = PointsOfRoute.Select(s => s.Coordinate).ToList();
                if (SelectedAnnotation != null && !positionWithSeekios.Contains(SelectedAnnotation.Coordinate))
                {
                    positionWithSeekios.Add(SelectedAnnotation.Coordinate);
                }
                var polygon = MKPolyline.FromCoordinates(positionWithSeekios.ToArray());
                MapViewControl.AddOverlay(polygon);
                MapViewControl.SetVisibleMapRect(polygon.BoundingMapRect, new UIEdgeInsets(50, 40, 100, 40), true);
            }
        }
Esempio n. 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);
        }