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


C# Distance类代码示例

本文整理汇总了C#中Distance的典型用法代码示例。如果您正苦于以下问题:C# Distance类的具体用法?C# Distance怎么用?C# Distance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Distance类属于命名空间,在下文中一共展示了Distance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimpleLineSubdivisionOperation

 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleLineSubdivisionOperation"/> class
 /// </summary>
 /// <param name="splitLine">The line to split.</param>
 /// <param name="dist">The distance to the split point.</param>
 /// <param name="isFromEnd">Is the distance observed from the end of the line?</param>
 internal SimpleLineSubdivisionOperation(LineFeature splitLine, Distance dist, bool isFromEnd)
     : base()
 {
     m_Line = splitLine;
     m_Distance = dist;
     m_IsFromEnd = isFromEnd;
 }
开发者ID:steve-stanton,项目名称:backsight,代码行数:13,代码来源:SimpleLineSubdivisionOperation.cs

示例2: TestConstructorValue

        public void TestConstructorValue()
        {
            Distance dist = new Distance("5 m");

            Assert.AreEqual(5, dist.Value);
            Assert.AreEqual(DistanceUnit.Meters, dist.Units);
        }
开发者ID:rowetechinc,项目名称:RTI,代码行数:7,代码来源:DistanceTest.cs

示例3: TestConstructorValueCulture

        public void TestConstructorValueCulture()
        {
            Distance dist = new Distance("5 m", CultureInfo.CurrentCulture);

            Assert.AreEqual(5, dist.Value);
            Assert.AreEqual(DistanceUnit.Meters, dist.Units);
        }
开发者ID:rowetechinc,项目名称:RTI,代码行数:7,代码来源:DistanceTest.cs

示例4: CanCreate

        public void CanCreate()
        {
            Distance distance = new Distance(5.7, DistanceUnits.Miles);

            Assert.Equal(5.7, distance.Value);
            Assert.Equal(DistanceUnits.Miles, distance.Units);
        }
开发者ID:Virtualhurst,项目名称:Geocoding.net,代码行数:7,代码来源:DistanceTest.cs

示例5: Position

 public Position(Coordinate coordinate, Accuracy accuracy, Distance altitide, DateTimeOffset timestamp)
 {
     Coordinate = coordinate;
     Accuracy = accuracy;
     Altitude = altitide;
     Timestamp = timestamp;
 }
开发者ID:tomgilder,项目名称:RxPosition,代码行数:7,代码来源:Position.cs

示例6: ConvertToSi

 public void ConvertToSi(Distance s, string dimension)
 {
     if (dimension != "m")
     {
         if (dimension == "km")
         {
             s.Value *= 1000;
         }
         else if (dimension == "dm")
         {
             s.Value /=10;
         }
         else if (dimension == "cm")
         {
             s.Value /= 100;
         }
         else if (dimension == "mm")
         {
             s.Value /= 1000;
         }
         else if (dimension == "mm")
         {
             s.Value /= 1000;
         }
         else
         {
             throw new IncorrectDimensionOfDistanceException();
         }
     }
 }
开发者ID:alena-butkevich,项目名称:OOP,代码行数:30,代码来源:ConverterForDistance.cs

示例7: CalcCalories

        public ActionResult CalcCalories(WeightData weightData, Distance distanceData)
        {
            if (!ModelState.IsValid)
                return new JsonResult { Data = new { Result = false } };

            return new JsonResult { Data = new { Result = true, Calories = caloriesCalc.Calculate(distanceData, weightData) } };
        }
开发者ID:andywhitfield,项目名称:RunnersPal,代码行数:7,代码来源:CalculatorsController.cs

示例8: Add

 /// <summary>
 /// Shifts the point to the specified distance.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <param name="distance">The distance.</param>
 /// <returns>Point shifted to the specified distance.</returns>
 public static Point Add(this Point point, Distance distance)
 {
     return new Point()
     {
         X = distance.X.IsNotSet() ? point.X : point.X + distance.X,
         Y = distance.Y.IsNotSet() ? point.Y : point.Y + distance.Y
     };
 }
开发者ID:Zoomicon,项目名称:ZUI,代码行数:14,代码来源:GeometryExtensions.cs

