Esempio n. 1
0
 public RouteCtr()
 {
     this.graph = new Graph();
     this.Distance = new Dictionary<int, double>();
     this.Path = new Dictionary<int, int>();
     route = new Route();
 }
        private void InitializeCalculator(double range, double startLat, double startLong, double destLat, double destLong)
        {
            this.Range = range;
            Console.WriteLine("[DEBUG MESSAGE]: Initial Range: {0}", this.Range);

            // Declare and Initialize start and destination points
            this.Start = new Location();
            this.Dest = new Location();
            this.Start.GeoCoordinate.Latitude = startLat;
            this.Start.GeoCoordinate.Longitude = startLong;
            this.Dest.GeoCoordinate.Latitude = destLat;
            this.Dest.GeoCoordinate.Longitude = destLong;

            // Determine the euclidian distance, in kilometers, between Start and Dest
            this.FinalStraightLine = Start.GetDistanceToKM(Dest.GeoCoordinate);
            Console.WriteLine("[DEBUG MESSAGE]:: Final Straight Line: {0}", this.FinalStraightLine);

            // Get the vertices closest to Start and Dest, in respect to their coordinates, respectively.
            this.From = GetClosestNodeToStart();
            this.To = GetClosestNodeToDest();
            Console.WriteLine("[DEBUG MESSAGE]: From: {0}", this.From);
            Console.WriteLine("[DEBUG MESSAGE]: To: {0}", this.To);

            this.graph = new Graph();
            this.Distance = new Dictionary<int, double>();
            this.Path = new Dictionary<int, int>();
        }