| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Collections; |
| | 5 | | using System.Collections.Generic; |
| | 6 | | using System.Drawing; |
| | 7 | | using System.Linq; |
| | 8 | |
|
| | 9 | | namespace Azure.Core.GeoJson |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Represents a geometry that is composed of multiple <see cref="GeoPoint"/>. |
| | 13 | | /// </summary> |
| | 14 | | public sealed class GeoPointCollection : GeoObject, IReadOnlyList<GeoPoint> |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Initializes new instance of <see cref="GeoPointCollection"/>. |
| | 18 | | /// </summary> |
| | 19 | | /// <param name="points">The collection of inner points.</param> |
| 0 | 20 | | public GeoPointCollection(IEnumerable<GeoPoint> points): this(points, null, DefaultProperties) |
| | 21 | | { |
| 0 | 22 | | } |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// Initializes new instance of <see cref="GeoPointCollection"/>. |
| | 26 | | /// </summary> |
| | 27 | | /// <param name="points">The collection of inner points.</param> |
| | 28 | | /// <param name="boundingBox">The <see cref="GeoBoundingBox"/> to use.</param> |
| | 29 | | /// <param name="additionalProperties">The set of additional properties associated with the <see cref="GeoObject |
| 16 | 30 | | public GeoPointCollection(IEnumerable<GeoPoint> points, GeoBoundingBox? boundingBox, IReadOnlyDictionary<string, |
| | 31 | | { |
| 16 | 32 | | Argument.AssertNotNull(points, nameof(points)); |
| | 33 | |
|
| 16 | 34 | | Points = points.ToArray(); |
| 16 | 35 | | } |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// |
| | 39 | | /// </summary> |
| 24 | 40 | | internal IReadOnlyList<GeoPoint> Points { get; } |
| | 41 | |
|
| | 42 | | /// <inheritdoc /> |
| | 43 | | public IEnumerator<GeoPoint> GetEnumerator() |
| | 44 | | { |
| 0 | 45 | | return Points.GetEnumerator(); |
| | 46 | | } |
| | 47 | |
|
| | 48 | | IEnumerator IEnumerable.GetEnumerator() |
| | 49 | | { |
| 0 | 50 | | return GetEnumerator(); |
| | 51 | | } |
| | 52 | |
|
| | 53 | | /// <inheritdoc /> |
| 0 | 54 | | public int Count => Points.Count; |
| | 55 | |
|
| | 56 | | /// <inheritdoc /> |
| 0 | 57 | | public GeoPoint this[int index] => Points[index]; |
| | 58 | | } |
| | 59 | | } |