Пример #1
0
        /// <summary>
        /// Calculates a route between two given points.
        /// </summary>
        /// <param name="vehicle">The vehicle profile.</param>
        /// <param name="source">The source point.</param>
        /// <param name="target">The target point.</param>
        /// <returns></returns>
        public Route Calculate(Vehicle vehicle, RouterPoint source, RouterPoint target)
        {
            if (vehicle == null)
            {
                throw new ArgumentNullException("vehicle");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            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.Calculate(vehicle, source, target));
        }
Пример #2
0
 /// <summary>
 /// Calculates a route between two given points.
 /// </summary>
 /// <param name="vehicle">The vehicle profile.</param>
 /// <param name="source">The source point.</param>
 /// <param name="target">The target point.</param>
 /// <returns></returns>
 public Route Calculate(Vehicle vehicle, RouterPoint source, RouterPoint target)
 {
     return(_router.Calculate(vehicle, source, target));
 }