コード例 #1
0
ファイル: Router.cs プロジェクト: teleavtomatika/routing
        /// <summary>
        /// Calculates a route between one source and many target points.
        /// </summary>
        /// <returns></returns>
        public double[] CalculateOneToManyWeight(Vehicle vehicle, RouterPoint source, RouterPoint[] targets, HashSet <int> invalidSet)
        {
            if (vehicle == null)
            {
                throw new ArgumentNullException("vehicle");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (targets == null)
            {
                throw new ArgumentNullException("targets");
            }
            if (invalidSet == null)
            {
                throw new ArgumentNullException("invalidSet");
            }

            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.CalculateOneToManyWeight(vehicle, source, targets, invalidSet));
        }
コード例 #2
0
ファイル: Router.cs プロジェクト: detlevn/OsmSharp
 /// <summary>
 /// Calculates a route between one source and many target points.
 /// </summary>
 /// <param name="vehicle">The vehicle profile.</param>
 /// <param name="source"></param>
 /// <param name="targets"></param>
 /// <returns></returns>
 public double[] CalculateOneToManyWeight(Vehicle vehicle, RouterPoint source, RouterPoint[] targets)
 {
     return(_router.CalculateOneToManyWeight(vehicle, source, targets));
 }