本文整理汇总了C#中GeoCoordinate.DistanceTo方法的典型用法代码示例。如果您正苦于以下问题:C# GeoCoordinate.DistanceTo方法的具体用法?C# GeoCoordinate.DistanceTo怎么用?C# GeoCoordinate.DistanceTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoCoordinate
的用法示例。
在下文中一共展示了GeoCoordinate.DistanceTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DistanceTest
public void DistanceTest()
{
var Seattle = new GeoCoordinate(new Latitude(47.621800), new Longitude(-122.350326));
var Olympia = new GeoCoordinate(new Latitude(47.041917), new Longitude(-122.893766));
var Distance = Seattle.DistanceTo(Olympia);
Assert.AreEqual(76.3866157995487, Distance, 0.0001);
}
示例2: Model_UpdateStations
void Model_UpdateStations()
{
var location = new GeoCoordinate(State_MyLa, State_MyLo);
for (int index = 0; index < State_Stations.Count; index++)
{
var station = State_Stations[index];
station.Station_Distance = location.DistanceTo(new GeoCoordinate(
station.Station_La,
station.Station_Lo
));
}
}
示例3: GeoLine
/// <summary>
/// Create line with geo coordinates.
/// </summary>
/// <param name="GeoCoordinate1">A geo coordinate.</param>
/// <param name="GeoCoordinate2">A geo coordinate.</param>
public GeoLine(GeoCoordinate GeoCoordinate1, GeoCoordinate GeoCoordinate2)
{
#region Initial Checks
if (GeoCoordinate1 == null)
throw new ArgumentNullException("The given left-coordinate must not be null!");
if (GeoCoordinate2 == null)
throw new ArgumentNullException("The given right-coordinate must not be null!");
#endregion
this.P1 = GeoCoordinate1;
this.P2 = GeoCoordinate2;
this.Length = GeoCoordinate1.DistanceTo(GeoCoordinate2);
this.Tags = new List<String>();
}
示例4: GeoVector
/// <summary>
/// Create a 2-dimensional vector of type T.
/// </summary>
/// <param name="GeoCoordinate1">A pixel of type T.</param>
/// <param name="GeoCoordinate2">A pixel of type T.</param>
public GeoVector(GeoCoordinate GeoCoordinate1, GeoCoordinate GeoCoordinate2)
{
#region Initial Checks
if (GeoCoordinate1 == null)
throw new ArgumentNullException("The first pixel must not be null!");
if (GeoCoordinate2 == null)
throw new ArgumentNullException("The second pixel must not be null!");
#endregion
this.P = new GeoCoordinate(new Latitude (GeoCoordinate1.Latitude.Value - GeoCoordinate2.Latitude.Value),
new Longitude(GeoCoordinate1.Longitude.Value - GeoCoordinate2.Longitude.Value));
this.Length = GeoCoordinate1.DistanceTo(GeoCoordinate2);
}