Beispiel #1
0
        /// <summary>
        /// Initializes new instance of <see cref="GeoLinearRing"/>.
        /// </summary>
        /// <param name="coordinates"></param>
        public GeoLinearRing(IEnumerable <GeoPosition> coordinates)
        {
            Argument.AssertNotNull(coordinates, nameof(coordinates));

            Coordinates = new GeoArray <GeoPosition>(coordinates.ToArray());

            if (Coordinates.Count < 4)
            {
                throw new ArgumentException("The linear ring is required to have at least 4 coordinates");
            }

            if (Coordinates[0] != Coordinates[Coordinates.Count - 1])
            {
                throw new ArgumentException("The first and last coordinate of the linear ring are required to be equal");
            }
        }
 /// <summary>
 /// Initializes new instance of <see cref="GeoLineString"/>.
 /// </summary>
 /// <param name="coordinates">The collection of <see cref="GeoPosition"/> that make up the line.</param>
 /// <param name="boundingBox">The <see cref="GeoBoundingBox"/> to use.</param>
 /// <param name="customProperties">The set of custom properties associated with the <see cref="GeoObject"/>.</param>
 public GeoLineString(IEnumerable <GeoPosition> coordinates, GeoBoundingBox?boundingBox, IReadOnlyDictionary <string, object?> customProperties) : base(boundingBox, customProperties)
 {
     Coordinates = new GeoArray <GeoPosition>(coordinates.ToArray());
 }