当前位置: 首页>>代码示例>>C#>>正文


C# GeoCoordinate.DistanceTo方法代码示例

本文整理汇总了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);
        }
开发者ID:Vanaheimr,项目名称:Aegir,代码行数:8,代码来源:GeoPositionTests.cs

示例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
                                                                   ));
            }
        }
开发者ID:mrange,项目名称:bikes,代码行数:14,代码来源:DataModel.cs

示例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>();
        }
开发者ID:Vanaheimr,项目名称:Aegir,代码行数:22,代码来源:GeoLine.cs

示例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);
        }
开发者ID:Vanaheimr,项目名称:Aegir,代码行数:22,代码来源:GeoVector.cs


注:本文中的GeoCoordinate.DistanceTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。