-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
GeoPoint.cs
67 lines (60 loc) · 2.55 KB
/
GeoPoint.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Azure.Core.GeoJson
{
/// <summary>
/// Represents a point geometry.
/// </summary>
/// <example>
/// Creating a point:
/// <code snippet="Snippet:CreatePoint" language="csharp">
/// var point = new GeoPoint(-122.091954, 47.607148);
/// </code>
/// </example>
[JsonConverter(typeof(GeoJsonConverter))]
public sealed class GeoPoint : GeoObject
{
/// <summary>
/// Initializes new instance of <see cref="GeoPoint"/>.
/// </summary>
/// <param name="longitude">The longitude of the point.</param>
/// <param name="latitude">The latitude of the point.</param>
public GeoPoint(double longitude, double latitude): this(new GeoPosition(longitude, latitude), null, DefaultProperties)
{
}
/// <summary>
/// Initializes new instance of <see cref="GeoPoint"/>.
/// </summary>
/// <param name="longitude">The longitude of the point.</param>
/// <param name="latitude">The latitude of the point.</param>
/// <param name="altitude">The altitude of the point.</param>
public GeoPoint(double longitude, double latitude, double? altitude): this(new GeoPosition(longitude, latitude, altitude), null, DefaultProperties)
{
}
/// <summary>
/// Initializes new instance of <see cref="GeoPoint"/>.
/// </summary>
/// <param name="position">The position of the point.</param>
public GeoPoint(GeoPosition position): this(position, null, DefaultProperties)
{
}
/// <summary>
/// Initializes new instance of <see cref="GeoPoint"/>.
/// </summary>
/// <param name="position">The position of the point.</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 GeoPoint(GeoPosition position, GeoBoundingBox? boundingBox, IReadOnlyDictionary<string, object?> customProperties): base(boundingBox, customProperties)
{
Coordinates = position;
}
/// <summary>
/// Gets position of the point.
/// </summary>
public GeoPosition Coordinates { get; }
/// <inheritdoc />
public override GeoObjectType Type { get; } = GeoObjectType.Point;
}
}