示例9: GreatCircleDistance

 //public ICoordinate Coordinate
 //{
 //    get { return _loc; }
 //    set { _loc = value; }
 //}
 public Distance GreatCircleDistance(Point pt2)
 {
     double distance = Math.Acos((Math.Sin(this.LatRad) * Math.Sin(pt2.LatRad)) + (Math.Cos(this.LatRad) * Math.Cos(pt2.LatRad) * Math.Cos(pt2.LonRad - this.LonRad)));
     distance = distance * 3963.0;  // Statute Miles
     distance = distance * 1.609344; // to Km
     Distance d = new Distance(distance, DistanceUnits.KILOMETERS);
     return d;
 }
开发者ID:kujosHeist,项目名称:satellitekml,代码行数:13,代码来源:Point.cs

示例10: CircularLeg

        /// <summary>
        /// Creates a new <c>CircularLeg</c> with no spans.
        /// </summary>
        /// <param name="radius">The radius of the circular leg.</param>
        /// <param name="clockwise">True if the curve is clockwise.</param>
        /// <param name="span">The number of spans on the curve.</param>
        internal CircularLeg(Distance radius, bool clockwise, int nspan)
            : base(nspan)
        {
            m_Metrics = new CircularLegMetrics(radius, clockwise);

            // The circle for this leg won't be known till we create a span.
            m_Circle = null;
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:14,代码来源:CircularLeg.cs

示例11: CanCompareForEquality

        public void CanCompareForEquality()
        {
            Distance distance1 = new Distance(5, DistanceUnits.Miles);
            Distance distance2 = new Distance(5, DistanceUnits.Miles);

            Assert.True(distance1.Equals(distance2));
            Assert.Equal(distance1.GetHashCode(), distance2.GetHashCode());
        }
开发者ID:Virtualhurst,项目名称:Geocoding.net,代码行数:8,代码来源:DistanceTest.cs

示例12: InsertSpan

 /// <summary>
 /// Inserts an extra distance into the path.
 /// </summary>
 /// <param name="newdist">The new distance to insert.</param>
 /// <param name="curdist">A distance that this leg already knows about.</param>
 /// <param name="isBefore">Should the new distance go before the existing one?</param>
 internal void InsertSpan(int legIndex, Distance newdist, Distance curdist, bool isBefore)
 {
     /*
     Leg leg = m_Legs[legIndex];
     int spanIndex = leg.GetIndex(curdist);
     var edit = new SpanInsert((uint)legIndex,
      */
 }
开发者ID:steve-stanton,项目名称:backsight,代码行数:14,代码来源:PathEditor.cs

示例13: GetDistance_From130x450yToOwn_130f

		public void GetDistance_From130x450yToOwn_130f()
		{
			var point = new Position(130, 450);

			var act = Goal.Own.GetDistance(point);
			var exp = new Distance(130);

			Assert.AreEqual(exp, act);
		}
开发者ID:Corniel,项目名称:CloudBall.LostKeysUnited,代码行数:9,代码来源:GoalTest.cs

示例14: TestConstructorValueCultureException

        public void TestConstructorValueCultureException()
        {
            Distance dist;

            Assert.Throws<ArgumentException>(() => dist = new Distance("5", CultureInfo.CurrentCulture));

            //Assert.AreEqual(5, dist.Value);
            //Assert.AreEqual(SpeedUnit.MetersPerSecond, dist.Units);
        }
开发者ID:rowetechinc,项目名称:RTI,代码行数:9,代码来源:DistanceTest.cs

示例15: CircularLegMetrics

        /// <summary>
        /// Initializes a new instance of the <see cref="CircularLegMetrics"/> class with
        /// undefined angles (both set to zero).
        /// </summary>
        /// <param name="radius">The observed radius.</param>
        /// <param name="isClockwise">Is the leg directed clockwise?</param>
        internal CircularLegMetrics(Distance radius, bool isClockwise)
        {
            m_Angle1 = m_Angle2 = 0.0;
            m_Radius = radius;

            // Remember if its NOT a clockwise arc.
            if (!isClockwise)
                m_Flag |= CircularLegFlag.CounterClockwise;
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:15,代码来源:CircularLegMetrics.cs


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