Example #1
0
        /// <summary>
        /// Calculates all routes between one source and many target points.
        /// </summary>
        /// <param name="vehicle">The vehicle profile.</param>
        /// <param name="source"></param>
        /// <param name="targets"></param>
        /// <param name="max">The maximum weight to stop the calculation.</param>
        /// <param name="geometryOnly">Flag to return .</param>
        /// <returns></returns>
        public Route[] CalculateOneToMany(Vehicle vehicle, RouterPoint source, RouterPoint[] targets, float max = float.MaxValue, bool geometryOnly = false)
        {
            if (vehicle == null)
            {
                throw new ArgumentNullException("vehicle");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (targets == null)
            {
                throw new ArgumentNullException("targets");
            }

            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.CalculateOneToMany(vehicle, source, targets, max, geometryOnly));
        }
Example #2
0
 /// <summary>
 /// Calculates all routes 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 Route[] CalculateOneToMany(Vehicle vehicle, RouterPoint source, RouterPoint[] targets)
 {
     return(_router.CalculateOneToMany(vehicle, source, targets));
 }