Exemplo n.º 1
0
        public Int32 GetPathLength(City secondCity)
        {
            OSRM_PairOfCities newPair = new OSRM_PairOfCities(GetStrCoords(), secondCity.GetStrCoords());

            if (newPair.GetDistance() != -1)
            {
                return((Int32)Math.Round(newPair.GetDistance()));
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 2
0
        public void ComputeRoute()
        {
            Int32 vertCount = Cities.Count;

            Int32[,] adjMatx = Graph;

            adjMatx[0, 0] = 1;

            Int32[] currRoute = new Int32[vertCount];

            Algorithm(1, 0, currRoute, vertCount, adjMatx);

            Int32 sec = 0;

            for (int i = 0; i < vertCount - 1; i++)
            {
                OSRM_PairOfCities newPair = new OSRM_PairOfCities(Cities[Route[i]], Cities[Route[i + 1]]);
                sec += (Int32)Math.Round(newPair.GetDuration());
            }

            AproxTime = (sec / 3600).ToString() + " h  " + ((sec % 3600) / 60).ToString() + " m";
        }