예제 #1
0
        /// <summary>
        /// Calculates all routes between many sources/targets.
        /// </summary>
        /// <param name="vehicle">The vehicle profile.</param>
        /// <param name="sources"></param>
        /// <param name="targets"></param>
        /// <returns></returns>
        public double[][] CalculateManyToManyWeight(Vehicle vehicle, RouterPoint[] sources, RouterPoint[] targets)
        {
            foreach (var source in sources)
            {
                foreach (var target in targets)
                {
                    if (source.Vehicle.UniqueName != target.Vehicle.UniqueName)
                    { // vehicles are different.
                        throw new ArgumentException(string.Format("Not all vehicle profiles match, {0} and {1} are given, expecting identical profiles.",
                                                                  source.Vehicle.UniqueName, target.Vehicle.UniqueName));
                    }
                    if (vehicle.UniqueName != target.Vehicle.UniqueName)
                    { // vehicles are different.
                        throw new ArgumentException(string.Format("Given vehicle profile does not match resolved points, {0} and {1} are given, expecting identical profiles.",
                                                                  vehicle.UniqueName, target.Vehicle.UniqueName));
                    }
                }
            }

            return(_router.CalculateManyToManyWeight(vehicle, sources, targets));
        }
예제 #2
0
파일: Router.cs 프로젝트: detlevn/OsmSharp
 /// <summary>
 /// Calculates all routes between many sources/targets.
 /// </summary>
 /// <param name="vehicle">The vehicle profile.</param>
 /// <param name="sources"></param>
 /// <param name="targets"></param>
 /// <returns></returns>
 public double[][] CalculateManyToManyWeight(Vehicle vehicle, RouterPoint[] sources, RouterPoint[] targets)
 {
     return(_router.CalculateManyToManyWeight(vehicle, sources, targets));
 }