2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 /// Class representing geographical coordinates.
24 public class Geocoordinates : IDisposable
26 internal Interop.CoordinatesHandle handle;
29 /// Constructs map coordinate object.
31 /// <param name="latitude">Latitude value, must be between (-90.0 ~ 90.0) degrees</param>
32 /// <param name="longitude">Longitude value, must be between (-180.0 ~ 180.0) degrees</param>
33 /// <exception cref="System.ArgumentException">Thrown when values for latitude and longitude are not valid.</exception>
34 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
35 public Geocoordinates(double latitude, double longitude)
37 handle = new Interop.CoordinatesHandle(latitude, longitude);
40 internal Geocoordinates(Interop.CoordinatesHandle nativeHandle)
42 handle = nativeHandle;
46 /// Gets latitude of the coordinates.
48 public double Latitude
52 return handle.Latitude;
57 /// Gets longitude of the coordinates.
59 public double Longitude
63 return handle.Longitude;
68 /// Returns a string that represents this object.
70 public override string ToString()
72 return $"[{Latitude}, {Longitude}]";
75 #region IDisposable Support
76 private bool _disposedValue = false;
78 protected virtual void Dispose(bool disposing)
83 _disposedValue = true;
88 /// Releases all resources used by this object.
93 GC.SuppressFinalize(this);