| | 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.Linq; |
| | 7 | |
|
| | 8 | | namespace Azure.Core.GeoJson |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// Represents a geometry that is composed of multiple <see cref="GeoLine"/>. |
| | 12 | | /// </summary> |
| | 13 | | public sealed class GeoLineCollection : GeoObject, IReadOnlyList<GeoLine> |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// Initializes new instance of <see cref="GeoLineCollection"/>. |
| | 17 | | /// </summary> |
| | 18 | | /// <param name="lines">The collection of inner lines.</param> |
| 0 | 19 | | public GeoLineCollection(IEnumerable<GeoLine> lines): this(lines, null, DefaultProperties) |
| | 20 | | { |
| 0 | 21 | | } |
| | 22 | |
|
| | 23 | | /// <summary> |
| | 24 | | /// Initializes new instance of <see cref="GeoLineCollection"/>. |
| | 25 | | /// </summary> |
| | 26 | | /// <param name="lines">The collection of inner lines.</param> |
| | 27 | | /// <param name="boundingBox">The <see cref="GeoBoundingBox"/> to use.</param> |
| | 28 | | /// <param name="additionalProperties">The set of additional properties associated with the <see cref="GeoObject |
| 16 | 29 | | public GeoLineCollection(IEnumerable<GeoLine> lines, GeoBoundingBox? boundingBox, IReadOnlyDictionary<string, ob |
| | 30 | | { |
| 16 | 31 | | Argument.AssertNotNull(lines, nameof(lines)); |
| | 32 | |
|
| 16 | 33 | | Lines = lines.ToArray(); |
| 16 | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// |
| | 38 | | /// </summary> |
| 24 | 39 | | internal IReadOnlyList<GeoLine> Lines { get; } |
| | 40 | |
|
| | 41 | | /// <inheritdoc /> |
| | 42 | | public IEnumerator<GeoLine> GetEnumerator() |
| | 43 | | { |
| 0 | 44 | | return Lines.GetEnumerator(); |
| | 45 | | } |
| | 46 | |
|
| | 47 | | IEnumerator IEnumerable.GetEnumerator() |
| | 48 | | { |
| 0 | 49 | | return GetEnumerator(); |
| | 50 | | } |
| | 51 | |
|
| | 52 | | /// <inheritdoc /> |
| 0 | 53 | | public int Count => Lines.Count; |
| | 54 | |
|
| | 55 | | /// <inheritdoc /> |
| 0 | 56 | | public GeoLine this[int index] => Lines[index]; |
| | 57 | | } |
| | 58 | | } |