Beispiel #1
0
        private Itinero.Profiles.Profile FindProfile(string vehicle, string metric)
        {
            Itinero.Profiles.Vehicle vehicleobject = null;
            switch (vehicle.ToLower())
            {
            case "car":
                vehicleobject = Itinero.Osm.Vehicles.Vehicle.Car;
                break;

            case "pedestrian":
                vehicleobject = Itinero.Osm.Vehicles.Vehicle.Pedestrian;
                break;

            case "bicycle":
                vehicleobject = Itinero.Osm.Vehicles.Vehicle.Bicycle;
                break;

            default:
                return(null);
            }

            switch (metric)
            {
            case "Shortest":
                return(vehicleobject.Shortest());

            case "Fastest":
                return(vehicleobject.Fastest());

            default:
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        ///     If <paramref name="routerDbPath"/> exists, load routing data, otherwise create routing data from pbf file.
        /// </summary>
        /// <param name="pbfPath">PBF file, route info from Open Street Map project</param>
        /// <param name="routerDbPath">ROUTEDB file, serialized route info from Itinero</param>
        public RouteService(string pbfPath, string routerDbPath)
        {
            _vehicle = Vehicle.Car;
            _profile = _vehicle.Fastest();

            if (File.Exists(routerDbPath))
            {
                Load(routerDbPath);
            }
            else if (File.Exists(pbfPath))
            {
                Create(pbfPath, routerDbPath);
            }
            else
            {
                throw new ArgumentException("PBF and ROUTERDB files does not exists");
            }
        }