Defines a map region.
        public void Include_with_included_coordinate_must_not_extend_the_region(MapRegion originalRegion, Position position)
        {
            var region = originalRegion.Clone();
            region.Include(position);

            region.Should().Be(originalRegion);
        }
        public void Clone_must_create_an_exact_copy()
        {
            var region = new MapRegion(10, 20, 30, 40);
            var copy = region.Clone();

            copy.Should().NotBeSameAs(region);
            copy.Should().Be(region);
        }
        public void Constructor_must_rearange_given_coordinates_if_required(double minX, double maxY, double maxX, double minY)
        {
            var region = new MapRegion(minX, maxY, maxX, minY);

            region.MinX.Should().Be(-10);
            region.MaxX.Should().Be(10);
            region.MinY.Should().Be(-20);
            region.MaxY.Should().Be(20);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PolylineOverlay"/> class.
        /// </summary>
        public PolylineOverlay()
        {
            _items = new LinkedList <Position>();

            _boundingBox = MapRegion.Empty();

            // Defaults
            LineWidth   = 1.0f;
            StrokeColor = Color.Blue;
        }
        public void Include_with_excluded_coordinate_must_extend_the_region(MapRegion originalRegion, Position position)
        {
            var region = originalRegion.Clone();
            region.Include(position);

            region.Should().NotBe(originalRegion);

            region.Contains(position).Should().BeTrue("the new region should containt the included position now");
            originalRegion.Contains(position).Should().BeFalse("the old region should not include the position");
        }
Esempio n. 6
0
        /// <summary>
        /// Makes the map move to the new region. If no region is specified the map will be moved
        /// to fit all annotations that are currently displayed.
        /// </summary>
        /// <param name="region">The region to display.</param>
        /// <param name="animated">Wether to animate the move.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        public void MoveToRegion(MapRegion region = null, bool animated = false)
        {
            LastMoveToRegion = region;

            if (!CameraAnimationEnabled)
            {
                animated = false;
            }
            // Send the move message to the platform renderer
            MessagingCenter.Send(this, this.GetMoveToRegionMessage(), new Tuple <MapRegion, bool>(region, animated));
        }
Esempio n. 7
0
 private void MoveToRegion(MapRegion mapRegion, bool animated)
 {
     if (mapRegion == null)
     {
         // No region specified, fit all annotations
         _renderer.FitAllAnnotations(animated);
     }
     else
     {
         _renderer.MoveToRegion(mapRegion, animated);
     }
 }
Esempio n. 8
0
        public void Include(Position item)
        {
            if (Contains(item) == false)
            {
                var lMinX = Math.Min(MinX, item.Longitude);
                var lMaxX = Math.Max(MaxX, item.Longitude);

                var lMinY = Math.Min(MinY, item.Latitude);
                var lMaxY = Math.Max(MaxY, item.Latitude);

                var newRegion = new MapRegion(lMinX, lMaxY, lMaxX, lMinY);
                _topLeft     = newRegion._topLeft;
                _bottomRight = newRegion._bottomRight;

                RecalculateDimensionsAndCenter();
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Determines whether the specified <see cref="MapRegion"/> is equal to the current.
 /// </summary>
 /// <returns>
 /// True if the specified MapRegion is equal to the current object; otherwise, false.
 /// </returns>
 /// <param name="other">The object to compare with the current object. </param><filterpriority>2</filterpriority>
 protected bool Equals(MapRegion other)
     => other != null && _topLeft.Equals(other._topLeft) && _bottomRight.Equals(other._bottomRight);
Esempio n. 10
0
        public void Include(Position item)
        {
            if (Contains(item) == false)
            {
                var lMinX = Math.Min(MinX, item.Longitude);
                var lMaxX = Math.Max(MaxX, item.Longitude);

                var lMinY = Math.Min(MinY, item.Latitude);
                var lMaxY = Math.Max(MaxY, item.Latitude);

                var newRegion = new MapRegion(lMinX, lMaxY, lMaxX, lMinY);
                _topLeft = newRegion._topLeft;
                _bottomRight = newRegion._bottomRight;

                RecalculateDimensionsAndCenter();
            }
        }
 private void MoveToRegion(MapRegion mapRegion, bool animated)
 {
     if (mapRegion == null)
     {
         // No region specified, fit all annotations
         _renderer.FitAllAnnotations(animated);
     }
     else
     {
         _renderer.MoveToRegion(mapRegion, animated);
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Determines whether the specified <see cref="MapRegion"/> is equal to the current.
 /// </summary>
 /// <returns>
 /// True if the specified MapRegion is equal to the current object; otherwise, false.
 /// </returns>
 /// <param name="other">The object to compare with the current object. </param><filterpriority>2</filterpriority>
 protected bool Equals(MapRegion other)
 => other != null && _topLeft.Equals(other._topLeft) && _bottomRight.Equals(other._bottomRight);
Esempio n. 13
0
        internal MapRegion GetRegionForAllAnnotations()
        {
            var allPinPositions = _renderer.Map.Pins.OfType <IMapPin>().Select(p => p.Location);

            return(MapRegion.FromPositions(allPinPositions));
        }
Esempio n. 14
0
        internal MapRegion GetRegionForAllAnnotations()
        {
            var allPinPositions = _renderer.Map.Pins?.OfType <IMapPin>()?.Select(p => p.Location);

            return(allPinPositions == null || allPinPositions.Count() == 0 ? MapRegion.Empty() : MapRegion.FromPositions(allPinPositions));
        }
Esempio n. 15
0
        /// <summary>
        /// Makes the map move to the new region. If no region is specified the map will be moved
        /// to fit all annotations that are currently displayed.
        /// </summary>
        /// <param name="region">The region to display.</param>
        /// <param name="animated">Wether to animate the move.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        public void MoveToRegion(MapRegion region = null, bool animated = false)
        {
            LastMoveToRegion = region;

            // Send the move message to the platform renderer
            MessagingCenter.Send(this, MessageMapMoveToRegion, new Tuple<MapRegion, bool>(region, animated));
        }