コード例 #1
0
ファイル: VehicleTests.cs プロジェクト: zyhong/routing
        /// <summary>
        /// Tests getting factor and speed.
        /// </summary>
        protected void TestFactorAndSpeed(Itinero.Profiles.IProfileInstance profile, short?direction, float?factor, float?speed, params string[] tags)
        {
            var attributesCollection = new AttributeCollection();

            for (int idx = 0; idx < tags.Length; idx = idx + 2)
            {
                attributesCollection.AddOrReplace(tags[idx], tags[idx + 1]);
            }

            var factorAndSpeed = profile.FactorAndSpeed(attributesCollection);

            if (direction != null)
            {
                Assert.AreEqual(direction.Value, factorAndSpeed.Direction);
            }
            if (factor != null)
            {
                Assert.AreEqual(factor.Value, factorAndSpeed.Value, 0.0001);
            }
            if (speed != null)
            {
                if (speed == 0)
                {
                    Assert.AreEqual(0, factorAndSpeed.SpeedFactor, 0.0001);
                }
                else
                {
                    Assert.AreEqual(1.0f / (speed.Value / 3.6), factorAndSpeed.SpeedFactor, 0.0001);
                }
            }
        }
コード例 #2
0
ファイル: RouterMock.cs プロジェクト: jerryfaust/routing
 public override Result <EdgePath <T> > TryCalculateRaw <T>(Itinero.Profiles.IProfileInstance profile, WeightHandler <T> weightHandler, RouterPoint source, RouterPoint target, RoutingSettings <T> settings)
 {
     return(new Result <EdgePath <T> >(new EdgePath <T>()));
 }
コード例 #3
0
ファイル: RouterMock.cs プロジェクト: jerryfaust/routing
 public override Result <EdgePath <T>[][]> TryCalculateRaw <T>(Itinero.Profiles.IProfileInstance profile, WeightHandler <T> weightHandler, RouterPoint[] sources, RouterPoint[] targets,
                                                               RoutingSettings <T> settings)
 {
     throw new System.NotImplementedException();
 }