Beispiel #1
0
        public static ScenarioDto Build_Random_Scenario()
        {
            var random = new Random(DateTime.Now.Millisecond);
            var number = random.Next();
            var locations = new List<Location>();

            var scenario = new ScenarioDto
            {
                Date = DateTime.Now,
                Name = "Scenario " + number,
                UserId = "user bla"
            };
            scenario.Deliveries = new List<DeliveryDto>();
            scenario.Distances = new List<DistanceDto>();

            number = random.Next(10) + 2;
            for (int i = 0; i < number; i++)
            {
                var location = new Location(i, i);
                locations.Add(location);
                var delivery = new DeliveryDto
                {
                    Address = "address",
                    Description = "Description",
                    Latitude = location.Latitude,
                    Longitude = location.Longitude,
                    Number = i,
                    Delivering = DateTime.Today.AddDays(1)
                };

                scenario.Deliveries.Add(delivery);
            }

            foreach (var dist in new Utilities.Combinatorics.Combinations<Location>(locations, 2))
            {
                var from = dist[0];
                var to = dist[1];
                scenario.Distances.Add(new DistanceDto
                {
                    From_Latitide = from.Latitude,
                    From_Longitude = from.Longitude,

                    To_Latitide = to.Latitude,
                    To_Longitude = to.Longitude,

                    Km = random.Next(),
                    TimeInSeconds= random.Next()
                });
            }

            return scenario;
        }
Beispiel #2
0
 public virtual ReverseGeocodeResult ReverseGeocode(Location location)
 {
     return null;
 }